Merge remote-tracking branch 'origin/master' into merge-branch
authorMadhu Venugopal <mavenugo@gmail.com>
Mon, 16 Jun 2014 23:07:37 +0000 (16:07 -0700)
committerMadhu Venugopal <mavenugo@gmail.com>
Tue, 17 Jun 2014 00:34:41 +0000 (17:34 -0700)
Signed-off-by: Madhu Venugopal <mavenugo@gmail.com>
Conflicts:
.gitignore
distribution/opendaylight/pom.xml
neutron/pom.xml
neutron/src/main/java/org/opendaylight/ovsdb/neutron/InternalNetworkManager.java
neutron/src/main/java/org/opendaylight/ovsdb/neutron/SouthboundHandler.java
neutron/src/main/java/org/opendaylight/ovsdb/neutron/TenantNetworkManager.java
neutron/src/main/java/org/opendaylight/ovsdb/neutron/provider/OF10Provider.java
neutron/src/main/java/org/opendaylight/ovsdb/neutron/provider/OF13ProviderManager.java
neutron/src/main/java/org/opendaylight/ovsdb/neutron/provider/ProviderNetworkManager.java
northbound/pom.xml
ovsdb/pom.xml
ovsdb/src/test/java/org/opendaylight/ovsdb/lib/message/OVSDBNettyFactoryIT.java
ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestDeletePortIT.java
plugin/src/main/java/org/opendaylight/ovsdb/plugin/ConfigurationService.java
plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestBase.java

Change-Id: Ib84968636e29a86a2308c112f251e7b5fd0ab0dc
Signed-off-by: Madhu Venugopal <mavenugo@gmail.com>
76 files changed:
LICENSE [new file with mode: 0644]
README.Vagrant [new file with mode: 0644]
Vagrantfile [new file with mode: 0644]
commons/parent/pom.xml
distribution/opendaylight/pom.xml
distribution/opendaylight/src/assemble/bin.xml
distribution/opendaylight/src/assemble/resources/run.base.sh [new file with mode: 0755]
distribution/opendaylight/src/assemble/resources/run.sh [new file with mode: 0755]
neutron/pom.xml
neutron/src/main/java/org/opendaylight/ovsdb/neutron/Activator.java
neutron/src/main/java/org/opendaylight/ovsdb/neutron/AdminConfigManager.java
neutron/src/main/java/org/opendaylight/ovsdb/neutron/BaseHandler.java
neutron/src/main/java/org/opendaylight/ovsdb/neutron/IAdminConfigManager.java [new file with mode: 0644]
neutron/src/main/java/org/opendaylight/ovsdb/neutron/IInternalNetworkManager.java [new file with mode: 0644]
neutron/src/main/java/org/opendaylight/ovsdb/neutron/ITenantNetworkManager.java [new file with mode: 0644]
neutron/src/main/java/org/opendaylight/ovsdb/neutron/InternalNetworkManager.java
neutron/src/main/java/org/opendaylight/ovsdb/neutron/NetworkHandler.java
neutron/src/main/java/org/opendaylight/ovsdb/neutron/NodeConfiguration.java
neutron/src/main/java/org/opendaylight/ovsdb/neutron/PortHandler.java
neutron/src/main/java/org/opendaylight/ovsdb/neutron/PortSecurityHandler.java [new file with mode: 0644]
neutron/src/main/java/org/opendaylight/ovsdb/neutron/SouthboundEvent.java
neutron/src/main/java/org/opendaylight/ovsdb/neutron/SouthboundHandler.java
neutron/src/main/java/org/opendaylight/ovsdb/neutron/TenantNetworkManager.java
neutron/src/main/java/org/opendaylight/ovsdb/neutron/provider/IProviderNetworkManager.java [new file with mode: 0644]
neutron/src/main/java/org/opendaylight/ovsdb/neutron/provider/NetworkProvider.java [new file with mode: 0644]
neutron/src/main/java/org/opendaylight/ovsdb/neutron/provider/OF10Provider.java [moved from neutron/src/main/java/org/opendaylight/ovsdb/neutron/provider/OF10ProviderManager.java with 57% similarity]
neutron/src/main/java/org/opendaylight/ovsdb/neutron/provider/OF13Provider.java [new file with mode: 0644]
neutron/src/main/java/org/opendaylight/ovsdb/neutron/provider/OF13ProviderManager.java [deleted file]
neutron/src/main/java/org/opendaylight/ovsdb/neutron/provider/ProviderNetworkManager.java
neutron/src/test/java/org/opendaylight/ovsdb/neutron/AdminConfigManagerTest.java
neutron/src/test/java/org/opendaylight/ovsdb/neutron/NetworkHandlerTest.java
northbound/src/main/java/org/opendaylight/ovsdb/northbound/OVSDBRow.java
paxexam/common.integrationtest/pom.xml [new file with mode: 0644]
paxexam/plugin.integrationtest/.gitignore [new file with mode: 0644]
paxexam/plugin.integrationtest/pom.xml [new file with mode: 0644]
paxexam/plugin.integrationtest/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbPluginIT.java [new file with mode: 0644]
paxexam/plugin.integrationtest/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestBase.java [new file with mode: 0644]
paxexam/plugin.integrationtest/src/test/resources/logback.xml [new file with mode: 0644]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/ConfigurationService.java
plugin/src/main/java/org/opendaylight/ovsdb/plugin/ConnectionService.java
plugin/src/main/java/org/opendaylight/ovsdb/plugin/InventoryService.java
plugin/src/main/java/org/opendaylight/ovsdb/plugin/OVSDBInventoryListener.java
plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddBridgeIT.java
plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddPortIT.java
plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddTunnelIT.java
plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddVlanIT.java
plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestBase.java
plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestBridgeConfigIT.java
plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestDeletePortIT.java
plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestGetBridgeDomainsIT.java
plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestSetManagerIT.java
plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestSetOFControllerIT.java
resources/bin/README [new file with mode: 0644]
resources/bin/ovsdb-build [new file with mode: 0644]
resources/commons/Mininet_Demo_OVSDB_OF.json.postman_collection
resources/commons/OVSDB_Northbound_APIs.json.postman_collection
resources/commons/README
resources/commons/localhost.json.postman_environment [new file with mode: 0644]
resources/openstack/DevStack.json.postman_collection
resources/openstack/Neutron-v2.0-API-Examples.json.postman_collection [new file with mode: 0644]
resources/openstack/README
resources/openstack/bootvm.sh [new file with mode: 0755]
resources/openstack/dsconf.sh [new file with mode: 0755]
resources/openstack/make-vxlan-net.sh [new file with mode: 0755]
resources/openstack/pingvm.sh [new file with mode: 0755]
resources/openstack/sethostname.sh [new file with mode: 0755]
resources/puppet/hiera.yaml [new file with mode: 0644]
resources/puppet/hieradata/hosts.json [new file with mode: 0644]
resources/puppet/manifests/base.pp [new file with mode: 0644]
resources/puppet/manifests/devstack-compute.pp [new file with mode: 0644]
resources/puppet/manifests/devstack-control.pp [new file with mode: 0644]
resources/puppet/manifests/mininet.pp [new file with mode: 0644]
resources/puppet/scripts/bootstrap.sh [new file with mode: 0644]
resources/puppet/templates/compute.local.conf.erb [new file with mode: 0644]
resources/puppet/templates/control.local.conf.erb [new file with mode: 0644]
resources/puppet/templates/hosts.erb [new file with mode: 0644]

diff --git a/LICENSE b/LICENSE
new file mode 100644 (file)
index 0000000..3d967ae
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,70 @@
+Eclipse Public License - v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
+b) in the case of each subsequent Contributor:
+i) changes to the Program, and
+ii) additions to the Program;
+where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents" mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.
+b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
+c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.
+d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+b) its license agreement:
+i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
+ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
+iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and
+iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+b) a copy of this Agreement must be included with each copy of the Program.
+Contributors may not remove or alter any copyright notices contained within the Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
+
+If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.
\ No newline at end of file
diff --git a/README.Vagrant b/README.Vagrant
new file mode 100644 (file)
index 0000000..3651093
--- /dev/null
@@ -0,0 +1,69 @@
+ODL OVSDB Vagrant
+=================
+
+# Installation
+
+You can download an install for your system from [here](http://www.vagrantup.com/downloads.html)
+Vagrant can also be installed using RubyGems
+
+    gem install vagrant
+
+# Usage
+
+Vagrant is a tool for creating development/test environments.
+The environment created for this project is as follows:
+
+1 x DevStack Control/Compute VM
+1 x DevStack Compute VM
+1 x Mininet VM
+
+It's assumed you already have an OVSDB development environment set up.
+
+1. Run `mvn clean install`
+2. Run `vagrant up`
+3. Start the controller (in distirbution/target/opendaylight/...)
+
+> Note: It's assumed that the subnet 192.168.50.x/24 is not in use
+> Your PC is 192.168.50.1. If you would like to change the addressing,
+> you will need to edit the Vagrantfile and hosts.json
+
+Follow the instructions below for Devstack and Mininet
+
+## DevStack VMs
+
+There are two DevStack VMs. One combined control/compute node and one dedicated compute node.
+The following steps are performed when the VM is created or when `vagrant provision` is run.
+
+- Check dependencies are installed
+- Clone the devstack repository to `devstack`
+- Generate a `local.conf` file
+
+To start DevStack
+
+    vagrant ssh devstack-control
+    # or vagrant ssh devstack-compute
+    cd devstack
+    ./stack.sh
+
+## Mininet
+
+There is a single VM provided for running mininet.
+This is for testing that does not require OpenStack Neutron.
+
+The following steps are performed when the VM is created or when `vagrant provision` is run.
+- Check dependencies are installed
+- Clone the mininet repository
+- Install mininet and Open vSwitch
+
+To start Mininet
+
+    vagrant ssh mininet
+    sudo mn
+
+# Port Forwarding
+
+The following ports are forwarded:
+
+localhost:8080 -> opendaylight:8080
+localhost:8000 -> opendaylight:8000
+localhost:8081 -> devstack-control:8080
diff --git a/Vagrantfile b/Vagrantfile
new file mode 100644 (file)
index 0000000..7874d9f
--- /dev/null
@@ -0,0 +1,64 @@
+# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
+VAGRANTFILE_API_VERSION = "2"
+
+Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
+
+  config.vm.provision "shell", path: "resources/puppet/scripts/bootstrap.sh"
+
+  config.vm.provision "puppet" do |puppet|
+      puppet.hiera_config_path = "resources/puppet/hiera.yaml"
+      puppet.working_directory = "/vagrant/resources/puppet"
+      puppet.manifests_path = "resources/puppet/manifests"
+      puppet.manifest_file  = "base.pp"
+  end
+
+  config.vm.define "mininet" do |mininet|
+    mininet.vm.box = "saucy64"
+    mininet.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-13.10_chef-provisionerless.box"
+    mininet.vm.hostname = "mininet"
+    mininet.vm.network "private_network", ip: "192.168.50.15"
+    mininet.vm.provider :virtualbox do |vb|
+      vb.memory = 2048
+    end
+    mininet.vm.provision "puppet" do |puppet|
+      puppet.hiera_config_path = "resources/puppet/hiera.yaml"
+      puppet.working_directory = "/vagrant/resources/puppet"
+      puppet.manifests_path = "resources/puppet/manifests"
+      puppet.manifest_file  = "mininet.pp"
+    end
+  end
+
+  config.vm.define "devstack-control" do |dsctl|
+    dsctl.vm.box = "saucy64"
+    dsctl.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-13.10_chef-provisionerless.box"
+    dsctl.vm.hostname = "devstack-control"
+    dsctl.vm.network "private_network", ip: "192.168.50.20"
+    dsctl.vm.network "forwarded_port", guest: 8080, host: 8081
+    dsctl.vm.provider :virtualbox do |vb|
+      vb.memory = 4096
+    end
+    dsctl.vm.provision "puppet" do |puppet|
+      puppet.hiera_config_path = "resources/puppet/hiera.yaml"
+      puppet.working_directory = "/vagrant/resources/puppet"
+      puppet.manifests_path = "resources/puppet/manifests"
+      puppet.manifest_file  = "devstack-control.pp"
+    end
+  end
+
+  config.vm.define "devstack-compute" do |dscom|
+    dscom.vm.box = "saucy64"
+    dscom.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-13.10_chef-provisionerless.box"
+    dscom.vm.hostname = "devstack-compute"
+    dscom.vm.network "private_network", ip: "192.168.50.21"
+    dscom.vm.provider :virtualbox do |vb|
+      vb.memory = 4096
+    end
+    dscom.vm.provision "puppet" do |puppet|
+      puppet.hiera_config_path = "resources/puppet/hiera.yaml"
+      puppet.working_directory = "/vagrant/resources/puppet"
+      puppet.manifests_path = "resources/puppet/manifests"
+      puppet.manifest_file  = "devstack-compute.pp"
+    end
+  end
+
+end
index a752b6e7e7f641205ceb1685eaec7431b0f71e10..853afb8227d64e13f10e1cb335f9983815bb80ba 100755 (executable)
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
   </properties>
 
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.opendaylight.ovsdb</groupId>
+        <artifactId>ovsdb</artifactId>
+        <version>0.5.1-SNAPSHOT</version>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
   <build>
     <pluginManagement>
       <plugins>
index da9a9a48adcf10f38728af0453bf836c23cbc8b7..d81f9b21e12102d37463958b1cc47edcad9dfd0d 100755 (executable)
@@ -16,6 +16,34 @@ see https://git.opendaylight.org/gerrit/#/c/390/
   <packaging>pom</packaging>
   <name>ovsdb Distribution</name>
   <dependencies>
+    <dependency>
+      <groupId>org.opendaylight.openflowjava</groupId>
+      <artifactId>openflow-protocol-api</artifactId>
+      <version>0.5-SNAPSHOT</version>
+    </dependency>
+
+    <!-- openflowjava -->
+    <dependency>
+      <groupId>org.opendaylight.openflowjava</groupId>
+      <artifactId>openflow-protocol-impl</artifactId>
+      <version>0.5-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.openflowjava</groupId>
+      <artifactId>openflow-protocol-spi</artifactId>
+      <version>0.5-SNAPSHOT</version>
+    </dependency>
+    <!-- openflowplugin -->
+    <dependency>
+      <groupId>org.opendaylight.openflowplugin</groupId>
+      <artifactId>openflowplugin</artifactId>
+      <version>0.0.3-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.openflowplugin</groupId>
+      <artifactId>openflowplugin-controller-config</artifactId>
+      <version>0.0.3-SNAPSHOT</version>
+    </dependency>
     <dependency>
       <groupId>org.opendaylight.ovsdb</groupId>
       <artifactId>ovsdb_library</artifactId>
@@ -24,7 +52,7 @@ see https://git.opendaylight.org/gerrit/#/c/390/
     <dependency>
       <groupId>org.opendaylight.ovsdb</groupId>
       <artifactId>ovsdb_neutron</artifactId>
-      <version>0.6.0-SNAPSHOT</version>
+      <version>0.7.0-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.ovsdb</groupId>
@@ -93,6 +121,20 @@ see https://git.opendaylight.org/gerrit/#/c/390/
               <ignorePermissions>false</ignorePermissions>
             </configuration>
           </execution>
+          <execution>
+            <id>unpack-provided-configs</id>
+            <goals>
+              <goal>unpack-dependencies</goal>
+            </goals>
+            <phase>generate-resources</phase>
+            <configuration>
+              <outputDirectory>${project.build.directory}/provided-configs</outputDirectory>
+              <includeArtifactIds>openflowplugin-controller-config</includeArtifactIds>
+              <includes>**\/*.xml</includes>
+              <excludeTransitive>true</excludeTransitive>
+              <ignorePermissions>false</ignorePermissions>
+            </configuration>
+          </execution>
         </executions>
       </plugin>
     </plugins>
index b06e147dc61be9939ab0577ef7ae1533d938c399..fd9a8bc444d8890237099db3951d0b6e55b5df82 100644 (file)
     <fileSet>
       <directory>${project.build.directory}/generated-resources</directory>
       <outputDirectory>/</outputDirectory>
+      <excludes>
+          <exclude>opendaylight/plugins/*ovsdb*</exclude>
+          <exclude>opendaylight/run.sh</exclude>
+      </excludes>
+    </fileSet>
+    <fileSet>
+      <directory>${project.build.directory}/provided-configs/initial</directory>
+      <outputDirectory>/opendaylight/configuration/initial.available</outputDirectory>
+      <excludes>
+        <exclude>**/META-INF/**</exclude>
+      </excludes>
     </fileSet>
   </fileSets>
+  <files>
+    <file>
+      <source>${project.build.directory}/generated-resources/opendaylight/run.sh</source>
+      <outputDirectory>/opendaylight/</outputDirectory>
+      <destName>run.internal.sh</destName>
+      <fileMode>0755</fileMode>
+    </file>
+    <file>
+      <source>${basedir}/src/assemble/resources/run.sh</source>
+      <outputDirectory>/opendaylight/</outputDirectory>
+      <fileMode>0755</fileMode>
+    </file>
+    <file>
+      <source>${basedir}/src/assemble/resources/run.base.sh</source>
+      <outputDirectory>/opendaylight/</outputDirectory>
+      <fileMode>0755</fileMode>
+    </file>
+  </files>
   <dependencySets>
     <dependencySet>
       <outputDirectory>opendaylight/plugins</outputDirectory>
-      <excludes>
-        <exclude>equinoxSDK381:org.eclipse.osgi</exclude>
-        <exclude>equinoxSDK381:org.eclipse.equinox.console</exclude>
-        <exclude>equinoxSDK381:org.eclipse.equinox.launcher</exclude>
-        <exclude>equinoxSDK381:org.eclipse.equinox.ds</exclude>
-        <exclude>equinoxSDK381:org.eclipse.equinox.util</exclude>
-        <exclude>equinoxSDK381:org.eclipse.osgi.services</exclude>
-        <exclude>virgomirror:org.eclipse.jdt.core.compiler.batch</exclude>
-        <exclude>org.apache.felix:org.apache.felix.fileinstall</exclude>
-        <exclude>geminiweb:org.eclipse.virgo.kernel.equinox.extensions</exclude>
-        <exclude>org.slf4j:slf4j-api</exclude>
-        <exclude>ch.qos.logback:logback-core</exclude>
-        <exclude>ch.qos.logback:logback-classic</exclude>
-        <exclude>com.sun.jersey:jersey-core</exclude>
-        <exclude>com.sun.jersey:jersey-json</exclude>
-        <exclude>com.sun.jersey:jersey-server</exclude>
-      </excludes>
       <outputFileNameMapping>
         ${artifact.groupId}.${artifact.artifactId}-${artifact.version}${dashClassifier?}.${artifact.extension}
       </outputFileNameMapping>
diff --git a/distribution/opendaylight/src/assemble/resources/run.base.sh b/distribution/opendaylight/src/assemble/resources/run.base.sh
new file mode 100755 (executable)
index 0000000..f721ef8
--- /dev/null
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+# Use same path for run.internal.sh
+RUNSH_DIR=$(dirname $0)
+CONTROLLER_RUNSH=${RUNSH_DIR}/run.internal.sh
+
+OF_FILTER=
+
+# Be extra careful to pass on usage from run.internal.sh, but add our
+# usage as well in the standard way
+function usage {
+    $CONTROLLER_RUNSH -help | sed 's/\[-help\]/\[-help\] \[-of13\] \[-bundlefilter \<bundlefilter\> \]/' | sed "s;$CONTROLLER_RUNSH;$0;"
+    exit 1
+}
+
+OF13=0
+BUNDLEFILTER=
+while true ; do
+    (( i += 1 ))
+    case "${@:$i:1}" in
+        -of13) OF13=1 ;;
+        -bundlefilter) (( i += 1 )); BUNDLEFILTER="|${@:$i:1}";;
+        -help) usage ;;
+        "") break ;;
+    esac
+done
+
+# clean available optional configurations (links)
+find configuration/initial -type l -exec rm {} \;
+
+# OF Filter selection
+OF_FILTER="org.opendaylight.(openflowplugin|openflowjava)"
+if (( $OF13 != 0 )); then
+    OF_FILTER="org.opendaylight.controller.(thirdparty.org.openflow|protocol_plugins.openflow)"
+    while read ofConfig; do
+        ln -s ../initial.available/$(basename ${ofConfig}) configuration/initial/
+    done < <(find configuration/initial.available -name '*openflowplugin.xml')
+fi
+
+# Make sure we suck out our additional args so as to not confuse
+# run.internal.sh
+NEWARGS=`echo $@|sed 's/-of13//'|sed 's/-bundlefilter[ ]*[^ ]*//'`
+
+# Build the filter string
+FILTERBEGINING='^(?!'
+FILTERENDING=').*'
+FILTER=${FILTERBEGINING}${OF_FILTER}${BUNDLEFILTER}${FILTERENDING}
+
+# Run the command
+$CONTROLLER_RUNSH -Dfelix.fileinstall.filter="$FILTER" $NEWARGS
diff --git a/distribution/opendaylight/src/assemble/resources/run.sh b/distribution/opendaylight/src/assemble/resources/run.sh
new file mode 100755 (executable)
index 0000000..1b08fdf
--- /dev/null
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+# Use same path for run.base.sh
+RUNSH_DIR=$(dirname $0)
+RUN_BASE_SH=${RUNSH_DIR}/run.base.sh
+
+function usage {
+    echo -e "You must select one of the 3 supported network virtualization technologies:\n\tovsdb | opendove | vtn"
+    echo "Usage: $0 -virt {ovsdb | opendove | vtn | affinity} [advanced options]"
+    echo "Advanced options: $($RUN_BASE_SH -help | sed "s;Usage: $RUN_BASE_SH ;;")"
+    exit 1
+}
+
+virtIndex=0
+while true ; do
+    (( i += 1 ))
+    case "${@:$i:1}" in
+        -virt) virtIndex=$i ;;
+        "") break ;;
+    esac
+done
+
+# Virtualization edition select
+if [ ${virtIndex} -eq 0 ]; then
+    usage
+fi
+
+virt=${@:$virtIndex+1:1}
+if [ "${virt}" == "" ]; then
+    usage
+else
+    if [ "${virt}" == "ovsdb" ]; then
+        ODL_VIRT_FILTER="opendove|vtn"
+    elif [ "${virt}" == "opendove" ]; then
+        ODL_VIRT_FILTER="ovsdb|vtn"
+    elif [ "${virt}" == "vtn" ]; then
+        ODL_VIRT_FILTER="affinity|opendove|ovsdb.ovsdb.neutron|controller.(arphandler|samples)"
+    elif [ "${virt}" == "affinity" ]; then
+        ODL_VIRT_FILTER="vtn|opendove|controller.samples"
+    else
+        usage
+    fi
+fi
+
+$RUN_BASE_SH -bundlefilter "org.opendaylight.(${ODL_VIRT_FILTER})" "${@:1:$virtIndex-1}" "${@:virtIndex+2}"
index 2716c442ef258038e6180e98e09dafd3a386b857..b7f51c3168725ab5a8aad34c18fe810c424e8827 100644 (file)
@@ -9,7 +9,7 @@
   </parent>
 
   <artifactId>ovsdb_neutron</artifactId>
-  <version>0.6.0-SNAPSHOT</version>
+  <version>0.7.0-SNAPSHOT</version>
   <packaging>bundle</packaging>
 
   <properties>
           </instructions>
         </configuration>
       </plugin>
+
     </plugins>
   </build>
 
index 813dc6a2f93f10ca956ed91a546511974a36e757..c814e0a715384effe7ef2bc664d9a375df231f42 100644 (file)
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  *
- * Authors : Madhu Venugopal, Brent Salisbury
+ * Authors : Madhu Venugopal, Brent Salisbury, Dave Tucker
  */
 
 package org.opendaylight.ovsdb.neutron;
@@ -17,11 +17,17 @@ import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkAware;
 import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD;
 import org.opendaylight.controller.networkconfig.neutron.INeutronPortAware;
 import org.opendaylight.controller.networkconfig.neutron.INeutronPortCRUD;
+import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityGroupAware;
+import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityGroupCRUD;
+import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityRuleAware;
+import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityRuleCRUD;
 import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetAware;
 import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetCRUD;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
 import org.opendaylight.controller.switchmanager.IInventoryListener;
+import org.opendaylight.ovsdb.neutron.provider.IProviderNetworkManager;
+import org.opendaylight.ovsdb.neutron.provider.ProviderNetworkManager;
 import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
 import org.opendaylight.ovsdb.plugin.OVSDBConfigService;
 import org.opendaylight.ovsdb.plugin.OVSDBInventoryListener;
@@ -58,11 +64,16 @@ public class Activator extends ComponentActivatorAbstractBase {
      */
     @Override
     public Object[] getImplementations() {
-        Object[] res = {NetworkHandler.class,
+        Object[] res = {AdminConfigManager.class,
+                        InternalNetworkManager.class,
+                        TenantNetworkManager.class,
+                        NetworkHandler.class,
                         SubnetHandler.class,
                         PortHandler.class,
                         SouthboundHandler.class,
-                        MDSALConsumer.class};
+                        PortSecurityHandler.class,
+                        MDSALConsumer.class,
+                        ProviderNetworkManager.class};
         return res;
     }
 
@@ -82,8 +93,24 @@ public class Activator extends ComponentActivatorAbstractBase {
     @Override
     public void configureInstance(Component c, Object imp,
                                   String containerName) {
+        if (imp.equals(AdminConfigManager.class)) {
+            c.setInterface(IAdminConfigManager.class.getName(), null);
+        }
+
+        if (imp.equals(InternalNetworkManager.class)) {
+            c.setInterface(IInternalNetworkManager.class.getName(), null);
+            c.add(createServiceDependency().setService(IAdminConfigManager.class).setRequired(true));
+            c.add(createServiceDependency().setService(IProviderNetworkManager.class));
+        }
+
+        if (imp.equals(TenantNetworkManager.class)) {
+            c.setInterface(ITenantNetworkManager.class.getName(), null);
+            c.add(createServiceDependency().setService(IProviderNetworkManager.class));
+        }
+
         if (imp.equals(NetworkHandler.class)) {
             c.setInterface(INeutronNetworkAware.class.getName(), null);
+            c.add(createServiceDependency().setService(ITenantNetworkManager.class).setRequired(true));
         }
 
         if (imp.equals(SubnetHandler.class)) {
@@ -96,11 +123,35 @@ public class Activator extends ComponentActivatorAbstractBase {
 
         if (imp.equals(SouthboundHandler.class)) {
             c.setInterface(new String[] {OVSDBInventoryListener.class.getName(), IInventoryListener.class.getName()}, null);
+            c.add(createServiceDependency().setService(IAdminConfigManager.class).setRequired(true));
+            c.add(createServiceDependency().setService(IInternalNetworkManager.class).setRequired(true));
+            c.add(createServiceDependency().setService(ITenantNetworkManager.class).setRequired(true));
+            c.add(createServiceDependency().setService(IProviderNetworkManager.class).setRequired(true));
         }
 
         if (imp.equals(MDSALConsumer.class)) {
             c.setInterface(IMDSALConsumer.class.getName(), null);
         }
+
+        if (imp.equals(ProviderNetworkManager.class)) {
+            c.setInterface(IProviderNetworkManager.class.getName(), null);
+            c.add(createServiceDependency()
+                    .setService(IAdminConfigManager.class)
+                    .setRequired(true));
+            c.add(createServiceDependency()
+                    .setService(IInternalNetworkManager.class)
+                    .setRequired(true));
+            c.add(createServiceDependency()
+                    .setService(ITenantNetworkManager.class)
+                    .setRequired(true));
+        }
+        if (imp.equals(PortSecurityHandler.class)) {
+            c.setInterface(INeutronSecurityRuleAware.class.getName(), null);
+            c.setInterface(INeutronSecurityGroupAware.class.getName(), null);
+        }
+
+        //ToDo: DT: We don't need these dependencies for every implementation...
+        //ToDo: DT: Callbacks are only required when behaviour is more complex than simple set/unset operation
         c.add(createServiceDependency().
                 setService(OVSDBConfigService.class).
                 setCallbacks("setOVSDBConfigService", "unsetOVSDBConfigService").
@@ -111,7 +162,6 @@ public class Activator extends ComponentActivatorAbstractBase {
                 setCallbacks("setConnectionService", "unsetConnectionService").
                 setRequired(true));
 
-        // Create service dependencies.
         c.add(createServiceDependency().
               setService(IContainerManager.class).
               setCallbacks("setContainerManager", "unsetContainerManager").
@@ -139,5 +189,13 @@ public class Activator extends ComponentActivatorAbstractBase {
                 setService(INeutronPortCRUD.class).
                 setCallbacks("setNeutronPortCRUD", "unsetNeutronPortCRUD").
                 setRequired(true));
+        c.add(createServiceDependency().
+            setService(INeutronSecurityRuleCRUD.class).
+            setCallbacks("setNeutronSecurityRuleCRUD", "unsetNeutronSecurityRuleCRUD").
+            setRequired(true));
+        c.add(createServiceDependency().
+            setService(INeutronSecurityGroupCRUD.class).
+            setCallbacks("setNeutronSecurityGroupCRUD", "unsetNeutronSecurityGroupCRUD").
+            setRequired(true));
     }
 }
index a251d675b165c3b22fe3dd7b031642e825b7bcfb..9df091ed9dac28cc8deafebfb9e4560b8248bed6 100644 (file)
@@ -5,11 +5,13 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  *
- * Authors : Madhu Venugopal, Brent Salisbury
+ * Authors : Madhu Venugopal, Brent Salisbury, Sam Hague
  */
 package org.opendaylight.ovsdb.neutron;
 
 import java.net.InetAddress;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Map;
 
 import org.opendaylight.controller.sal.core.Node;
@@ -20,50 +22,52 @@ import org.opendaylight.ovsdb.plugin.OVSDBConfigService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class AdminConfigManager {
+public class AdminConfigManager implements IAdminConfigManager{
     static final Logger logger = LoggerFactory.getLogger(AdminConfigManager.class);
 
     private String integrationBridgeName;
-    private String tunnelBridgeName;
+    private String networkBridgeName;
     private String externalBridgeName;
     private String tunnelEndpointConfigName;
     private String patchToIntegration;
-    private String patchToTunnel;
+    private String patchToNetwork;
+    private String providerMappingsConfigName;
+    private String providerMappings;
 
     // Refer to /etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini
     private static String DEFAULT_TUNNEL_ENDPOINT_CONFIG_STRING = "local_ip";
     private static String DEFAULT_INTEGRATION_BRIDGENAME = "br-int";
-    private static String DEFAULT_TUNNEL_BRIDGENAME = "br-tun";
+    private static String DEFAULT_NETWORK_BRIDGENAME = "br-net";
     private static String DEFAULT_EXTERNAL_BRIDGENAME = "br-ex";
     private static String DEFAULT_PATCH_TO_INTEGRATION = "patch-int";
-    private static String DEFAULT_PATCH_TO_TUNNEL = "patch-tun";
+    private static String DEFAULT_PATCH_TO_NETWORK = "patch-net";
     private static String CONFIG_TUNNEL_ENDPOINT_CONFIG = "tunnel_endpoint_config_string";
     private static String CONFIG_INTEGRATION_BRIDGENAME = "integration_bridge";
-    private static String CONFIG_TUNNEL_BRIDGENAME = "tunnel_bridge";
+    private static String CONFIG_NETWORK_BRIDGENAME = "network_bridge";
     private static String CONFIG_EXTERNAL_BRIDGENAME = "external_bridge";
     private static String CONFIG_PATCH_TO_INTEGRATION = "patch-int";
-    private static String CONFIG_PATCH_TO_TUNNEL = "patch-tun";
+    private static String CONFIG_PATCH_TO_NETWORK = "patch-net";
+    private static String DEFAULT_PROVIDER_MAPPINGS_CONFIG_STRING = "provider_mappings";
+    private static String CONFIG_PROVIDER_MAPPINGS_CONFIG = "provider_mappings_config_string";
+    private static String CONFIG_PROVIDER_MAPPINGS = "provider_mappings";
 
-    private static AdminConfigManager adminConfiguration = new AdminConfigManager();
-
-    private AdminConfigManager() {
+    public AdminConfigManager() {
         tunnelEndpointConfigName = System.getProperty(CONFIG_TUNNEL_ENDPOINT_CONFIG);
         integrationBridgeName = System.getProperty(CONFIG_INTEGRATION_BRIDGENAME);
-        tunnelBridgeName = System.getProperty(CONFIG_TUNNEL_BRIDGENAME);
+        networkBridgeName = System.getProperty(CONFIG_NETWORK_BRIDGENAME);
         externalBridgeName = System.getProperty(CONFIG_EXTERNAL_BRIDGENAME);
         patchToIntegration = System.getProperty(CONFIG_PATCH_TO_INTEGRATION);
-        patchToTunnel = System.getProperty(CONFIG_PATCH_TO_TUNNEL);
+        patchToNetwork = System.getProperty(CONFIG_PATCH_TO_NETWORK);
+        providerMappingsConfigName = System.getProperty(CONFIG_PROVIDER_MAPPINGS_CONFIG);
+        providerMappings = System.getProperty(CONFIG_PROVIDER_MAPPINGS);
 
         if (tunnelEndpointConfigName == null) tunnelEndpointConfigName = DEFAULT_TUNNEL_ENDPOINT_CONFIG_STRING;
         if (integrationBridgeName == null) integrationBridgeName = DEFAULT_INTEGRATION_BRIDGENAME;
-        if (tunnelBridgeName == null) tunnelBridgeName = DEFAULT_TUNNEL_BRIDGENAME;
+        if (networkBridgeName == null) networkBridgeName = DEFAULT_NETWORK_BRIDGENAME;
         if (externalBridgeName == null) externalBridgeName = DEFAULT_EXTERNAL_BRIDGENAME;
         if (patchToIntegration == null) patchToIntegration = DEFAULT_PATCH_TO_INTEGRATION;
-        if (patchToTunnel == null) patchToTunnel = DEFAULT_PATCH_TO_TUNNEL;
-    }
-
-    public static AdminConfigManager getManager() {
-        return adminConfiguration;
+        if (patchToNetwork == null) patchToNetwork  = DEFAULT_PATCH_TO_NETWORK;
+        if (providerMappingsConfigName == null) providerMappingsConfigName = DEFAULT_PROVIDER_MAPPINGS_CONFIG_STRING;
     }
 
     public String getIntegrationBridgeName() {
@@ -74,12 +78,10 @@ public class AdminConfigManager {
         this.integrationBridgeName = integrationBridgeName;
     }
 
-    public String getTunnelBridgeName() {
-        return tunnelBridgeName;
-    }
+    public String getNetworkBridgeName() { return networkBridgeName; }
 
-    public void setTunnelBridgeName(String tunnelBridgeName) {
-        this.tunnelBridgeName = tunnelBridgeName;
+    public void setNetworkBridgeName(String networkBridgeName) {
+        this.networkBridgeName = networkBridgeName;
     }
 
     public String getExternalBridgeName() {
@@ -98,12 +100,10 @@ public class AdminConfigManager {
         this.patchToIntegration = patchToIntegration;
     }
 
-    public String getPatchToTunnel() {
-        return patchToTunnel;
-    }
+    public String getPatchToNetwork() { return patchToNetwork; }
 
-    public void setPatchToTunnel(String patchToTunnel) {
-        this.patchToTunnel = patchToTunnel;
+    public void setPatchToNetwork(String patchToNetwork) {
+        this.patchToNetwork = patchToNetwork;
     }
 
     public InetAddress getTunnelEndPoint(Node node) {
@@ -145,6 +145,119 @@ public class AdminConfigManager {
         return address;
     }
 
+
+    /*
+     * Return the physical interface mapped to the given neutron physical network.
+     * Provider mappings will be of the following format:
+     * provider_mappings=physnet1:eth1[,physnet2:eth2]
+     */
+      public String getPhysicalInterfaceName (Node node, String physicalNetwork) {
+          String phyIf = null;
+
+          OVSDBConfigService ovsdbConfig = (OVSDBConfigService) ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
+          try {
+            Map<String, Table<?>> ovsTable = ovsdbConfig.getRows(node, Open_vSwitch.NAME.getName());
+
+            if (ovsTable == null) {
+                logger.error("Open_vSwitch table is null for Node {} ", node);
+                return null;
+            }
+
+            // Loop through all the Open_vSwitch rows looking for the first occurrence of other_config.
+            // The specification does not restrict the number of rows so we choose the first we find.
+            for (Table<?> row : ovsTable.values()) {
+                String providerMaps;
+                Open_vSwitch ovsRow = (Open_vSwitch) row;
+                Map<String, String> configs = ovsRow.getOther_config();
+
+                if (configs == null) {
+                    logger.debug("Open_vSwitch table is null for Node {} ", node);
+                    continue;
+                }
+
+                providerMaps = configs.get(providerMappingsConfigName);
+                if (providerMaps == null) {
+                    providerMaps = providerMappings;
+                }
+
+                if (providerMaps != null) {
+                    for (String map : providerMaps.split(",")) {
+                        String[] pair = map.split(":");
+                        if (pair[0].equals(physicalNetwork)) {
+                            phyIf = pair[1];
+                            break;
+                        }
+                    }
+                }
+
+                if (phyIf != null) {
+                    break;
+                }
+            }
+        } catch (Exception e) {
+            logger.error("Unable to find physical interface for Node: {}, Network {}",
+                    node, physicalNetwork, e);
+        }
+
+        if (phyIf == null) {
+            logger.error("Physical interface not found for Node: {}, Network {}",
+                    node, physicalNetwork);
+        }
+
+        return phyIf;
+    }
+
+    /* Return all physical interfaces configure in bridge mapping
+     * Bridge mappings will be of the following format:
+     * bridge_mappings=physnet1:eth1,physnet2:eth2
+     * Method will return list = {eth1, eth2}
+     */
+    public List<String> getAllPhysicalInterfaceNames(Node node) {
+        List<String> phyIfName = new ArrayList<String>();
+
+        try {
+            OVSDBConfigService ovsdbConfig = (OVSDBConfigService) ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
+            Map<String, Table<?>> ovsTable = ovsdbConfig.getRows(node, Open_vSwitch.NAME.getName());
+
+            if (ovsTable == null) {
+                logger.error("Open_vSwitch table is null for Node {} ", node);
+                return null;
+            }
+
+            // While there is only one entry in the HashMap, we can't access it by index...
+            for (Table<?> row : ovsTable.values()) {
+                String bridgeMaps;
+                Open_vSwitch ovsRow = (Open_vSwitch) row;
+                Map<String, String> configs = ovsRow.getOther_config();
+
+                if (configs == null) {
+                    logger.debug("Open_vSwitch table is null for Node {} ", node);
+                    continue;
+                }
+
+                bridgeMaps = configs.get(providerMappingsConfigName);
+                if (bridgeMaps == null) {
+                    bridgeMaps = providerMappings;
+                }
+
+                if (bridgeMaps != null) {
+                    for (String map : bridgeMaps.split(",")) {
+                        String[] pair = map.split(":");
+                        phyIfName.add(pair[1]);
+                    }
+                }
+            }
+        } catch (Exception e) {
+            logger.error("Unable to find physical interface for Node: {}",
+                    node, e);
+        }
+
+        logger.debug("Physical interface for Node: {}, If: {}",
+                node, phyIfName);
+
+        return phyIfName;
+    }
+
     public boolean isInterested (String tableName) {
         return tableName.equalsIgnoreCase(Open_vSwitch.NAME.getName());
     }
index 51d3e20db3a40987bba7ad3bc374ea9b503a3402..9bee8fa1570515550c9e18e0d8f14ef3376347fd 100644 (file)
@@ -16,6 +16,8 @@ import org.opendaylight.controller.containermanager.IContainerManager;
 import org.opendaylight.controller.forwardingrulesmanager.IForwardingRulesManager;
 import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD;
 import org.opendaylight.controller.networkconfig.neutron.INeutronPortCRUD;
+import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityGroupCRUD;
+import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityRuleCRUD;
 import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetCRUD;
 import org.opendaylight.controller.sal.utils.Status;
 import org.opendaylight.controller.sal.utils.StatusCode;
@@ -373,4 +375,14 @@ public class BaseHandler {
     public void setNeutronNetworkCRUD(INeutronNetworkCRUD s) {
         this.neutronNetworkCache = s;
     }
+
+    protected INeutronSecurityRuleCRUD neutronSecurityRuleCache;
+    public void setNeutronSecurityRuleCache(INeutronSecurityRuleCRUD s) {
+        this.neutronSecurityRuleCache = s;
+    }
+
+    protected INeutronSecurityGroupCRUD neutronSecurityGroupCache;
+    public void setNeutronSecurityGroupCache(INeutronSecurityGroupCRUD s) {
+        this.neutronSecurityGroupCache = s;
+    }
 }
diff --git a/neutron/src/main/java/org/opendaylight/ovsdb/neutron/IAdminConfigManager.java b/neutron/src/main/java/org/opendaylight/ovsdb/neutron/IAdminConfigManager.java
new file mode 100644 (file)
index 0000000..8d3cab2
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ *  Authors : Dave Tucker
+ */
+
+package org.opendaylight.ovsdb.neutron;
+
+import org.opendaylight.controller.sal.core.Node;
+
+import java.net.InetAddress;
+import java.util.List;
+
+public interface IAdminConfigManager {
+    public String getIntegrationBridgeName();
+    public void setIntegrationBridgeName(String integrationBridgeName);
+    public String getNetworkBridgeName();
+    public void setNetworkBridgeName(String networkBridgeName);
+    public String getPatchToNetwork();
+    public void setPatchToNetwork(String patchToNetwork);
+    public String getExternalBridgeName();
+    public void setExternalBridgeName (String externalBridgeName);
+    public String getPatchToIntegration();
+    public void setPatchToIntegration(String patchToIntegration);
+    public String getPhysicalInterfaceName (Node node, String physicalNetwork);
+    public List<String> getAllPhysicalInterfaceNames(Node node);
+    public InetAddress getTunnelEndPoint(Node node);
+    public boolean isInterested (String tableName);
+}
\ No newline at end of file
diff --git a/neutron/src/main/java/org/opendaylight/ovsdb/neutron/IInternalNetworkManager.java b/neutron/src/main/java/org/opendaylight/ovsdb/neutron/IInternalNetworkManager.java
new file mode 100644 (file)
index 0000000..a701b93
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ *  Authors : Dave Tucker
+ */
+
+package org.opendaylight.ovsdb.neutron;
+
+import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork;
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.ovsdb.lib.table.Bridge;
+
+public interface IInternalNetworkManager {
+    public String getInternalBridgeUUID (Node node, String bridgeName);
+    public boolean isInternalNetworkNeutronReady(Node node);
+    public boolean isInternalNetworkOverlayReady(Node node);
+    public boolean isInternalNetworkTunnelReady (Node node);
+    public boolean isInternalNetworkVlanReady (Node node, NeutronNetwork network);
+    public boolean isPortOnBridge (Node node, Bridge bridge, String portName);
+    public void createIntegrationBridge (Node node) throws Exception;
+    public boolean createNetNetwork (Node node, NeutronNetwork network) throws Exception;
+    public boolean checkAndCreateNetwork (Node node, NeutronNetwork network);
+    public void prepareInternalNetwork(Node node);
+}
\ No newline at end of file
diff --git a/neutron/src/main/java/org/opendaylight/ovsdb/neutron/ITenantNetworkManager.java b/neutron/src/main/java/org/opendaylight/ovsdb/neutron/ITenantNetworkManager.java
new file mode 100644 (file)
index 0000000..8a1f806
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ *  Authors : Dave Tucker
+ */
+
+package org.opendaylight.ovsdb.neutron;
+
+import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork;
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.ovsdb.lib.table.Interface;
+
+public interface ITenantNetworkManager {
+    public static final String EXTERNAL_ID_VM_ID = "vm-id";
+    public static final String EXTERNAL_ID_INTERFACE_ID = "iface-id";
+    public static final String EXTERNAL_ID_VM_MAC = "attached-mac";
+    public int getInternalVlan(Node node, String networkId);
+    public void reclaimTenantNetworkInternalVlan(Node node, String portUUID, NeutronNetwork network);
+    public void networkCreated (String networkId);
+    public int networkCreated (Node node, String networkId);
+    public boolean isTenantNetworkPresentInNode(Node node, String segmentationId);
+    public String getNetworkIdForSegmentationId (String segmentationId);
+    public NeutronNetwork getTenantNetworkForInterface (Interface intf);
+    public void programTenantNetworkInternalVlan(Node node, String portUUID, NeutronNetwork network);
+    public void networkDeleted(String id);
+}
\ No newline at end of file
index 53dff68c75dca192d686587e434104a6b8de7d60..dbfd0da99024180ca099e05818a60f06b73aa22f 100644 (file)
@@ -5,12 +5,13 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  *
- * Authors : Madhu Venugopal, Brent Salisbury
+ * Authors : Madhu Venugopal, Brent Salisbury, Sam Hague
  */
 package org.opendaylight.ovsdb.neutron;
 
 import java.util.Map;
 
+import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork;
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.utils.ServiceHelper;
 import org.opendaylight.controller.sal.utils.Status;
@@ -22,7 +23,7 @@ import org.opendaylight.ovsdb.lib.table.Bridge;
 import org.opendaylight.ovsdb.lib.table.Interface;
 import org.opendaylight.ovsdb.lib.table.Port;
 import org.opendaylight.ovsdb.lib.table.Table;
-import org.opendaylight.ovsdb.neutron.provider.ProviderNetworkManager;
+import org.opendaylight.ovsdb.neutron.provider.IProviderNetworkManager;
 import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
 import org.opendaylight.ovsdb.plugin.OVSDBConfigService;
 import org.opendaylight.ovsdb.plugin.StatusWithUuid;
@@ -30,24 +31,23 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * OpenStack Neutron with the OpenVswitch data plan relies on a typical OVS bridge configurations that
+ * OpenStack Neutron with the OpenvSwitch data plan relies on a typical OVS bridge configurations that
  * consists of br-int (Integration Bridge), br-tun (Tunnel bridge), br-ex (External bridge).
  *
  * In DevStack like setups, the br-tun is not automatically created on the controller nodes.
- * Hence this class attempts to bring all the nodes to be elibible for OpenStack operations.
+ * Hence this class attempts to bring all the nodes to be eligible for OpenStack operations.
  *
  */
-public class InternalNetworkManager {
+public class InternalNetworkManager implements IInternalNetworkManager {
     static final Logger logger = LoggerFactory.getLogger(InternalNetworkManager.class);
     private static final int LLDP_PRIORITY = 1000;
     private static final int NORMAL_PRIORITY = 0;
 
-    private static InternalNetworkManager internalNetwork = new InternalNetworkManager();
-    private InternalNetworkManager() {
-    }
+    // The implementation for each of these services is resolved by the OSGi Service Manager
+    private volatile IAdminConfigManager adminConfigManager;
+    private volatile IProviderNetworkManager providerNetworkManager;
 
-    public static InternalNetworkManager getManager() {
-        return internalNetwork;
+    public InternalNetworkManager() {
     }
 
     public String getInternalBridgeUUID (Node node, String bridgeName) {
@@ -65,8 +65,26 @@ public class InternalNetworkManager {
         return null;
     }
 
+    public Bridge getInternalBridge (Node node, String bridgeName) {
+        try {
+            OVSDBConfigService ovsdbTable = (OVSDBConfigService) ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
+            Map<String, Table<?>> bridgeTable = ovsdbTable.getRows(node, Bridge.NAME.getName());
+            if (bridgeTable != null) {
+                for (String key : bridgeTable.keySet()) {
+                    Bridge bridge = (Bridge) bridgeTable.get(key);
+                    if (bridge.getName().equals(bridgeName)) {
+                        return bridge;
+                    }
+                }
+            }
+        } catch (Exception e) {
+            logger.error("Error getting Bridge Identifier for {} / {}", node, bridgeName, e);
+        }
+        return null;
+    }
+
     public boolean isInternalNetworkNeutronReady(Node node) {
-        if (this.getInternalBridgeUUID(node, AdminConfigManager.getManager().getIntegrationBridgeName()) != null) {
+        if (this.getInternalBridgeUUID(node, adminConfigManager.getIntegrationBridgeName()) != null) {
             return true;
         } else {
             return false;
@@ -77,106 +95,326 @@ public class InternalNetworkManager {
         if (!this.isInternalNetworkNeutronReady(node)) {
             return false;
         }
-        if (this.getInternalBridgeUUID(node, AdminConfigManager.getManager().getTunnelBridgeName()) != null) {
+        if (this.getInternalBridgeUUID(node, adminConfigManager.getNetworkBridgeName()) != null) {
             return true;
         } else {
             return false;
         }
     }
 
+    public boolean isPortOnBridge (Node node, Bridge bridge, String portName) {
+        OVSDBConfigService ovsdbTable = (OVSDBConfigService) ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
+
+        for (UUID portsUUID : bridge.getPorts()) {
+            try {
+                Port port = (Port) ovsdbTable.getRow(node, Port.NAME.getName(), portsUUID.toString());
+                if ((port != null) && port.getName().equalsIgnoreCase(portName)) {
+                    return true;
+                }
+            } catch (Exception e) {
+                logger.error("Error getting port {} for bridge domain {}/{}", portsUUID, node, bridge.getName(), e);
+            }
+        }
+
+        return false;
+    }
+
+    public boolean isNetworkPatchCreated (Node node, Bridge intBridge, Bridge netBridge) {
+        boolean isPatchCreated = false;
+
+        String portName = adminConfigManager.getPatchToNetwork();
+        if (isPortOnBridge(node, intBridge, portName)) {
+            portName = adminConfigManager.getPatchToIntegration();
+            if (isPortOnBridge(node, netBridge, portName)) {
+                isPatchCreated = true;
+            }
+        }
+
+        return isPatchCreated;
+    }
+
+    /* Determine if internal network is ready for tunnel network types.
+     * - OF 1.0 requires br-int, br-net and a patch connecting them.
+     * - OF 1.3 requires br-int.
+     */
+    public boolean isInternalNetworkTunnelReady (Node node) {
+        /* Is br-int created? */
+        Bridge intBridge = this.getInternalBridge(node, adminConfigManager.getIntegrationBridgeName());
+        if (intBridge == null) {
+            return false;
+        }
+
+        if (providerNetworkManager == null) {
+            logger.error("Provider Network Manager is not available");
+            return false;
+        }
+        if (providerNetworkManager.getProvider().hasPerTenantTunneling()) {
+            /* Is br-net created? */
+            Bridge netBridge = this.getInternalBridge(node, adminConfigManager.getNetworkBridgeName());
+            if (netBridge == null) {
+                return false;
+            }
+
+            if (!isNetworkPatchCreated(node, intBridge, netBridge)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /* Determine if internal network is ready for vlan network types.
+     * - OF 1.0 requires br-int, br-net, a patch connecting them and
+     * physical device added to br-net.
+     * - OF 1.3 requires br-int and physical device added to br-int.
+     */
+    public boolean isInternalNetworkVlanReady (Node node, NeutronNetwork network) {
+        /* is br-int created */
+        Bridge intBridge = this.getInternalBridge(node, adminConfigManager.getIntegrationBridgeName());
+        if (intBridge == null) {
+            logger.trace("shague isInternalNetworkVlanReady: node: {}, br-int missing", node);
+            return false;
+        }
+
+        if (providerNetworkManager == null) {
+            logger.error("Provider Network Manager is not available");
+            return false;
+        }
+        if (providerNetworkManager.getProvider().hasPerTenantTunneling()) {
+            /* is br-net created? */
+            Bridge netBridge = this.getInternalBridge(node, adminConfigManager.getNetworkBridgeName());
+
+            if (netBridge == null) {
+                logger.trace("shague isInternalNetworkVlanReady: node: {}, br-net missing", node);
+                return false;
+            }
+
+            if (!isNetworkPatchCreated(node, intBridge, netBridge)) {
+                logger.trace("shague isInternalNetworkVlanReady: node: {}, patch missing", node);
+                return false;
+            }
+
+            /* Check if physical device is added to br-net. */
+            String phyNetName = adminConfigManager.getPhysicalInterfaceName(node, network.getProviderPhysicalNetwork());
+            if (isPortOnBridge(node, netBridge, phyNetName)) {
+                return true;
+            }
+        } else {
+            /* Check if physical device is added to br-int. */
+            String phyNetName = adminConfigManager.getPhysicalInterfaceName(node, network.getProviderPhysicalNetwork());
+            if (isPortOnBridge(node, intBridge, phyNetName)) {
+                return true;
+            }
+        }
+
+        logger.trace("shague isInternalNetworkVlanReady: node: {}, eth missing", node);
+        return false;
+    }
+
+    /*
+     * Create the integration bridge.
+     *
+       Bridge br-int
+            Port br-int
+                Interface br-int
+                    type: internal
+     */
+    public void createIntegrationBridge (Node node) throws Exception {
+        String brInt = adminConfigManager.getIntegrationBridgeName();
+
+        Status status = this.addInternalBridge(node, brInt, null, null);
+        if (!status.isSuccess()) {
+            logger.debug("Integration Bridge Creation Status: {}", status);
+        }
+    }
+
     /*
-     * Lets create these if not already present :
+     * Create complete network for all network types and OpenFlow versions.
      *
+       OF 1.0 vlan:
        Bridge br-int
-            Port patch-tun
-                Interface patch-tun
+            Port patch-net
+                Interface patch-net
                     type: patch
                     options: {peer=patch-int}
             Port br-int
                 Interface br-int
                     type: internal
-      Bridge br-tun
+       Bridge br-net
+            Port "eth1"
+                Interface "eth1"
             Port patch-int
                 Interface patch-int
                     type: patch
-                    options: {peer=patch-tun}
-            Port br-tun
-                Interface br-tun
+                    options: {peer=patch-net}
+            Port br-net
+                Interface br-net
                     type: internal
-     */
-    public void createInternalNetworkForOverlay(Node node) throws Exception {
-        String brTun = AdminConfigManager.getManager().getTunnelBridgeName();
-        String brInt = AdminConfigManager.getManager().getIntegrationBridgeName();
-        String patchInt = AdminConfigManager.getManager().getPatchToIntegration();
-        String patchTun = AdminConfigManager.getManager().getPatchToTunnel();
 
-        Status status = this.addInternalBridge(node, brInt, patchTun, patchInt);
-        if (!status.isSuccess()) logger.debug("Integration Bridge Creation Status : "+status.toString());
-        if (ProviderNetworkManager.getManager().hasPerTenantTunneling()) {
-            status = this.addInternalBridge(node, brTun, patchInt, patchTun);
-            if (!status.isSuccess()) logger.debug("Tunnel Bridge Creation Status : "+status.toString());
-        }
-    }
+       OF 1.0 tunnel:
+       Bridge br-int
+            Port patch-net
+                Interface patch-net
+                    type: patch
+                    options: {peer=patch-int}
+            Port br-int
+                Interface br-int
+                    type: internal
+       Bridge "br-net"
+            Port patch-int
+                Interface patch-int
+                    type: patch
+                    options: {peer=patch-net}
+            Port br-net
+                Interface br-net
+                    type: internal
 
-    /*
-     * Lets create these if not already present :
-     *
+       OF 1.3 vlan:
+       Bridge br-int
+            Port "eth1"
+                Interface "eth1"
+            Port br-int
+                Interface br-int
+                    type: internal
+
+       OF 1.3 tunnel:
        Bridge br-int
             Port br-int
                 Interface br-int
                     type: internal
      */
-    public void createInternalNetworkForNeutron(Node node) throws Exception {
-        String brInt = AdminConfigManager.getManager().getIntegrationBridgeName();
+    public boolean createNetNetwork (Node node, NeutronNetwork network) throws Exception {
+        Status status;
 
-        Status status = this.addInternalBridge(node, brInt, null, null);
-        if (!status.isSuccess()) logger.debug("Integration Bridge Creation Status : "+status.toString());
-    }
+        logger.debug("createNetNetwork: node: {}, network type: {}", node, network.getProviderNetworkType());
 
-    private Status addInternalBridge (Node node, String bridgeName, String localPathName, String remotePatchName) throws Exception {
-        OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
+        if (providerNetworkManager == null) {
+            logger.error("Provider Network Manager is not available");
+            return false;
+        }
+        if (providerNetworkManager.getProvider().hasPerTenantTunneling()) { /* indicates OF 1.0 */
+            String brInt = adminConfigManager.getIntegrationBridgeName();
+            String brNet = adminConfigManager.getNetworkBridgeName();
+            String patchNet = adminConfigManager.getPatchToNetwork();
+            String patchInt = adminConfigManager.getPatchToIntegration();
 
-        String bridgeUUID = this.getInternalBridgeUUID(node, bridgeName);
-        Bridge bridge = new Bridge();
-        OvsDBSet<String> failMode = new OvsDBSet<String>();
-        failMode.add("secure");
-        bridge.setFail_mode(failMode);
+            status = this.addInternalBridge(node, brInt, patchNet, patchInt);
+            if (!status.isSuccess()) {
+                logger.debug("{} Bridge Creation Status: {}", brInt, status);
+                return false;
+            }
+            status = this.addInternalBridge(node, brNet, patchInt, patchNet);
+            if (!status.isSuccess()) {
+                logger.debug("{} Bridge Creation Status: {}", brNet, status);
+                return false;
+            }
 
-        OvsDBSet<String> protocols = new OvsDBSet<String>();
-        if (!ProviderNetworkManager.getManager().hasPerTenantTunneling()) {
-            protocols.add("OpenFlow13");
+            /* For vlan network types add physical port to br-net. */
+            if (network.getProviderNetworkType().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VLAN)) {
+                String phyNetName = adminConfigManager.getPhysicalInterfaceName(node, network.getProviderPhysicalNetwork());
+                status = addPortToBridge(node, brNet, phyNetName);
+                if (!status.isSuccess()) {
+                    logger.debug("Add Port {} to Bridge {} Status: {}", phyNetName, brNet, status);
+                    return false;
+                }
+            }
         } else {
-            protocols.add("OpenFlow10");
+            String brInt = adminConfigManager.getIntegrationBridgeName();
+            status = this.addInternalBridge(node, brInt, null, null);
+            if (!status.isSuccess()) {
+                logger.debug("{} Bridge Creation Status: {}", brInt, status);
+                return false;
+            }
+
+            /* For vlan network types add physical port to br-int. */
+            if (network.getProviderNetworkType().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VLAN)) {
+                String phyNetName = adminConfigManager.getPhysicalInterfaceName(node, network.getProviderPhysicalNetwork());
+                status = addPortToBridge(node, brInt, phyNetName);
+                if (!status.isSuccess()) {
+                    logger.debug("Add Port {} to Bridge {} Status: {}", phyNetName, brInt, status);
+                    return false;
+                }
+            }
         }
-        bridge.setProtocols(protocols);
 
+        logger.debug("createNetNetwork: node: {}, status: success", node);
+        return true;
+    }
+
+    private Status addPortToBridge (Node node, String bridgeName, String portName) throws Exception {
+        logger.debug("addPortToBridge: Adding port: {} to Bridge {}, Node {}", portName, bridgeName, node);
+        OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
+
+        String bridgeUUID = this.getInternalBridgeUUID(node, bridgeName);
         if (bridgeUUID == null) {
-            bridge.setName(bridgeName);
+            logger.error("addPortToBridge: Could not find Bridge {} in Node {}", bridgeName, node);
+            return new Status(StatusCode.NOTFOUND, "Could not find "+bridgeName+" in "+node);
+        }
 
-            StatusWithUuid statusWithUuid = ovsdbTable.insertRow(node, Bridge.NAME.getName(), null, bridge);
-            if (!statusWithUuid.isSuccess()) return statusWithUuid;
-            bridgeUUID = statusWithUuid.getUuid().toString();
-            Port port = new Port();
-            port.setName(bridgeName);
-            Status status = ovsdbTable.insertRow(node, Port.NAME.getName(), bridgeUUID, port);
-            logger.debug("addInternalBridge : Inserting Bridge {} with protocols {} and status {}", bridgeUUID, protocols, status);
+        /* Check if the port already exists. */
+        Bridge bridge = (Bridge)ovsdbTable.getRow(node, Bridge.NAME.getName(), bridgeUUID);
+        if (bridge != null) {
+            if (isPortOnBridge(node, bridge, portName)) {
+                logger.debug("addPortToBridge: Port {} already in Bridge {}, Node {}", portName, bridgeName, node);
+                return new Status(StatusCode.SUCCESS);
+            }
         } else {
-            Status status = ovsdbTable.updateRow(node, Bridge.NAME.getName(), null, bridgeUUID, bridge);
-            logger.debug("addInternalBridge : Updating Bridge {} with protocols {} and status {}", bridgeUUID, protocols, status);
+            logger.error("addPortToBridge: Could not find Port {} in Bridge {}, Node {}", portName, bridgeName, node);
+            return new Status(StatusCode.NOTFOUND, "Could not find "+portName+" in "+bridgeName);
         }
 
-        IConnectionServiceInternal connectionService = (IConnectionServiceInternal)ServiceHelper.getGlobalInstance(IConnectionServiceInternal.class, this);
-        connectionService.setOFController(node, bridgeUUID);
+        Port port = new Port();
+        port.setName(portName);
+        StatusWithUuid statusWithUuid = ovsdbTable.insertRow(node, Port.NAME.getName(), bridgeUUID, port);
+        if (!statusWithUuid.isSuccess()) {
+            logger.error("addPortToBridge: Failed to add Port {} in Bridge {}, Node {}", portName, bridgeName, node);
+            return statusWithUuid;
+        }
 
-        if (localPathName != null && remotePatchName != null && ProviderNetworkManager.getManager().hasPerTenantTunneling()) {
-            return addPatchPort(node, bridgeUUID, localPathName, remotePatchName);
+        String portUUID = statusWithUuid.getUuid().toString();
+        String interfaceUUID = null;
+        int timeout = 6;
+        while ((interfaceUUID == null) && (timeout > 0)) {
+            port = (Port)ovsdbTable.getRow(node, Port.NAME.getName(), portUUID);
+            OvsDBSet<UUID> interfaces = port.getInterfaces();
+            if (interfaces == null || interfaces.size() == 0) {
+                // Wait for the OVSDB update to sync up the Local cache.
+                Thread.sleep(500);
+                timeout--;
+                continue;
+            }
+            interfaceUUID = interfaces.toArray()[0].toString();
+            Interface intf = (Interface)ovsdbTable.getRow(node, Interface.NAME.getName(), interfaceUUID);
+            if (intf == null) {
+                interfaceUUID = null;
+            }
         }
+
+        if (interfaceUUID == null) {
+            logger.error("addPortToBridge: Cannot identify Interface for port {}/{}", portName, portUUID);
+            return new Status(StatusCode.INTERNALERROR);
+        }
+
         return new Status(StatusCode.SUCCESS);
     }
 
-    private Status addPatchPort (Node node, String bridgeUUID, String portName, String patchName) throws Exception {
+    private Status addPatchPort (Node node, String bridgeUUID, String portName, String peerPortName) throws Exception {
         OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
 
+        logger.debug("addPatchPort: node: {}, bridgeUUID: {}, port: {}, peer: {}",
+                node, bridgeUUID, portName, peerPortName);
+
+        /* Check if the port already exists. */
+        Bridge bridge = (Bridge)ovsdbTable.getRow(node, Bridge.NAME.getName(), bridgeUUID);
+        if (bridge != null) {
+            if (isPortOnBridge(node, bridge, portName)) {
+                logger.debug("addPatchPort: Port {} already in Bridge, Node {}", portName, node);
+                return new Status(StatusCode.SUCCESS);
+            }
+        } else {
+            logger.error("addPatchPort: Could not find Port {} in Bridge, Node {}", portName, node);
+            return new Status(StatusCode.NOTFOUND, "Could not find "+portName+" in Bridge");
+        }
+
         Port patchPort = new Port();
         patchPort.setName(portName);
         // Create patch port and interface
@@ -203,20 +441,102 @@ public class InternalNetworkManager {
             return new Status(StatusCode.INTERNALERROR);
         }
 
-        Interface tunInterface = new Interface();
-        tunInterface.setType("patch");
+        Interface intf = new Interface();
+        intf.setType("patch");
         OvsDBMap<String, String> options = new OvsDBMap<String, String>();
-        options.put("peer", patchName);
-        tunInterface.setOptions(options);
-        return ovsdbTable.updateRow(node, Interface.NAME.getName(), patchPortUUID, interfaceUUID, tunInterface);
+        options.put("peer", peerPortName);
+        intf.setOptions(options);
+        return ovsdbTable.updateRow(node, Interface.NAME.getName(), patchPortUUID, interfaceUUID, intf);
+    }
+
+    private Status addInternalBridge (Node node, String bridgeName, String localPatchName, String remotePatchName) throws Exception {
+        OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
+
+        String bridgeUUID = this.getInternalBridgeUUID(node, bridgeName);
+        Bridge bridge = new Bridge();
+        OvsDBSet<String> failMode = new OvsDBSet<String>();
+        failMode.add("secure");
+        bridge.setFail_mode(failMode);
+
+        OvsDBSet<String> protocols = new OvsDBSet<String>();
+        if (providerNetworkManager == null) {
+            logger.error("Provider Network Manager is not available");
+            return new Status(StatusCode.INTERNALERROR);
+        }
+        if (!providerNetworkManager.getProvider().hasPerTenantTunneling()) {
+            protocols.add("OpenFlow13");
+        } else {
+            protocols.add("OpenFlow10");
+        }
+        bridge.setProtocols(protocols);
+
+        if (bridgeUUID == null) {
+            bridge.setName(bridgeName);
+
+            StatusWithUuid statusWithUuid = ovsdbTable.insertRow(node, Bridge.NAME.getName(), null, bridge);
+            if (!statusWithUuid.isSuccess()) return statusWithUuid;
+            bridgeUUID = statusWithUuid.getUuid().toString();
+            Port port = new Port();
+            port.setName(bridgeName);
+            Status status = ovsdbTable.insertRow(node, Port.NAME.getName(), bridgeUUID, port);
+            logger.debug("addInternalBridge: Inserting Bridge {} {} with protocols {} and status {}",
+                    bridgeName, bridgeUUID, protocols, status);
+        } else {
+            Status status = ovsdbTable.updateRow(node, Bridge.NAME.getName(), null, bridgeUUID, bridge);
+            logger.debug("addInternalBridge: Updating Bridge {} {} with protocols {} and status {}",
+                    bridgeName, bridgeUUID, protocols, status);
+        }
+
+        IConnectionServiceInternal connectionService = (IConnectionServiceInternal)ServiceHelper.getGlobalInstance(IConnectionServiceInternal.class, this);
+        connectionService.setOFController(node, bridgeUUID);
+
+        if (localPatchName != null && remotePatchName != null && providerNetworkManager.getProvider().hasPerTenantTunneling()) {
+            return addPatchPort(node, bridgeUUID, localPatchName, remotePatchName);
+        }
+        return new Status(StatusCode.SUCCESS);
     }
 
     public void prepareInternalNetwork(Node node) {
         try {
-            this.createInternalNetworkForOverlay(node);
+            this.createIntegrationBridge(node);
         } catch (Exception e) {
             logger.error("Error creating internal network "+node.toString(), e);
+            return;
+        }
+        if (providerNetworkManager == null) {
+            logger.error("Error creating internal network. Provider Network Manager unavailable");
+            return;
+        }
+        providerNetworkManager.getProvider().initializeFlowRules(node);
+    }
+
+    /*
+     * Check if the full network setup is available. If not, create it.
+     */
+    public boolean checkAndCreateNetwork (Node node, NeutronNetwork network) {
+        boolean isCreated = false;
+        if (network.getProviderNetworkType().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VLAN)) {
+            if (!this.isInternalNetworkVlanReady(node, network)) {
+                try {
+                    isCreated = this.createNetNetwork(node, network);
+                } catch (Exception e) {
+                    logger.error("Error creating internal net network ", node, e);
+                }
+            } else {
+                isCreated = true;
+            }
+        } else if (network.getProviderNetworkType().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VXLAN) ||
+                network.getProviderNetworkType().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_GRE)) {
+            if (!this.isInternalNetworkTunnelReady(node)) {
+                try {
+                    isCreated = this.createNetNetwork(node, network);
+                } catch (Exception e) {
+                    logger.error("Error creating internal net network ", node, e);
+                }
+            } else {
+                isCreated = true;
+            }
         }
-        ProviderNetworkManager.getManager().initializeFlowRules(node);
+        return isCreated;
     }
 }
index 62880477910e7cbee24ae8056a756961159b66f5..dc0a6575ad5a2f37eb7781871f86a7dd68ffe81b 100644 (file)
@@ -5,14 +5,24 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  *
- * Authors : Madhu Venugopal, Brent Salisbury
+ * Authors : Madhu Venugopal, Brent Salisbury, Hsin-Yi Shen
  */
 package org.opendaylight.ovsdb.neutron;
 
 import java.net.HttpURLConnection;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ConcurrentMap;
 
 import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkAware;
+import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD;
 import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork;
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.utils.ServiceHelper;
+import org.opendaylight.ovsdb.lib.table.Interface;
+import org.opendaylight.ovsdb.lib.table.Table;
+import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
+import org.opendaylight.ovsdb.plugin.OVSDBInventoryListener;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -21,11 +31,20 @@ import org.slf4j.LoggerFactory;
  */
 public class NetworkHandler extends BaseHandler
                             implements INeutronNetworkAware {
+
+    public static final String NETWORK_TYPE_VXLAN = "vxlan";
+    public static final String NETWORK_TYPE_GRE = "gre";
+    public static final String NETWORK_TYPE_VLAN = "vlan";
+
     /**
      * Logger instance.
      */
     static final Logger logger = LoggerFactory.getLogger(NetworkHandler.class);
 
+    // The implementation for each of these services is resolved by the OSGi Service Manager
+    private volatile ITenantNetworkManager tenantNetworkManager;
+    private volatile IAdminConfigManager adminConfigManager;
+
     /**
      * Invoked when a network creation is requested
      * to indicate if the specified network can be created.
@@ -51,7 +70,7 @@ public class NetworkHandler extends BaseHandler
     @Override
     public void neutronNetworkCreated(NeutronNetwork network) {
         int result = HttpURLConnection.HTTP_BAD_REQUEST;
-
+        logger.trace("neutronNetworkCreated: network: {}", network);
         result = canCreateNetwork(network);
         if (result != HttpURLConnection.HTTP_CREATED) {
             logger.debug("Network creation failed {} ", result);
@@ -73,6 +92,7 @@ public class NetworkHandler extends BaseHandler
     @Override
     public int canUpdateNetwork(NeutronNetwork delta,
                                 NeutronNetwork original) {
+        logger.trace("canUpdateNetwork: network delta {} --- original {}", delta, original);
         return HttpURLConnection.HTTP_OK;
     }
 
@@ -83,6 +103,7 @@ public class NetworkHandler extends BaseHandler
      */
     @Override
     public void neutronNetworkUpdated(NeutronNetwork network) {
+        logger.trace("neutronNetworkUpdated: network: {}", network);
         return;
     }
 
@@ -107,11 +128,50 @@ public class NetworkHandler extends BaseHandler
     public void neutronNetworkDeleted(NeutronNetwork network) {
 
         int result = canDeleteNetwork(network);
+        logger.trace("canDeleteNetwork: network: {}", network);
         if  (result != HttpURLConnection.HTTP_OK) {
             logger.error(" deleteNetwork validation failed for result - {} ",
                     result);
             return;
         }
-        TenantNetworkManager.getManager().networkDeleted(network.getID());
+        /* Is this the last Neutron tenant network */
+        INeutronNetworkCRUD neutronNetworkService = (INeutronNetworkCRUD)ServiceHelper.getGlobalInstance(INeutronNetworkCRUD.class, this);
+        List <NeutronNetwork> networks = new ArrayList<NeutronNetwork>();
+        if (neutronNetworkService != null) {
+            networks = neutronNetworkService.getAllNetworks();
+            OVSDBInventoryListener inventoryListener = (OVSDBInventoryListener)ServiceHelper.getGlobalInstance(OVSDBInventoryListener.class, this);
+            if (networks.isEmpty()) {
+                logger.trace("neutronNetworkDeleted: last tenant network, delete tunnel ports...");
+                IConnectionServiceInternal connectionService = (IConnectionServiceInternal)
+                                        ServiceHelper.getGlobalInstance(IConnectionServiceInternal.class, this);
+                List<Node> nodes = connectionService.getNodes();
+
+                for (Node node : nodes) {
+                    List<String> phyIfName = adminConfigManager.getAllPhysicalInterfaceNames(node);
+                    try {
+                        ConcurrentMap<String, Table<?>> interfaces = this.ovsdbConfigService.getRows(node, Interface.NAME.getName());
+                        if (interfaces != null) {
+                            for (String intfUUID : interfaces.keySet()) {
+                                Interface intf = (Interface) interfaces.get(intfUUID);
+                                String intfType = intf.getType();
+                                if (intfType.equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VXLAN) || intfType.equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_GRE)) {
+                                    /* delete tunnel ports on this node */
+                                    logger.trace("Delete tunnel intf {}", intf);
+                                    inventoryListener.rowRemoved(node, Interface.NAME.getName(), intfUUID,
+                                            intf, null);
+                                } else if (!phyIfName.isEmpty() && phyIfName.contains(intf.getName())) {
+                                    logger.trace("Delete physical intf {}", intf);
+                                    inventoryListener.rowRemoved(node, Interface.NAME.getName(), intfUUID,
+                                            intf, null);
+                                }
+                            }
+                        }
+                    } catch (Exception e) {
+                        logger.error("Exception during handlingNeutron network delete");
+                    }
+                }
+            }
+        }
+        tenantNetworkManager.networkDeleted(network.getID());
     }
 }
index 115b891e82eec0cd10e2fb3e4602c5cf92123e41..0e03bf6db3defc98788888fceb5e87566bfc20ee 100644 (file)
@@ -32,18 +32,18 @@ public class NodeConfiguration {
     private static final int MAX_VLAN = 4096;
     private java.util.Queue<Integer> internalVlans = new LinkedList<>();
     private ConcurrentMap<String, Integer> tenantVlanMap = new ConcurrentHashMap<>();
+    private ITenantNetworkManager tenantNetworkManager;
 
-    public NodeConfiguration(Node node) {
+    public NodeConfiguration(Node node, ITenantNetworkManager tenantNetworkManager) {
         for (int i = 1; i < MAX_VLAN ; i++) {
             internalVlans.add(i);
         }
-
+        setTenantNetworkManager(tenantNetworkManager);
         initializeNodeConfiguration(node);
     }
 
 
     private void initializeNodeConfiguration(Node node) {
-
         int vlan = 0;
         String networkId = new String();
         OVSDBConfigService ovsdbTable = (OVSDBConfigService) ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
@@ -66,7 +66,7 @@ public class NodeConfiguration {
                     vlan = tags[0].intValue();
                 }
                 else {
-                   logger.debug("This port has more {} interfaces", tags.length);
+                   logger.debug("This port ({}) has {} tags", port.getName(), tags.length);
                    continue;
                 }
 
@@ -78,7 +78,7 @@ public class NodeConfiguration {
                         continue;
                     }
 
-                    networkId = TenantNetworkManager.getManager().getTenantNetworkForInterface(iface).getNetworkUUID();
+                    networkId = tenantNetworkManager.getTenantNetworkForInterface(iface).getNetworkUUID();
 
                     if (networkId != null) break;
                 }
@@ -88,6 +88,8 @@ public class NodeConfiguration {
                     this.internalVlanInUse(vlan);
                     this.tenantVlanMap.put(networkId, vlan);
 
+                } else {
+                    logger.debug("Node: {} initialized without a vlan", node);
                 }
             }
         }
@@ -96,6 +98,10 @@ public class NodeConfiguration {
         }
     }
 
+    /*
+     * Return the currently mapped internal vlan or get the next
+     * free internal vlan from the available pool and map it to the networkId.
+     */
     public int assignInternalVlan (String networkId) {
         Integer mappedVlan = tenantVlanMap.get(networkId);
         if (mappedVlan != null) return mappedVlan;
@@ -104,6 +110,9 @@ public class NodeConfiguration {
         return mappedVlan;
     }
 
+    /*
+     * Return the mapped internal vlan to the available pool.
+     */
     public int reclaimInternalVlan (String networkId) {
         Integer mappedVlan = tenantVlanMap.get(networkId);
         if (mappedVlan != null) {
@@ -114,14 +123,23 @@ public class NodeConfiguration {
         return 0;
     }
 
+    /*
+     * Remove the internal vlan from the available pool.
+     */
     public void internalVlanInUse (int vlan) {
         internalVlans.remove(vlan);
     }
 
+    /*
+     * Return a vlan from the mapped pool keyed by the networkId.
+     */
     public int getInternalVlan (String networkId) {
         Integer vlan = tenantVlanMap.get(networkId);
         if (vlan == null) return 0;
         return vlan.intValue();
     }
 
+    public void setTenantNetworkManager(ITenantNetworkManager tenantNetworkManager) {
+        this.tenantNetworkManager = tenantNetworkManager;
+    }
 }
index d30d01f0a6a62e31ac67dd640e80bf5717d8c7cd..128b53bfffc3870e10a1b5571d4a8347f8905a1b 100644 (file)
 package org.opendaylight.ovsdb.neutron;
 
 import java.net.HttpURLConnection;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentMap;
 
+import org.opendaylight.controller.networkconfig.neutron.INeutronNetworkCRUD;
 import org.opendaylight.controller.networkconfig.neutron.INeutronPortAware;
+import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork;
 import org.opendaylight.controller.networkconfig.neutron.NeutronPort;
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.utils.ServiceHelper;
+import org.opendaylight.ovsdb.lib.table.Interface;
+import org.opendaylight.ovsdb.lib.table.Table;
+import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
+import org.opendaylight.ovsdb.plugin.OVSDBInventoryListener;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -118,9 +129,43 @@ public class PortHandler extends BaseHandler
             return;
         }
 
+        IConnectionServiceInternal connectionService = (IConnectionServiceInternal)ServiceHelper.getGlobalInstance(IConnectionServiceInternal.class, this);
+        INeutronNetworkCRUD neutronNetworkService = (INeutronNetworkCRUD)ServiceHelper.getGlobalInstance(INeutronNetworkCRUD.class, this);
+        NeutronNetwork neutronNetwork = neutronNetworkService.getNetwork(port.getNetworkUUID());
+        OVSDBInventoryListener inventoryListener = (OVSDBInventoryListener)ServiceHelper.getGlobalInstance(OVSDBInventoryListener.class, this);
+        List<Node> nodes = connectionService.getNodes();
+        for (Node node : nodes) {
+            try {
+                ConcurrentMap<String, Table<?>> interfaces = this.ovsdbConfigService.getRows(node, Interface.NAME.getName());
+                if (interfaces != null) {
+                    for (String intfUUID : interfaces.keySet()) {
+                        Interface intf = (Interface) interfaces.get(intfUUID);
+                        Map<String, String> externalIds = intf.getExternal_ids();
+                        if (externalIds == null) {
+                            logger.trace("No external_ids seen in {}", intf);
+                            continue;
+                        }
+                        /* Compare Neutron port uuid */
+                        String neutronPortId = externalIds.get(TenantNetworkManager.EXTERNAL_ID_INTERFACE_ID);
+                        if (neutronPortId == null) {
+                            continue;
+                        }
+                        if (neutronPortId.equalsIgnoreCase(port.getPortUUID())) {
+                            logger.trace("neutronPortDeleted: Delete interface {}", intf.getName());
+                            inventoryListener.rowRemoved(node, Interface.NAME.getName(), intfUUID,
+                                                         intf, neutronNetwork);
+                            break;
+                        }
+                    }
+                }
+            } catch (Exception e) {
+                logger.error("Exception during handlingNeutron network delete");
+            }
+        }
         logger.debug(" PORT delete successful for tenant-id - {}, " +
                      " network-id - {}, port-id - {}",
                      port.getTenantID(), port.getNetworkUUID(),
                      port.getID());
+
     }
 }
diff --git a/neutron/src/main/java/org/opendaylight/ovsdb/neutron/PortSecurityHandler.java b/neutron/src/main/java/org/opendaylight/ovsdb/neutron/PortSecurityHandler.java
new file mode 100644 (file)
index 0000000..888eac7
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Brent Salisbury, Madhu Venugopal
+ */
+
+package org.opendaylight.ovsdb.neutron;
+
+import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityGroupAware;
+import org.opendaylight.controller.networkconfig.neutron.INeutronSecurityRuleAware;
+import org.opendaylight.controller.networkconfig.neutron.NeutronSecurityGroup;
+import org.opendaylight.controller.networkconfig.neutron.NeutronSecurityRule;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.net.HttpURLConnection;
+
+/**
+ * Handle requests for OpenStack Neutron v2.0 Port Security API calls.
+ */
+public class PortSecurityHandler extends BaseHandler
+        implements INeutronSecurityGroupAware, INeutronSecurityRuleAware{
+
+    static final Logger logger = LoggerFactory.getLogger(PortSecurityHandler.class);
+
+    @Override
+    public int canCreateNeutronSecurityGroup(NeutronSecurityGroup neutronSecurityGroup) {
+        return HttpURLConnection.HTTP_CREATED;
+    }
+
+    @Override
+    public void neutronSecurityGroupCreated(NeutronSecurityGroup neutronSecurityGroup) {
+        int result = HttpURLConnection.HTTP_BAD_REQUEST;
+
+        result = canCreateNeutronSecurityGroup(neutronSecurityGroup);
+        if (result != HttpURLConnection.HTTP_CREATED) {
+            logger.debug("Neutron Security Group creation failed {} ", result);
+            return;
+        }
+    }
+
+    @Override
+    public int canUpdateNeutronSecurityGroup(NeutronSecurityGroup delta, NeutronSecurityGroup original) {
+        return HttpURLConnection.HTTP_OK;
+    }
+
+    @Override
+    public void neutronSecurityGroupUpdated(NeutronSecurityGroup neutronSecurityGroup) {
+        return;
+    }
+
+    @Override
+    public int canDeleteNeutronSecurityGroup(NeutronSecurityGroup neutronSecurityGroup) {
+        return HttpURLConnection.HTTP_OK;
+    }
+
+    @Override
+    public void neutronSecurityGroupDeleted(NeutronSecurityGroup neutronSecurityGroup) {
+        //TODO: Trigger flowmod removals
+        int result = canDeleteNeutronSecurityGroup(neutronSecurityGroup);
+        if  (result != HttpURLConnection.HTTP_OK) {
+            logger.error(" delete Neutron Security Rule validation failed for result - {} ", result);
+            return;
+        }
+    }
+
+    /**
+     * Invoked when a Security Rules creation is requested
+     * to indicate if the specified Rule can be created.
+     *
+     * @param neutronSecurityRule  An instance of proposed new Neutron Security Rule object.
+     * @return A HTTP status code to the creation request.
+     */
+
+    @Override
+    public int canCreateNeutronSecurityRule(NeutronSecurityRule neutronSecurityRule) {
+        return HttpURLConnection.HTTP_CREATED;
+    }
+
+    @Override
+    public void neutronSecurityRuleCreated(NeutronSecurityRule neutronSecurityRule) {
+        int result = HttpURLConnection.HTTP_BAD_REQUEST;
+
+        result = canCreateNeutronSecurityRule(neutronSecurityRule);
+        if (result != HttpURLConnection.HTTP_CREATED) {
+            logger.debug("Neutron Security Group creation failed {} ", result);
+            return;
+        }
+    }
+
+    @Override
+    public int canUpdateNeutronSecurityRule(NeutronSecurityRule delta, NeutronSecurityRule original) {
+        return HttpURLConnection.HTTP_OK;
+    }
+
+    @Override
+    public void neutronSecurityRuleUpdated(NeutronSecurityRule neutronSecurityRule) {
+        return;
+    }
+
+    @Override
+    public int canDeleteNeutronSecurityRule(NeutronSecurityRule neutronSecurityRule) {
+        return HttpURLConnection.HTTP_OK;
+    }
+
+    @Override
+    public void neutronSecurityRuleDeleted(NeutronSecurityRule neutronSecurityRule) {
+        int result = canDeleteNeutronSecurityRule(neutronSecurityRule);
+        if  (result != HttpURLConnection.HTTP_OK) {
+            logger.error(" delete Neutron Security Rule validation failed for result - {} ", result);
+            return;
+        }
+    }
+}
\ No newline at end of file
index 5c5028f049338cda6220e270344bf1e8b1e8eefc..8204d91d20e09cbf74d5049b5b7160bf2637711f 100644 (file)
@@ -21,6 +21,7 @@ public class SouthboundEvent {
     private String tableName;
     private String uuid;
     private Table<?> row;
+    private Object context;
     public SouthboundEvent(Node node, Action action) {
         super();
         this.type = Type.NODE;
@@ -36,6 +37,16 @@ public class SouthboundEvent {
         this.uuid = uuid;
         this.row = row;
     }
+    public SouthboundEvent(Node node, String tableName, String uuid, Table<?> row, Object context, Action action) {
+        super();
+        this.type = Type.ROW;
+        this.action = action;
+        this.node = node;
+        this.tableName = tableName;
+        this.uuid = uuid;
+        this.row = row;
+        this.context = context;
+    }
     public Type getType() {
         return type;
     }
@@ -54,10 +65,13 @@ public class SouthboundEvent {
     public Table<?> getRow() {
         return row;
     }
+    public Object getContext() {
+        return context;
+    }
     @Override
     public String toString() {
         return "SouthboundEvent [type=" + type + ", action=" + action + ", node=" + node + ", tableName=" + tableName
-                + ", uuid=" + uuid + ", row=" + row + "]";
+                + ", uuid=" + uuid + ", row=" + row + ", context=" + context.toString() + "]";
     }
     @Override
     public int hashCode() {
index 8d6b830bab2022f0a2282374185b4983e65d3ab2..5238e5069409fd2cbf101b7495954a57fbb9e90d 100644 (file)
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  *
- * Authors : Madhu Venugopal, Brent Salisbury
+ * Authors : Madhu Venugopal, Brent Salisbury, Sam Hague, Dave Tucker
  */
 package org.opendaylight.ovsdb.neutron;
 
@@ -30,7 +30,7 @@ import org.opendaylight.ovsdb.lib.table.Interface;
 import org.opendaylight.ovsdb.lib.table.Open_vSwitch;
 import org.opendaylight.ovsdb.lib.table.Port;
 import org.opendaylight.ovsdb.lib.table.Table;
-import org.opendaylight.ovsdb.neutron.provider.ProviderNetworkManager;
+import org.opendaylight.ovsdb.neutron.provider.IProviderNetworkManager;
 import org.opendaylight.ovsdb.plugin.OVSDBInventoryListener;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -42,6 +42,12 @@ public class SouthboundHandler extends BaseHandler implements OVSDBInventoryList
     private BlockingQueue<SouthboundEvent> events;
     List<Node> nodeCache;
 
+    // The implementation for each of these services is resolved by the OSGi Service Manager
+    private volatile IAdminConfigManager adminConfigManager;
+    private volatile IInternalNetworkManager internalNetworkManager;
+    private volatile ITenantNetworkManager tenantNetworkManager;
+    private volatile IProviderNetworkManager providerNetworkManager;
+
     void init() {
         eventHandler = Executors.newSingleThreadExecutor();
         this.events = new LinkedBlockingQueue<SouthboundEvent>();
@@ -70,7 +76,8 @@ public class SouthboundHandler extends BaseHandler implements OVSDBInventoryList
                         break;
                     case ROW:
                         try {
-                            processRowUpdate(ev.getNode(), ev.getTableName(), ev.getUuid(), ev.getRow(), ev.getAction());
+                            processRowUpdate(ev.getNode(), ev.getTableName(), ev.getUuid(), ev.getRow(),
+                                             ev.getContext(),ev.getAction());
                         } catch (Exception e) {
                             logger.error("Exception caught in ProcessRowUpdate for node " + ev.getNode(), e);
                         }
@@ -105,7 +112,7 @@ public class SouthboundHandler extends BaseHandler implements OVSDBInventoryList
 
     @Override
     public void rowUpdated(Node node, String tableName, String uuid, Table<?> oldRow, Table<?> newRow) {
-        if (this.isUpdateOfInterest(oldRow, newRow)) {
+        if (this.isUpdateOfInterest(node, oldRow, newRow)) {
             this.enqueueEvent(new SouthboundEvent(node, tableName, uuid, newRow, SouthboundEvent.Action.UPDATE));
         }
     }
@@ -115,7 +122,7 @@ public class SouthboundHandler extends BaseHandler implements OVSDBInventoryList
      * (Especially stats update are fast and furious).
      */
 
-    private boolean isUpdateOfInterest(Table<?> oldRow, Table<?> newRow) {
+    private boolean isUpdateOfInterest(Node node, Table<?> oldRow, Table<?> newRow) {
         if (oldRow == null) return true;
         if (newRow.getTableName().equals(Interface.NAME)) {
             // We are NOT interested in Stats only updates
@@ -123,7 +130,7 @@ public class SouthboundHandler extends BaseHandler implements OVSDBInventoryList
             if (oldIntf.getName() == null && oldIntf.getExternal_ids() == null && oldIntf.getMac() == null &&
                 oldIntf.getOfport() == null && oldIntf.getOptions() == null && oldIntf.getOther_config() == null &&
                 oldIntf.getType() == null) {
-                logger.trace("IGNORING Interface Update : "+newRow.toString());
+                logger.trace("IGNORING Interface Update: node {}, row: {}", node, newRow);
                 return false;
             }
         } else if (newRow.getTableName().equals(Port.NAME)) {
@@ -131,17 +138,22 @@ public class SouthboundHandler extends BaseHandler implements OVSDBInventoryList
             Port oldPort = (Port)oldRow;
             if (oldPort.getName() == null && oldPort.getExternal_ids() == null && oldPort.getMac() == null &&
                 oldPort.getInterfaces() == null && oldPort.getTag() == null && oldPort.getTrunks() == null) {
-                logger.trace("IGNORING Port Update : "+newRow.toString());
+                logger.trace("IGNORING Port Update: node {}, row: {}", node, newRow);
+                return false;
+            }
+        } else if (newRow.getTableName().equals(Open_vSwitch.NAME)) {
+            Open_vSwitch oldOpenvSwitch = (Open_vSwitch) oldRow;
+            if (oldOpenvSwitch.getOther_config()== null) {
+                /* we are only interested in other_config field change */
                 return false;
             }
         }
-
         return true;
     }
 
     @Override
-    public void rowRemoved(Node node, String tableName, String uuid, Table<?> row) {
-        this.enqueueEvent(new SouthboundEvent(node, tableName, uuid, row, SouthboundEvent.Action.DELETE));
+    public void rowRemoved(Node node, String tableName, String uuid, Table<?> row, Object context) {
+        this.enqueueEvent(new SouthboundEvent(node, tableName, uuid, row, context, SouthboundEvent.Action.DELETE));
     }
 
     private void enqueueEvent (SouthboundEvent event) {
@@ -150,22 +162,35 @@ public class SouthboundHandler extends BaseHandler implements OVSDBInventoryList
         } catch (InterruptedException e) {
             logger.error("Thread was interrupted while trying to enqueue event ", e);
         }
-
     }
 
     public void processNodeUpdate(Node node, SouthboundEvent.Action action) {
         if (action == SouthboundEvent.Action.DELETE) return;
         logger.trace("Process Node added {}", node);
-        InternalNetworkManager.getManager().prepareInternalNetwork(node);
+        internalNetworkManager.prepareInternalNetwork(node);
     }
 
     private void processRowUpdate(Node node, String tableName, String uuid, Table<?> row,
-                                  SouthboundEvent.Action action) {
+                                  Object context, SouthboundEvent.Action action) {
         if (action == SouthboundEvent.Action.DELETE) {
             if (Interface.NAME.getName().equalsIgnoreCase(tableName)) {
+                logger.debug("processRowUpdate: {} Deleted node: {}, uuid: {}, row: {}", tableName, node, uuid, row);
                 Interface deletedIntf = (Interface)row;
-                NeutronNetwork network = TenantNetworkManager.getManager().getTenantNetworkForInterface(deletedIntf);
-                if (network != null && !network.getRouterExternal()) {
+                NeutronNetwork network = null;
+                if (context == null) {
+                    network = tenantNetworkManager.getTenantNetworkForInterface(deletedIntf);
+                } else {
+                    network = (NeutronNetwork)context;
+                }
+                List<String> phyIfName = adminConfigManager.getAllPhysicalInterfaceNames(node);
+                logger.info("Delete interface " + deletedIntf.getName());
+
+                if (deletedIntf.getType().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VXLAN) ||
+                    deletedIntf.getType().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_GRE) ||
+                    phyIfName.contains(deletedIntf.getName())) {
+                    /* delete tunnel interfaces or physical interfaces */
+                    this.handleInterfaceDelete(node, uuid, deletedIntf, false, null);
+                } else if (network != null && !network.getRouterExternal()) {
                     try {
                         ConcurrentMap<String, Table<?>> interfaces = this.ovsdbConfigService.getRows(node, Interface.NAME.getName());
                         if (interfaces != null) {
@@ -173,10 +198,10 @@ public class SouthboundHandler extends BaseHandler implements OVSDBInventoryList
                             for (String intfUUID : interfaces.keySet()) {
                                 if (intfUUID.equals(uuid)) continue;
                                 Interface intf = (Interface) interfaces.get(intfUUID);
-                                NeutronNetwork neutronNetwork = TenantNetworkManager.getManager().getTenantNetworkForInterface(intf);
+                                NeutronNetwork neutronNetwork = tenantNetworkManager.getTenantNetworkForInterface(intf);
                                 if (neutronNetwork != null && neutronNetwork.equals(network)) isLastInstanceOnNode = false;
                             }
-                            this.handleInterfaceDelete(node, uuid, deletedIntf, isLastInstanceOnNode);
+                            this.handleInterfaceDelete(node, uuid, deletedIntf, isLastInstanceOnNode, network);
                         }
                     } catch (Exception e) {
                         logger.error("Error fetching Interface Rows for node " + node, e);
@@ -185,39 +210,41 @@ public class SouthboundHandler extends BaseHandler implements OVSDBInventoryList
             }
         }
         else if (Interface.NAME.getName().equalsIgnoreCase(tableName)) {
-            logger.debug("{} Added / Updated {} , {}, {}", tableName, node, uuid, row);
+            logger.debug("processRowUpdate: {} Added / Updated node: {}, uuid: {}, row: {}", tableName, node, uuid, row);
             Interface intf = (Interface)row;
-            NeutronNetwork network = TenantNetworkManager.getManager().getTenantNetworkForInterface(intf);
+            NeutronNetwork network = tenantNetworkManager.getTenantNetworkForInterface(intf);
             if (network != null && !network.getRouterExternal()) {
-                if (ProviderNetworkManager.getManager().hasPerTenantTunneling()) {
-                    int vlan = TenantNetworkManager.getManager().networkCreated(node, network.getID());
-                    logger.trace("Neutron Network {} Created with Internal Vlan : {}", network.toString(), vlan);
+                if (providerNetworkManager.getProvider().hasPerTenantTunneling()) {
+                    int vlan = tenantNetworkManager.networkCreated(node, network.getID());
+                    logger.trace("Neutron Network {}:{} Created with Internal Vlan: {}", network.getNetworkUUID(), network.getNetworkName(), vlan);
 
                     String portUUID = this.getPortIdForInterface(node, uuid, intf);
                     if (portUUID != null) {
-                        TenantNetworkManager.getManager().programTenantNetworkInternalVlan(node, portUUID, network);
+                        tenantNetworkManager.programTenantNetworkInternalVlan(node, portUUID, network);
                     }
                 }
                 this.handleInterfaceUpdate(node, uuid, intf);
             }
         } else if (Port.NAME.getName().equalsIgnoreCase(tableName)) {
-            logger.debug("{} Added / Updated {} , {}, {}", tableName, node, uuid, row);
+            logger.debug("processRowUpdate: {} Added / Updated node: {}, uuid: {}, row: {}", tableName, node, uuid, row);
             Port port = (Port)row;
             Set<UUID> interfaceUUIDs = port.getInterfaces();
             for (UUID intfUUID : interfaceUUIDs) {
                 logger.trace("Scanning interface "+intfUUID);
                 try {
                     Interface intf = (Interface)this.ovsdbConfigService.getRow(node, Interface.NAME.getName(), intfUUID.toString());
-                    NeutronNetwork network = TenantNetworkManager.getManager().getTenantNetworkForInterface(intf);
+                    NeutronNetwork network = tenantNetworkManager.getTenantNetworkForInterface(intf);
                     if (network != null && !network.getRouterExternal()) {
-                        TenantNetworkManager.getManager().programTenantNetworkInternalVlan(node, uuid, network);
+                        tenantNetworkManager.programTenantNetworkInternalVlan(node, uuid, network);
+                    } else {
+                        logger.trace("ignore update because there is not a neutron network.");
                     }
                 } catch (Exception e) {
                     logger.error("Failed to process row update", e);
                 }
             }
         } else if (Open_vSwitch.NAME.getName().equalsIgnoreCase(tableName)) {
-            logger.debug("{} Added / Updated {} , {}, {}", tableName, node, uuid, row);
+            logger.debug("processRowUpdate: {} Added / Updated node: {}, uuid: {}, row: {}", tableName, node, uuid, row);
             try {
                 ConcurrentMap<String, Table<?>> interfaces = this.ovsdbConfigService.getRows(node, Interface.NAME.getName());
                 if (interfaces != null) {
@@ -233,28 +260,37 @@ public class SouthboundHandler extends BaseHandler implements OVSDBInventoryList
     }
 
     private void handleInterfaceUpdate (Node node, String uuid, Interface intf) {
-        if (AdminConfigManager.getManager().getTunnelEndPoint(node) == null) {
-            logger.error("Tunnel end-point configuration missing. Please configure it in Open_vSwitch Table");
-            return;
-        }
-        NeutronNetwork network = TenantNetworkManager.getManager().getTenantNetworkForInterface(intf);
+        logger.debug("handleInterfaceUpdate: node: {}, uuid: {}", node, uuid);
+        NeutronNetwork network = tenantNetworkManager.getTenantNetworkForInterface(intf);
         if (network != null) {
-            ProviderNetworkManager.getManager().handleInterfaceUpdate(network.getProviderNetworkType(),
-                    network.getProviderSegmentationID(), node, intf);
+            if (internalNetworkManager.checkAndCreateNetwork(node, network)) {
+                providerNetworkManager.getProvider().handleInterfaceUpdate(network, node, intf);
+            }
         }
     }
-    private void handleInterfaceDelete (Node node, String uuid, Interface intf, boolean isLastInstanceOnNode) {
-        if (AdminConfigManager.getManager().getTunnelEndPoint(node) == null) {
-            logger.error("Tunnel end-point configuration missing. Please configure it in Open_vSwitch Table");
-            return;
-        }
-        NeutronNetwork network = TenantNetworkManager.getManager().getTenantNetworkForInterface(intf);
-        if (network != null) {
-            if (isLastInstanceOnNode) {
-                TenantNetworkManager.getManager().reclaimTennantNetworkInternalVlan(node, uuid, network);
+
+    private void handleInterfaceDelete (Node node, String uuid, Interface intf, boolean isLastInstanceOnNode,
+                                        NeutronNetwork network) {
+        logger.debug("handleInterfaceDelete: node: {}, uuid: {}, isLastInstanceOnNode: {}, interface: {}",
+                node, uuid, isLastInstanceOnNode, intf);
+
+        List<String> phyIfName = adminConfigManager.getAllPhysicalInterfaceNames(node);
+        if (intf.getType().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VXLAN) ||
+            intf.getType().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_GRE) ||
+            phyIfName.contains(intf.getName())) {
+            /* delete tunnel or physical interfaces */
+            providerNetworkManager.getProvider().handleInterfaceDelete(intf.getType(), null, node, intf, isLastInstanceOnNode);
+        } else if (network != null) {
+            if (!network.getProviderNetworkType().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VLAN)) { /* vlan doesn't need a tunnel endpoint */
+                if (adminConfigManager.getTunnelEndPoint(node) == null) {
+                    logger.error("Tunnel end-point configuration missing. Please configure it in Open_vSwitch Table");
+                    return;
+                }
+            }
+            if (isLastInstanceOnNode & providerNetworkManager.getProvider().hasPerTenantTunneling()) {
+                tenantNetworkManager.reclaimTenantNetworkInternalVlan(node, uuid, network);
             }
-            ProviderNetworkManager.getManager().handleInterfaceDelete(network.getProviderNetworkType(),
-                    network.getProviderSegmentationID(), node, intf, isLastInstanceOnNode);
+            providerNetworkManager.getProvider().handleInterfaceDelete(network.getProviderNetworkType(), network, node, intf, isLastInstanceOnNode);
         }
     }
 
@@ -268,7 +304,7 @@ public class SouthboundHandler extends BaseHandler implements OVSDBInventoryList
                 logger.trace("Scanning Port {} to identify interface : {} ",port, uuid);
                 for (UUID intfUUID : interfaceUUIDs) {
                     if (intfUUID.toString().equalsIgnoreCase(uuid)) {
-                        logger.trace("Found Interafce {} -> {}", uuid, portUUID);
+                        logger.trace("Found Interface {} -> {}", uuid, portUUID);
                         return portUUID;
                     }
                 }
@@ -281,12 +317,12 @@ public class SouthboundHandler extends BaseHandler implements OVSDBInventoryList
 
     @Override
     public void notifyNode(Node node, UpdateType type, Map<String, Property> propMap) {
-        logger.debug("Node {} update {} from Controller's inventory Service", node, type);
+        logger.debug("notifyNode: Node {} update {} from Controller's inventory Service", node, type);
 
         // Add the Node Type check back once the Consistency issue is resolved between MD-SAL and AD-SAL
         if (!type.equals(UpdateType.REMOVED) && !nodeCache.contains(node)) {
             nodeCache.add(node);
-            ProviderNetworkManager.getManager().initializeOFFlowRules(node);
+            providerNetworkManager.getProvider().initializeOFFlowRules(node);
         } else if (type.equals(UpdateType.REMOVED)){
             nodeCache.remove(node);
         }
index f77478a663fb7b434032f08fbd9b47e4f6bf148c..c74796d9dbbe687ac736a5262283f3cadaad5258 100644 (file)
@@ -36,33 +36,27 @@ import org.opendaylight.ovsdb.lib.table.Interface;
 import org.opendaylight.ovsdb.lib.table.Open_vSwitch;
 import org.opendaylight.ovsdb.lib.table.Port;
 import org.opendaylight.ovsdb.lib.table.Table;
-import org.opendaylight.ovsdb.neutron.provider.ProviderNetworkManager;
+import org.opendaylight.ovsdb.neutron.provider.IProviderNetworkManager;
 import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
 import org.opendaylight.ovsdb.plugin.OVSDBConfigService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class TenantNetworkManager {
+public class TenantNetworkManager implements ITenantNetworkManager {
     static final Logger logger = LoggerFactory.getLogger(TenantNetworkManager.class);
-
-    public static final String EXTERNAL_ID_VM_ID = "vm-id";
-    public static final String EXTERNAL_ID_INTERFACE_ID = "iface-id";
-    public static final String EXTERNAL_ID_VM_MAC = "attached-mac";
-    private static TenantNetworkManager tenantHelper = new TenantNetworkManager();
     private ConcurrentMap<String, NodeConfiguration> nodeConfigurationCache = new ConcurrentHashMap<>();
 
+    // The implementation for each of these services is resolved by the OSGi Service Manager
+    private volatile IProviderNetworkManager providerNetworkManager;
+
     private boolean enableContainer = false;
-    private TenantNetworkManager() {
+    public TenantNetworkManager() {
         String isTenantContainer = System.getProperty("TenantIsContainer");
         if (isTenantContainer != null && isTenantContainer.equalsIgnoreCase("true")) {
             enableContainer =  true;
         }
     }
 
-    public static TenantNetworkManager getManager() {
-        return tenantHelper;
-    }
-
     public int getInternalVlan(Node node, String networkId) {
         String nodeUuid = getNodeUUID(node);
         if (nodeUuid == null) {
@@ -81,7 +75,7 @@ public class TenantNetworkManager {
     }
 
     private NodeConfiguration addNodeConfigurationToCache(Node node) {
-        NodeConfiguration nodeConfiguration = new NodeConfiguration(node);
+        NodeConfiguration nodeConfiguration = new NodeConfiguration(node, this);
         String nodeUuid = getNodeUUID(node);
         if (nodeUuid == null) {
             logger.error("Cannot get Node UUID for Node {}", node);
@@ -91,7 +85,7 @@ public class TenantNetworkManager {
         return nodeConfigurationCache.get(nodeUuid);
     }
 
-    public void reclaimTennantNetworkInternalVlan(Node node, String portUUID, NeutronNetwork network) {
+    public void reclaimTenantNetworkInternalVlan(Node node, String portUUID, NeutronNetwork network) {
         String nodeUuid = getNodeUUID(node);
         if (nodeUuid == null) {
             logger.error("Unable to get UUID for Node {}", node);
@@ -186,7 +180,7 @@ public class TenantNetworkManager {
             logger.debug("Tenant Network not found with Segmenation-id {}",segmentationId);
             return false;
         }
-        if (ProviderNetworkManager.getManager().hasPerTenantTunneling()) {
+        if (providerNetworkManager.getProvider().hasPerTenantTunneling()) {
             String nodeUuid = getNodeUUID(node);
             if (nodeUuid == null) {
                 logger.debug("Unable to get UUID for Node {}", node);
@@ -420,5 +414,4 @@ public class TenantNetworkManager {
         config.setContainer(networkID);
         containerManager.removeContainer(config);
     }
-
 }
diff --git a/neutron/src/main/java/org/opendaylight/ovsdb/neutron/provider/IProviderNetworkManager.java b/neutron/src/main/java/org/opendaylight/ovsdb/neutron/provider/IProviderNetworkManager.java
new file mode 100644 (file)
index 0000000..2b3e6a7
--- /dev/null
@@ -0,0 +1,15 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ *  Authors : Dave Tucker
+ */
+
+package org.opendaylight.ovsdb.neutron.provider;
+
+public interface IProviderNetworkManager {
+    NetworkProvider getProvider();
+}
diff --git a/neutron/src/main/java/org/opendaylight/ovsdb/neutron/provider/NetworkProvider.java b/neutron/src/main/java/org/opendaylight/ovsdb/neutron/provider/NetworkProvider.java
new file mode 100644 (file)
index 0000000..793ad05
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ *  Authors : Dave Tucker
+ */
+
+package org.opendaylight.ovsdb.neutron.provider;
+
+import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork;
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.utils.Status;
+import org.opendaylight.ovsdb.lib.table.Interface;
+
+public interface NetworkProvider {
+
+    public static final int LLDP_PRIORITY = 1000;
+    public static final int NORMAL_PRIORITY = 0;
+
+    public boolean hasPerTenantTunneling();
+    public Status handleInterfaceUpdate(String tunnelType, String tunnelKey);
+    public Status handleInterfaceUpdate(NeutronNetwork network, Node source, Interface intf);
+    public Status handleInterfaceDelete(String tunnelType, NeutronNetwork network, Node source, Interface intf, boolean isLastInstanceOnNode);
+    /*
+     * Initialize the Flow rules given the OVSDB node.
+     * This method provides a set of common functionalities to initialize the Flow rules of an OVSDB node
+     * that are Openflow Version specific. Hence we have this method in addition to the following
+     * Openflow Node specific initialization method.
+     */
+    public void initializeFlowRules(Node node);
+
+    /*
+     * Initialize the Flow rules given the Openflow node
+     */
+    public void initializeOFFlowRules(Node openflowNode);
+}
similarity index 57%
rename from neutron/src/main/java/org/opendaylight/ovsdb/neutron/provider/OF10ProviderManager.java
rename to neutron/src/main/java/org/opendaylight/ovsdb/neutron/provider/OF10Provider.java
index 1093b34b9733e353500db8f7c8d265514ab83bfb..a0cb62d685ccadaec8f8173d50627ee7bd5f114c 100644 (file)
@@ -5,7 +5,7 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  *
- * Authors : Madhu Venugopal, Brent Salisbury
+ * Authors : Madhu Venugopal, Brent Salisbury, Sam Hague, Dave Tucker
  */
 package org.opendaylight.ovsdb.neutron.provider;
 
@@ -18,6 +18,7 @@ import java.util.Set;
 
 import org.opendaylight.controller.forwardingrulesmanager.FlowConfig;
 import org.opendaylight.controller.forwardingrulesmanager.IForwardingRulesManager;
+import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork;
 import org.opendaylight.controller.sal.action.ActionType;
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.utils.EtherTypes;
@@ -34,9 +35,10 @@ import org.opendaylight.ovsdb.lib.table.Bridge;
 import org.opendaylight.ovsdb.lib.table.Interface;
 import org.opendaylight.ovsdb.lib.table.Port;
 import org.opendaylight.ovsdb.lib.table.Table;
-import org.opendaylight.ovsdb.neutron.AdminConfigManager;
-import org.opendaylight.ovsdb.neutron.InternalNetworkManager;
-import org.opendaylight.ovsdb.neutron.TenantNetworkManager;
+import org.opendaylight.ovsdb.neutron.NetworkHandler;
+import org.opendaylight.ovsdb.neutron.IAdminConfigManager;
+import org.opendaylight.ovsdb.neutron.IInternalNetworkManager;
+import org.opendaylight.ovsdb.neutron.ITenantNetworkManager;
 import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
 import org.opendaylight.ovsdb.plugin.OVSDBConfigService;
 import org.opendaylight.ovsdb.plugin.StatusWithUuid;
@@ -44,11 +46,24 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 
-class OF10ProviderManager extends ProviderNetworkManager {
-    private static final Logger logger = LoggerFactory.getLogger(OF10ProviderManager.class);
+public class OF10Provider implements NetworkProvider {
+    private static final Logger logger = LoggerFactory.getLogger(OF10Provider.class);
     private static final int INGRESS_TUNNEL_FLOW_PRIORITY = 100;
     private static final int EGRESS_TUNNEL_FLOW_PRIORITY = 100;
-    private static final int FLOOD_TUNNEL_FLOW_PRIORITY = 1;
+    private static final int DROP_FLOW_PRIORITY = 10;
+    private static final int FLOOD_TUNNEL_FLOW_PRIORITY = 50;
+
+    private IAdminConfigManager adminConfigManager;
+    private IInternalNetworkManager internalNetworkManager;
+    private ITenantNetworkManager tenantNetworkManager;
+
+    public OF10Provider(IAdminConfigManager adminConfigManager,
+                        IInternalNetworkManager internalNetworkManager,
+                        ITenantNetworkManager tenantNetworkManager) {
+        this.adminConfigManager = adminConfigManager;
+        this.internalNetworkManager = internalNetworkManager;
+        this.tenantNetworkManager = tenantNetworkManager;
+    }
 
     @Override
     public boolean hasPerTenantTunneling() {
@@ -56,20 +71,33 @@ class OF10ProviderManager extends ProviderNetworkManager {
     }
 
     private Status getTunnelReadinessStatus (Node node, String tunnelKey) {
-        InetAddress srcTunnelEndPoint = AdminConfigManager.getManager().getTunnelEndPoint(node);
+        InetAddress srcTunnelEndPoint = adminConfigManager.getTunnelEndPoint(node);
         if (srcTunnelEndPoint == null) {
             logger.error("Tunnel Endpoint not configured for Node {}", node);
             return new Status(StatusCode.NOTFOUND, "Tunnel Endpoint not configured for "+ node);
         }
 
-        if (!InternalNetworkManager.getManager().isInternalNetworkOverlayReady(node)) {
+        if (!internalNetworkManager.isInternalNetworkOverlayReady(node)) {
             logger.warn("{} is not Overlay ready. It might be an OpenStack Controller Node", node);
             return new Status(StatusCode.NOTACCEPTABLE, node+" is not Overlay ready");
         }
 
-        if (!TenantNetworkManager.getManager().isTenantNetworkPresentInNode(node, tunnelKey)) {
-            logger.debug(node+" has no VM corresponding to segment "+ tunnelKey);
-            return new Status(StatusCode.NOTACCEPTABLE, node+" has no VM corresponding to segment "+ tunnelKey);
+        if (!tenantNetworkManager.isTenantNetworkPresentInNode(node, tunnelKey)) {
+            logger.debug(node+" has no network corresponding to segment "+ tunnelKey);
+            return new Status(StatusCode.NOTACCEPTABLE, node+" has no network corresponding to segment "+ tunnelKey);
+        }
+        return new Status(StatusCode.SUCCESS);
+    }
+
+    private Status getVlanReadinessStatus (Node node, String segmentationId) {
+        if (!internalNetworkManager.isInternalNetworkOverlayReady(node)) {
+            logger.warn("{} is not Overlay ready. It might be an OpenStack Controller Node", node);
+            return new Status(StatusCode.NOTACCEPTABLE, node+" is not Overlay ready");
+        }
+
+        if (!tenantNetworkManager.isTenantNetworkPresentInNode(node, segmentationId)) {
+            logger.debug(node+" has no network corresponding to segment "+ segmentationId);
+            return new Status(StatusCode.NOTACCEPTABLE, node+" has no network corresponding to segment "+ segmentationId);
         }
         return new Status(StatusCode.SUCCESS);
     }
@@ -80,14 +108,14 @@ class OF10ProviderManager extends ProviderNetworkManager {
      * and rewrite the Corresponding internal Vlan and pass it on to br-int via the patch port.
      */
     private void programLocalIngressTunnelBridgeRules(Node node, int tunnelOFPort, int internalVlan, int patchPort) {
-        String brIntId = InternalNetworkManager.getManager().getInternalBridgeUUID(node, AdminConfigManager.getManager().getTunnelBridgeName());
-        if (brIntId == null) {
+        String brNetId = internalNetworkManager.getInternalBridgeUUID(node, adminConfigManager.getNetworkBridgeName());
+        if (brNetId == null) {
             logger.error("Failed to initialize Flow Rules for {}", node);
             return;
         }
         try {
             OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
-            Bridge bridge = (Bridge) ovsdbTable.getRow(node, Bridge.NAME.getName(), brIntId);
+            Bridge bridge = (Bridge) ovsdbTable.getRow(node, Bridge.NAME.getName(), brNetId);
             Set<String> dpids = bridge.getDatapath_id();
             if (dpids == null || dpids.size() ==  0) return;
             Long dpidLong = Long.valueOf(HexEncode.stringToLong((String)dpids.toArray()[0]));
@@ -111,14 +139,14 @@ class OF10ProviderManager extends ProviderNetworkManager {
     }
 
     private void removeLocalIngressTunnelBridgeRules(Node node, int tunnelOFPort, int internalVlan, int patchPort) {
-        String brIntId = InternalNetworkManager.getManager().getInternalBridgeUUID(node, AdminConfigManager.getManager().getTunnelBridgeName());
-        if (brIntId == null) {
+        String brNetId = internalNetworkManager.getInternalBridgeUUID(node, adminConfigManager.getNetworkBridgeName());
+        if (brNetId == null) {
             logger.error("Failed to remove Flow Rules for {}", node);
             return;
         }
         try {
             OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
-            Bridge bridge = (Bridge) ovsdbTable.getRow(node, Bridge.NAME.getName(), brIntId);
+            Bridge bridge = (Bridge) ovsdbTable.getRow(node, Bridge.NAME.getName(), brNetId);
             Set<String> dpids = bridge.getDatapath_id();
             if (dpids == null || dpids.size() ==  0) return;
             Long dpidLong = Long.valueOf(HexEncode.stringToLong((String)dpids.toArray()[0]));
@@ -141,14 +169,14 @@ class OF10ProviderManager extends ProviderNetworkManager {
      */
     private void programRemoteEgressTunnelBridgeRules(Node node, int patchPort, String attachedMac,
             int internalVlan, int tunnelOFPort) {
-        String brIntId = InternalNetworkManager.getManager().getInternalBridgeUUID(node, AdminConfigManager.getManager().getTunnelBridgeName());
-        if (brIntId == null) {
+        String brNetId = internalNetworkManager.getInternalBridgeUUID(node, adminConfigManager.getNetworkBridgeName());
+        if (brNetId == null) {
             logger.error("Failed to initialize Flow Rules for {}", node);
             return;
         }
         try {
             OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
-            Bridge bridge = (Bridge) ovsdbTable.getRow(node, Bridge.NAME.getName(), brIntId);
+            Bridge bridge = (Bridge) ovsdbTable.getRow(node, Bridge.NAME.getName(), brNetId);
             Set<String> dpids = bridge.getDatapath_id();
             if (dpids == null || dpids.size() ==  0) return;
             Long dpidLong = Long.valueOf(HexEncode.stringToLong((String)dpids.toArray()[0]));
@@ -175,14 +203,14 @@ class OF10ProviderManager extends ProviderNetworkManager {
 
     private void removeRemoteEgressTunnelBridgeRules(Node node, int patchPort, String attachedMac,
             int internalVlan, int tunnelOFPort) {
-        String brIntId = InternalNetworkManager.getManager().getInternalBridgeUUID(node, AdminConfigManager.getManager().getTunnelBridgeName());
-        if (brIntId == null) {
+        String brNetId = internalNetworkManager.getInternalBridgeUUID(node, adminConfigManager.getNetworkBridgeName());
+        if (brNetId == null) {
             logger.error("Failed to initialize Flow Rules for {}", node);
             return;
         }
         try {
             OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
-            Bridge bridge = (Bridge) ovsdbTable.getRow(node, Bridge.NAME.getName(), brIntId);
+            Bridge bridge = (Bridge) ovsdbTable.getRow(node, Bridge.NAME.getName(), brNetId);
             Set<String> dpids = bridge.getDatapath_id();
             if (dpids == null || dpids.size() ==  0) return;
             Long dpidLong = Long.valueOf(HexEncode.stringToLong((String)dpids.toArray()[0]));
@@ -203,14 +231,14 @@ class OF10ProviderManager extends ProviderNetworkManager {
      * Also perform the Strip-Vlan action.
      */
     private void programFloodEgressTunnelBridgeRules(Node node, int patchPort, int internalVlan, int tunnelOFPort) {
-        String brIntId = InternalNetworkManager.getManager().getInternalBridgeUUID(node, AdminConfigManager.getManager().getTunnelBridgeName());
-        if (brIntId == null) {
+        String brNetId = internalNetworkManager.getInternalBridgeUUID(node, adminConfigManager.getNetworkBridgeName());
+        if (brNetId == null) {
             logger.error("Failed to initialize Flow Rules for {}", node);
             return;
         }
         try {
             OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
-            Bridge bridge = (Bridge) ovsdbTable.getRow(node, Bridge.NAME.getName(), brIntId);
+            Bridge bridge = (Bridge) ovsdbTable.getRow(node, Bridge.NAME.getName(), brNetId);
             Set<String> dpids = bridge.getDatapath_id();
             if (dpids == null || dpids.size() ==  0) return;
             Long dpidLong = Long.valueOf(HexEncode.stringToLong((String)dpids.toArray()[0]));
@@ -257,14 +285,14 @@ class OF10ProviderManager extends ProviderNetworkManager {
     }
 
     private void removeFloodEgressTunnelBridgeRules(Node node, int patchPort, int internalVlan, int tunnelOFPort) {
-        String brIntId = InternalNetworkManager.getManager().getInternalBridgeUUID(node, AdminConfigManager.getManager().getTunnelBridgeName());
-        if (brIntId == null) {
+        String brNetId = internalNetworkManager.getInternalBridgeUUID(node, adminConfigManager.getNetworkBridgeName());
+        if (brNetId == null) {
             logger.error("Failed to remove Flow Rules for {}", node);
             return;
         }
         try {
             OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
-            Bridge bridge = (Bridge) ovsdbTable.getRow(node, Bridge.NAME.getName(), brIntId);
+            Bridge bridge = (Bridge) ovsdbTable.getRow(node, Bridge.NAME.getName(), brNetId);
             Set<String> dpids = bridge.getDatapath_id();
             if (dpids == null || dpids.size() ==  0) return;
             Long dpidLong = Long.valueOf(HexEncode.stringToLong((String)dpids.toArray()[0]));
@@ -291,12 +319,12 @@ class OF10ProviderManager extends ProviderNetworkManager {
 
     private void programTunnelRules (String tunnelType, String segmentationId, InetAddress dst, Node node,
                                      Interface intf, boolean local) {
-        String networkId = TenantNetworkManager.getManager().getNetworkIdForSegmentationId(segmentationId);
+        String networkId = tenantNetworkManager.getNetworkIdForSegmentationId(segmentationId);
         if (networkId == null) {
-            logger.debug("Tenant Network not found with Segmenation-id {}",segmentationId);
+            logger.debug("Tenant Network not found with Segmentation-id {}", segmentationId);
             return;
         }
-        int internalVlan = TenantNetworkManager.getManager().getInternalVlan(node, networkId);
+        int internalVlan = tenantNetworkManager.getInternalVlan(node, networkId);
         if (internalVlan == 0) {
             logger.debug("No InternalVlan provisioned for Tenant Network {}",networkId);
             return;
@@ -307,12 +335,12 @@ class OF10ProviderManager extends ProviderNetworkManager {
             return;
         }
 
-        String attachedMac = externalIds.get(TenantNetworkManager.EXTERNAL_ID_VM_MAC);
+        String attachedMac = externalIds.get(ITenantNetworkManager.EXTERNAL_ID_VM_MAC);
         if (attachedMac == null) {
             logger.error("No AttachedMac seen in {}", intf);
             return;
         }
-        String patchInt = AdminConfigManager.getManager().getPatchToIntegration();
+        String patchInt = adminConfigManager.getPatchToIntegration();
 
         int patchOFPort = -1;
         try {
@@ -367,12 +395,12 @@ class OF10ProviderManager extends ProviderNetworkManager {
 
     private void removeTunnelRules (String tunnelType, String segmentationId, InetAddress dst, Node node,
             Interface intf, boolean local) {
-        String networkId = TenantNetworkManager.getManager().getNetworkIdForSegmentationId(segmentationId);
+        String networkId = tenantNetworkManager.getNetworkIdForSegmentationId(segmentationId);
         if (networkId == null) {
-            logger.debug("Tenant Network not found with Segmenation-id {}",segmentationId);
+            logger.debug("Tenant Network not found with Segmentation-id {}",segmentationId);
             return;
         }
-        int internalVlan = TenantNetworkManager.getManager().getInternalVlan(node,networkId);
+        int internalVlan = tenantNetworkManager.getInternalVlan(node,networkId);
         if (internalVlan == 0) {
             logger.debug("No InternalVlan provisioned for Tenant Network {}",networkId);
             return;
@@ -383,12 +411,12 @@ class OF10ProviderManager extends ProviderNetworkManager {
             return;
         }
 
-        String attachedMac = externalIds.get(TenantNetworkManager.EXTERNAL_ID_VM_MAC);
+        String attachedMac = externalIds.get(ITenantNetworkManager.EXTERNAL_ID_VM_MAC);
         if (attachedMac == null) {
             logger.error("No AttachedMac seen in {}", intf);
             return;
         }
-        String patchInt = AdminConfigManager.getManager().getPatchToIntegration();
+        String patchInt = adminConfigManager.getPatchToIntegration();
 
         int patchOFPort = -1;
         try {
@@ -441,48 +469,376 @@ class OF10ProviderManager extends ProviderNetworkManager {
         }
     }
 
+    private String getIntModVlanFlowName (int inOFPort, String fromVlan, String toVlan) {
+        return "int_mod_"+inOFPort+"_"+fromVlan+"_"+toVlan;
+    }
+
+    private String getIntDropFlowName (int inOFPort) {
+        return "int_drop_"+inOFPort;
+    }
+
+    private String getNetModVlanFlowName (int inOFPort, String fromVlan, String toVlan) {
+        return "net_mod_"+inOFPort+"_"+fromVlan+"_"+toVlan;
+    }
+
+    private String getNetDropFlowName (int inOFPort) {
+        return "net_drop_"+inOFPort;
+    }
+
+    private String getNetFwdFlowName (int inOFPort, int outOFPort, String vlan) {
+        return "net_fwd_"+vlan+"_"+inOFPort+"_"+outOFPort;
+    }
+
+    private void deleteRule (Node node, Node ofNode, String flowName) {
+        logger.debug("deleteRule: node: {} / {}, flowName: {}", node, ofNode, flowName);
+
+        try {
+            this.deleteStaticFlow(ofNode, flowName);
+        } catch (Exception e) {
+            logger.error("deleteRule: Failed to delete Flow Rule for {} / {}", node, ofNode, e);
+        }
+    }
+
+    /* in_port=p actions=drop */
+    private void programDropRule (Node node, Node ofNode, int inOFPort, String flowName) {
+        logger.debug("programDropRule: node: {} / {}, inOfPort: {}, flowName: {}",
+                node, ofNode, inOFPort, flowName);
+
+        try {
+            FlowConfig flow = new FlowConfig();
+            flow.setName(flowName);
+            flow.setNode(ofNode);
+            flow.setInstallInHw(true);
+            flow.setPriority(DROP_FLOW_PRIORITY+"");
+            flow.setIngressPort(inOFPort+"");
+            List<String> actions = new ArrayList<String>();
+            actions.add(ActionType.DROP+"");
+            flow.setActions(actions);
+            Status status = this.addStaticFlow(ofNode, flow);
+            logger.debug("programDropRule: Flow Programming Status {} for Flow {} on {} / {}",
+                    status, flow, node, ofNode);
+        } catch (Exception e) {
+            logger.error("programDropRule: Failed to initialize Flow Rules for {} / {}", node, ofNode, e);
+        }
+    }
+
+    /* in_port=p2,dl_vlan=v actions=mod_vlan_vid,[NORMAL|output:p2] */
+    private void programModVlanRule (Node node, Node ofNode, int inOFPort, int outOFPort, String fromVlan,
+                                     String toVlan, String flowName) {
+        logger.debug("programModVlanRule: node: {} / {}, inOfPort: {}, fromVlan: {}, toVlan: {}, flowName: {}",
+                node, ofNode, inOFPort, fromVlan, toVlan, flowName);
+
+        try {
+            FlowConfig flow = new FlowConfig();
+            flow.setName(flowName);
+            flow.setNode(ofNode);
+            flow.setInstallInHw(true);
+            flow.setPriority(INGRESS_TUNNEL_FLOW_PRIORITY+"");
+            flow.setIngressPort(inOFPort+"");
+            flow.setVlanId(fromVlan);
+            List<String> actions = new ArrayList<String>();
+            actions.add(ActionType.SET_VLAN_ID+"="+toVlan);
+            if (outOFPort == -1) {
+                actions.add(ActionType.HW_PATH.toString());
+            } else {
+                actions.add(ActionType.OUTPUT.toString()+"="+outOFPort);
+            }
+            flow.setActions(actions);
+            Status status = this.addStaticFlow(ofNode, flow);
+            logger.debug("programModVlanRule: Flow Programming Status {} for Flow {} on {} / {}",
+                    status, flow, node, ofNode);
+        } catch (Exception e) {
+            logger.error("programModVlanRule: Failed to initialize Flow Rule for {} / {}", node, ofNode, e);
+        }
+    }
+
+    /* in_port=p1,dl_vlan=v actions=output:p2 */
+    private void programForwardRule (Node node, Node ofNode, int inOFPort, int outOFPort, String vlan, String flowName) {
+        logger.debug("programModVlanRule: node: {} / {}, inOfPort: {}, outOFPort: {}, flowName: {}",
+                node, ofNode, inOFPort, outOFPort, flowName);
+
+        try {
+            FlowConfig flow = new FlowConfig();
+            flow.setName(flowName);
+            flow.setNode(ofNode);
+            flow.setInstallInHw(true);
+            flow.setPriority(EGRESS_TUNNEL_FLOW_PRIORITY + "");
+            flow.setIngressPort(inOFPort + "");
+            flow.setVlanId(vlan);
+            List<String> actions = new ArrayList<String>();
+            actions.add(ActionType.OUTPUT.toString()+"="+outOFPort);
+            flow.setActions(actions);
+            Status status = this.addStaticFlow(ofNode, flow);
+            logger.debug("programForwardRule: Flow Programming Status {} for Flow {} on {} / {}",
+                    status, flow, node, ofNode);
+        } catch (Exception e) {
+            logger.error("programForwardRule: Failed to initialize Flow Rules for {} / {}", node, ofNode, e);
+        }
+    }
+
+    public int getOFPort (Node node, String portName) {
+        int ofPort = -1;
+        try {
+            OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
+            Map<String, Table<?>> intfs = ovsdbTable.getRows(node, Interface.NAME.getName());
+            if (intfs != null) {
+                for (Table<?> row : intfs.values()) {
+                    Interface intf = (Interface)row;
+                    if (intf.getName().equalsIgnoreCase(portName)) {
+                        Set<BigInteger> of_ports = intf.getOfport();
+                        if (of_ports == null || of_ports.size() <= 0) {
+                            logger.error("Could not identify patch port {} on {}", portName, node);
+                            continue;
+                        }
+                        ofPort = Long.valueOf(((BigInteger)of_ports.toArray()[0]).longValue()).intValue();
+                        logger.debug("Identified port {} -> OF ({}) on {}", portName, ofPort, node);
+                        break;
+                    }
+                }
+            }
+        } catch (Exception e) {
+            logger.error("", e);
+        }
+
+        return ofPort;
+    }
+
+    /*
+     * Transient class to return all the vlan network data needed for flow programming.
+     */
+    public class vlanNet {
+        public int patchIntOfPort;
+        public int patchNetOfPort;
+        public int physicalOfPort;
+        public int internalVlan;
+
+        public vlanNet (NeutronNetwork network, Node node, Interface intf) {
+            patchIntOfPort = -1;
+            patchNetOfPort = -1;
+            physicalOfPort = -1;
+            internalVlan = 0;
+
+            initializeVlanNet(network, node, intf);
+        }
+
+        public boolean isValid () {
+            if ((patchIntOfPort != -1) && (patchNetOfPort != -1) && (physicalOfPort != -1) && (internalVlan != -1)) {
+                return true;
+            } else {
+                return false;
+            }
+        }
+
+        public int getPatchIntOfPort () {
+            return patchIntOfPort;
+        }
+
+        public int getPatchNetOfPort () {
+            return patchNetOfPort;
+        }
+
+        public int getphysicalOfPort () {
+            return physicalOfPort;
+        }
+
+        public int getInternalVlan () {
+            return internalVlan;
+        }
+
+        public void initializeVlanNet (NeutronNetwork network, Node node, Interface intf) {
+            internalVlan = tenantNetworkManager.getInternalVlan(node, network.getNetworkUUID());
+            if (internalVlan == 0) {
+                logger.debug("No InternalVlan provisioned for Tenant Network {}", network.getNetworkUUID());
+                return;
+            }
+
+            /* Get ofports for patch ports and physical interface. */
+            String patchToNetworkName = adminConfigManager.getPatchToNetwork();
+            String patchToIntegrationName = adminConfigManager.getPatchToIntegration();
+            String physNetName = adminConfigManager.getPhysicalInterfaceName(node, network.getProviderPhysicalNetwork());
+
+            patchIntOfPort = getOFPort(node, patchToNetworkName);
+            if (patchIntOfPort == -1) {
+                logger.error("Cannot identify {} interface on {}", patchToNetworkName, node);
+                return;
+            }
+
+            patchNetOfPort = getOFPort(node, patchToIntegrationName);
+            if (patchNetOfPort == -1) {
+                logger.error("Cannot identify {} interface on {}", patchToIntegrationName, node);
+                return;
+            }
+
+            physicalOfPort = getOFPort(node, physNetName);
+            if (physicalOfPort == -1) {
+                logger.error("Cannot identify {} interface on {}", physNetName, node);
+                return;
+            }
+        }
+    }
+
+    private Node getOFNode (Node node, String bridgeName) {
+        String brUUID = internalNetworkManager.getInternalBridgeUUID(node, bridgeName);
+        if (brUUID == null) {
+            logger.error("getOFNode: Unable to find {} UUID on node {}", bridgeName, node);
+            return null;
+        }
+
+        try {
+            OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
+            Bridge bridge = (Bridge) ovsdbTable.getRow(node, Bridge.NAME.getName(), brUUID);
+            Set<String> dpids = bridge.getDatapath_id();
+            if (dpids == null || dpids.size() ==  0) {
+                return null;
+            }
+            Long dpidLong = Long.valueOf(HexEncode.stringToLong((String)dpids.toArray()[0]));
+            Node ofNode = new Node(Node.NodeIDType.OPENFLOW, dpidLong);
+            return ofNode;
+        } catch (Exception e) {
+            logger.error("deleteRule: Failed to delete Flow Rule for {}", node, e);
+        }
+
+        return null;
+    }
+
+    /*
+     * Vlan isolation uses a patch port between br-int and br-net. Anything received on one end of
+     * the patch is piped to the other end of the patch so the incoming packets from the network would
+     * arrive untouched at the patch port on br-int.
+     *
+     * Program OF1.0 Flow rules on br-net in the ingress direction from the network
+     * and egress direction towards the network.
+     * The logic is to simply match on the incoming patch OF-Port and internal vlan,
+     * rewrite the internal vlan to the external vlan and forward out the physical port.
+     * There is also a flow to match the externally tagged packets from the physical port
+     * rewrite the external tag to the internal tag and forward to the patch port.
+     *
+     * priority=100,in_port=1,dl_vlan=1 actions=mod_vlan_vid:2001,output:2
+     * priority=100,in_port=2,dl_vlan=2001 actions=mod_vlan_vid:1actions=output:1
+     */
+
+    private void programVlanRules (NeutronNetwork network, Node node, Interface intf) {
+        vlanNet vlanNet = new vlanNet(network, node, intf);
+        if (vlanNet.isValid()) {
+            String netBrName = adminConfigManager.getNetworkBridgeName();
+            String intModVlanFlowName = getIntModVlanFlowName(vlanNet.getPatchNetOfPort(), network.getProviderSegmentationID(), vlanNet.getInternalVlan()+"");
+            String netModVlanFlowName = getNetModVlanFlowName(vlanNet.getPatchNetOfPort(), vlanNet.getInternalVlan()+"", network.getProviderSegmentationID());
+
+            Node netOFNode = getOFNode(node, netBrName);
+            if (netOFNode == null) {
+                logger.error("Unable to find {} ofNode, Failed to initialize Flow Rules for {}", netBrName, node);
+                return;
+            }
+
+            /* Program flows on br-net */
+            deleteRule(node, netOFNode, "NORMAL");
+            programModVlanRule(node, netOFNode, vlanNet.getPatchNetOfPort(), vlanNet.getphysicalOfPort(),
+                    vlanNet.getInternalVlan()+"", network.getProviderSegmentationID(), intModVlanFlowName);
+            programModVlanRule(node, netOFNode, vlanNet.getphysicalOfPort(), vlanNet.getPatchNetOfPort(),
+                    network.getProviderSegmentationID(), vlanNet.getInternalVlan()+"", netModVlanFlowName);
+        }
+    }
+
+    private void removeVlanRules (NeutronNetwork network, Node node, Interface intf) {
+        vlanNet vlanNet = new vlanNet(network, node, intf);
+        if (vlanNet.isValid()) {
+            String netBrName = adminConfigManager.getNetworkBridgeName();
+            String intModVlanFlowName = getIntModVlanFlowName(vlanNet.getPatchNetOfPort(), network.getProviderSegmentationID(), vlanNet.getInternalVlan()+"");
+            String netModVlanFlowName = getNetModVlanFlowName(vlanNet.getPatchNetOfPort(), vlanNet.getInternalVlan()+"", network.getProviderSegmentationID());
+
+            Node netOFNode = getOFNode(node, netBrName);
+            if (netOFNode == null) {
+                logger.error("Unable to find {} ofNode, Failed to initialize Flow Rules for {}", netBrName, node);
+                return;
+            }
+
+            deleteRule(node, netOFNode, intModVlanFlowName);
+            deleteRule(node, netOFNode, netModVlanFlowName);
+        }
+    }
+
     @Override
-    public Status handleInterfaceUpdate(String tunnelType, String tunnelKey, Node srcNode, Interface intf) {
-        Status status = getTunnelReadinessStatus(srcNode, tunnelKey);
-        if (!status.isSuccess()) return status;
+    public Status handleInterfaceUpdate(NeutronNetwork network, Node srcNode, Interface intf) {
+        logger.debug("handleInterfaceUpdate: networkType: {}, segmentationId: {}, srcNode: {}, intf: {}",
+                     network.getProviderNetworkType(), network.getProviderSegmentationID(), srcNode, intf.getName());
 
-        IConnectionServiceInternal connectionService = (IConnectionServiceInternal)ServiceHelper.getGlobalInstance(IConnectionServiceInternal.class, this);
-        List<Node> nodes = connectionService.getNodes();
-        nodes.remove(srcNode);
-        for (Node dstNode : nodes) {
-            status = getTunnelReadinessStatus(dstNode, tunnelKey);
-            if (!status.isSuccess()) continue;
-            InetAddress src = AdminConfigManager.getManager().getTunnelEndPoint(srcNode);
-            InetAddress dst = AdminConfigManager.getManager().getTunnelEndPoint(dstNode);
-            status = addTunnelPort(srcNode, tunnelType, src, dst, tunnelKey);
-            if (status.isSuccess()) {
-                this.programTunnelRules(tunnelType, tunnelKey, dst, srcNode, intf, true);
+        if (network.getProviderNetworkType().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VLAN)) {
+            Status status = getVlanReadinessStatus(srcNode, network.getProviderSegmentationID());
+            if (!status.isSuccess()) {
+                return status;
+            } else {
+                this.programVlanRules(network, srcNode, intf);
+                return new Status(StatusCode.SUCCESS);
             }
-            addTunnelPort(dstNode, tunnelType, dst, src, tunnelKey);
-            if (status.isSuccess()) {
-                this.programTunnelRules(tunnelType, tunnelKey, src, dstNode, intf, false);
+        } else if (network.getProviderNetworkType().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VXLAN) ||
+                   network.getProviderNetworkType().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_GRE)) {
+            Status status = getTunnelReadinessStatus(srcNode, network.getProviderSegmentationID());
+            if (!status.isSuccess()) return status;
+
+            IConnectionServiceInternal connectionService = (IConnectionServiceInternal)ServiceHelper.getGlobalInstance(IConnectionServiceInternal.class, this);
+            List<Node> nodes = connectionService.getNodes();
+            nodes.remove(srcNode);
+            for (Node dstNode : nodes) {
+                status = getTunnelReadinessStatus(dstNode, network.getProviderSegmentationID());
+                if (!status.isSuccess()) continue;
+                InetAddress src = adminConfigManager.getTunnelEndPoint(srcNode);
+                InetAddress dst = adminConfigManager.getTunnelEndPoint(dstNode);
+                status = addTunnelPort(srcNode, network.getProviderNetworkType(), src, dst, network.getProviderSegmentationID());
+                if (status.isSuccess()) {
+                    this.programTunnelRules(network.getProviderNetworkType(), network.getProviderSegmentationID(), dst, srcNode, intf, true);
+                }
+                addTunnelPort(dstNode, network.getProviderNetworkType(), dst, src, network.getProviderSegmentationID());
+                if (status.isSuccess()) {
+                    this.programTunnelRules(network.getProviderNetworkType(), network.getProviderSegmentationID(), src, dstNode, intf, false);
+                }
             }
+            return new Status(StatusCode.SUCCESS);
+        } else {
+            return new Status(StatusCode.BADREQUEST);
         }
-        return new Status(StatusCode.SUCCESS);
     }
 
     @Override
-    public Status handleInterfaceDelete(String tunnelType, String tunnelKey, Node srcNode, Interface intf, boolean isLastInstanceOnNode) {
+    public Status handleInterfaceDelete(String tunnelType, NeutronNetwork network, Node srcNode, Interface intf, boolean isLastInstanceOnNode) {
         Status status = new Status(StatusCode.SUCCESS);
+        logger.debug("handleInterfaceDelete: srcNode: {}, networkType: {}, intf: {}, type: {}, isLast: {}",
+                srcNode, (network != null) ? network.getProviderNetworkType() : "",
+                intf.getName(), intf.getType(), isLastInstanceOnNode);
 
-        IConnectionServiceInternal connectionService = (IConnectionServiceInternal)ServiceHelper.getGlobalInstance(IConnectionServiceInternal.class, this);
-        List<Node> nodes = connectionService.getNodes();
-        nodes.remove(srcNode);
-        for (Node dstNode : nodes) {
-            InetAddress src = AdminConfigManager.getManager().getTunnelEndPoint(srcNode);
-            InetAddress dst = AdminConfigManager.getManager().getTunnelEndPoint(dstNode);
-            this.removeTunnelRules(tunnelType, tunnelKey, dst, srcNode, intf, true);
+        List<String> phyIfName = adminConfigManager.getAllPhysicalInterfaceNames(srcNode);
+        if ((network != null) && network.getProviderNetworkType().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VLAN)) {
             if (isLastInstanceOnNode) {
-                status = deleteTunnelPort(srcNode, tunnelType, src, dst, tunnelKey);
+                this.removeVlanRules(network, srcNode, intf);
             }
-            this.removeTunnelRules(tunnelType, tunnelKey, src, dstNode, intf, false);
-            if (status.isSuccess() && isLastInstanceOnNode) {
-                deleteTunnelPort(dstNode, tunnelType, dst, src, tunnelKey);
+        } else if (intf.getType().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VXLAN) || intf.getType().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_GRE)) {
+            /* Delete tunnel port */
+            try {
+                OvsDBMap<String, String> options = intf.getOptions();
+                InetAddress src = InetAddress.getByName(options.get("local_ip"));
+                InetAddress dst = InetAddress.getByName(options.get("remote_ip"));
+                String key = options.get("key");
+                status = deleteTunnelPort(srcNode, intf.getType(), src, dst, key);
+            } catch (Exception e) {
+                logger.error(e.getMessage(), e);
+            }
+        } else if (phyIfName.contains(intf.getName())) {
+            deletePhysicalPort(srcNode, intf.getName());
+        } else {
+            /* delete all other interfaces */
+            IConnectionServiceInternal connectionService = (IConnectionServiceInternal)ServiceHelper.getGlobalInstance(IConnectionServiceInternal.class, this);
+            List<Node> nodes = connectionService.getNodes();
+            nodes.remove(srcNode);
+            for (Node dstNode : nodes) {
+                InetAddress src = adminConfigManager.getTunnelEndPoint(srcNode);
+                InetAddress dst = adminConfigManager.getTunnelEndPoint(dstNode);
+                this.removeTunnelRules(network.getProviderNetworkType(), network.getProviderSegmentationID(), dst, srcNode, intf, true);
+                if (isLastInstanceOnNode) {
+                    status = deleteTunnelPort(srcNode, network.getProviderNetworkType(), src, dst, network.getProviderSegmentationID());
+                }
+                this.removeTunnelRules(network.getProviderNetworkType(), network.getProviderSegmentationID(), src, dstNode, intf, false);
+                if (status.isSuccess() && isLastInstanceOnNode) {
+                    deleteTunnelPort(dstNode, network.getProviderNetworkType(), dst, src, network.getProviderSegmentationID());
+                }
             }
         }
         return status;
@@ -524,14 +880,14 @@ class OF10ProviderManager extends ProviderNetworkManager {
         return false;
     }
 
-    private String getTunnelPortUuid(Node node, String tunnelName, String bridgeUUID) throws Exception {
+    private String getPortUuid(Node node, String portName, String bridgeUUID) throws Exception {
         OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
         Bridge bridge = (Bridge)ovsdbTable.getRow(node, Bridge.NAME.getName(), bridgeUUID);
         if (bridge != null) {
             Set<UUID> ports = bridge.getPorts();
             for (UUID portUUID : ports) {
                 Port port = (Port)ovsdbTable.getRow(node, Port.NAME.getName(), portUUID.toString());
-                if (port != null && port.getName().equalsIgnoreCase(tunnelName)) return portUUID.toString();
+                if (port != null && port.getName().equalsIgnoreCase(portName)) return portUUID.toString();
             }
         }
         return null;
@@ -540,7 +896,7 @@ class OF10ProviderManager extends ProviderNetworkManager {
     private Status addTunnelPort (Node node, String tunnelType, InetAddress src, InetAddress dst, String key) {
         try {
             String bridgeUUID = null;
-            String tunnelBridgeName = AdminConfigManager.getManager().getTunnelBridgeName();
+            String tunnelBridgeName = adminConfigManager.getNetworkBridgeName();
             OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
             Map<String, Table<?>> bridgeTable = ovsdbTable.getRows(node, Bridge.NAME.getName());
             if (bridgeTable != null) {
@@ -609,34 +965,34 @@ class OF10ProviderManager extends ProviderNetworkManager {
         }
     }
 
-    private Status deleteTunnelPort (Node node, String tunnelType, InetAddress src, InetAddress dst, String key) {
+    private Status deletePort(Node node, String bridgeName, String portName) {
         try {
             String bridgeUUID = null;
-            String tunnelBridgeName = AdminConfigManager.getManager().getTunnelBridgeName();
             OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
             Map<String, Table<?>> bridgeTable = ovsdbTable.getRows(node, Bridge.NAME.getName());
             if (bridgeTable != null) {
                 for (String uuid : bridgeTable.keySet()) {
                     Bridge bridge = (Bridge)bridgeTable.get(uuid);
-                    if (bridge.getName().equals(tunnelBridgeName)) {
+                    if (bridge.getName().equals(bridgeName)) {
                         bridgeUUID = uuid;
                         break;
                     }
                 }
             }
             if (bridgeUUID == null) {
-                logger.debug("Could not find Bridge {} in {}", tunnelBridgeName, node);
+                logger.debug("Could not find Bridge {} in {}", bridgeName, node);
                 return new Status(StatusCode.SUCCESS);
             }
-            String portName = getTunnelName(tunnelType, key, dst);
-            String tunnelPortUUID = this.getTunnelPortUuid(node, portName, bridgeUUID);
-            Status status = ovsdbTable.deleteRow(node, Port.NAME.getName(), tunnelPortUUID);
-            if (!status.isSuccess()) {
-                logger.error("Failed to delete Tunnel port {} in {} status : {}", portName, bridgeUUID, status);
-                return status;
+            String portUUID = this.getPortUuid(node, portName, bridgeUUID);
+            Status status = new Status(StatusCode.SUCCESS);
+            if (portUUID != null) {
+                status = ovsdbTable.deleteRow(node, Port.NAME.getName(), portUUID);
+                if (!status.isSuccess()) {
+                    logger.error("Failed to delete port {} in {} status : {}", portName, bridgeUUID, status);
+                    return status;
+                }
+                logger.debug("Port {} delete status : {}", portName, status);
             }
-
-            logger.debug("Tunnel {} delete status : {}", portName, status);
             return status;
         } catch (Exception e) {
             logger.error("Exception in deleteTunnelPort", e);
@@ -644,27 +1000,39 @@ class OF10ProviderManager extends ProviderNetworkManager {
         }
     }
 
+    private Status deleteTunnelPort (Node node, String tunnelType, InetAddress src, InetAddress dst, String key) {
+        String tunnelBridgeName = adminConfigManager.getNetworkBridgeName();
+        String portName = getTunnelName(tunnelType, key, dst);
+        Status status = deletePort(node, tunnelBridgeName, portName);
+        return status;
+    }
+
+    private Status deletePhysicalPort(Node node, String phyIntfName) {
+        String netBridgeName = adminConfigManager.getNetworkBridgeName();
+        Status status = deletePort(node, netBridgeName, phyIntfName);
+        return status;
+    }
+
     @Override
     public Status handleInterfaceUpdate(String tunnelType, String tunnelKey) {
         IConnectionServiceInternal connectionService = (IConnectionServiceInternal)ServiceHelper.getGlobalInstance(IConnectionServiceInternal.class, this);
         List<Node> nodes = connectionService.getNodes();
         for (Node srcNode : nodes) {
-            this.handleInterfaceUpdate(tunnelType, tunnelKey, srcNode, null);
+            this.handleInterfaceUpdate(null, srcNode, null);
         }
         return new Status(StatusCode.SUCCESS);
     }
 
     @Override
     public void initializeFlowRules(Node node) {
-        this.initializeFlowRules(node, AdminConfigManager.getManager().getIntegrationBridgeName());
-        this.initializeFlowRules(node, AdminConfigManager.getManager().getTunnelBridgeName());
-        this.initializeFlowRules(node, AdminConfigManager.getManager().getExternalBridgeName());
+        this.initializeFlowRules(node, adminConfigManager.getIntegrationBridgeName());
+        this.initializeFlowRules(node, adminConfigManager.getExternalBridgeName());
     }
 
     private void initializeFlowRules(Node node, String bridgeName) {
         String brIntId = this.getInternalBridgeUUID(node, bridgeName);
         if (brIntId == null) {
-            if (bridgeName == AdminConfigManager.getManager().getExternalBridgeName()){
+            if (bridgeName == adminConfigManager.getExternalBridgeName()){
                 logger.debug("Failed to initialize Flow Rules for bridge {} on node {}. Is the Neutron L3 agent running on this node?");
             }
             else {
@@ -750,8 +1118,25 @@ class OF10ProviderManager extends ProviderNetworkManager {
         IForwardingRulesManager frm = (IForwardingRulesManager) ServiceHelper.getInstance(
                 IForwardingRulesManager.class, "default", this);
         if (frm.getStaticFlow(flowName, ofNode) == null) {
-            logger.debug("Flow doese not exist {} on {}. Skipping deletion.", flowName, ofNode);
+            logger.debug("Flow does not exist {} on {}. Skipping deletion.", flowName, ofNode);
             return new Status(StatusCode.SUCCESS);
         }
         return frm.removeStaticFlow(flowName,ofNode);
-    }}
+    }
+
+    private String getInternalBridgeUUID (Node node, String bridgeName) {
+        try {
+            OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
+            Map<String, Table<?>> bridgeTable = ovsdbTable.getRows(node, Bridge.NAME.getName());
+            if (bridgeTable == null) return null;
+            for (String key : bridgeTable.keySet()) {
+                Bridge bridge = (Bridge)bridgeTable.get(key);
+                if (bridge.getName().equals(bridgeName)) return key;
+            }
+        } catch (Exception e) {
+            logger.error("Error getting Bridge Identifier for {} / {}", node, bridgeName, e);
+        }
+        return null;
+    }
+
+}
diff --git a/neutron/src/main/java/org/opendaylight/ovsdb/neutron/provider/OF13Provider.java b/neutron/src/main/java/org/opendaylight/ovsdb/neutron/provider/OF13Provider.java
new file mode 100644 (file)
index 0000000..c6cd259
--- /dev/null
@@ -0,0 +1,4078 @@
+/**
+ * Copyright (C) 2013 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal, Brent Salisbury, Dave Tucker
+ */
+package org.opendaylight.ovsdb.neutron.provider;
+
+import java.math.BigInteger;
+import java.net.InetAddress;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+
+import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
+import org.opendaylight.controller.md.sal.common.api.data.DataModification;
+import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork;
+import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.utils.HexEncode;
+import org.opendaylight.controller.sal.utils.ServiceHelper;
+import org.opendaylight.controller.sal.utils.Status;
+import org.opendaylight.controller.sal.utils.StatusCode;
+import org.opendaylight.controller.switchmanager.ISwitchManager;
+import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
+import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.table.Bridge;
+import org.opendaylight.ovsdb.lib.table.Interface;
+import org.opendaylight.ovsdb.lib.table.Port;
+import org.opendaylight.ovsdb.neutron.IAdminConfigManager;
+import org.opendaylight.ovsdb.neutron.IInternalNetworkManager;
+import org.opendaylight.ovsdb.neutron.IMDSALConsumer;
+import org.opendaylight.ovsdb.neutron.NetworkHandler;
+import org.opendaylight.ovsdb.neutron.ITenantNetworkManager;
+import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
+import org.opendaylight.ovsdb.plugin.OVSDBConfigService;
+import org.opendaylight.ovsdb.plugin.StatusWithUuid;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecNwTtlCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DropActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwDstActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtlBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.group.action._case.GroupActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.vlan.action._case.PushVlanActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.vlan.action._case.PopVlanActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.field._case.SetFieldBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.dst.action._case.SetNwDstActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.src.action._case.SetNwSrcActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.id.action._case.SetVlanIdActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.GoToTableCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.go.to.table._case.GoToTableBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.BucketId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.BucketsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.BucketBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.BucketKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.Buckets;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpSourceHardwareAddressBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpTargetHardwareAddressBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TunnelBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ *
+ */
+public class OF13Provider implements NetworkProvider {
+    private static final Logger logger = LoggerFactory.getLogger(OF13Provider.class);
+    private DataBrokerService dataBrokerService;
+    private static final short TABLE_0_DEFAULT_INGRESS = 0;
+    private static final short TABLE_1_ISOLATE_TENANT = 10;
+    private static final short TABLE_2_LOCAL_FORWARD = 20;
+    private static Long groupId = 1L;
+
+    private IAdminConfigManager adminConfigManager;
+    private IInternalNetworkManager internalNetworkManager;
+    private ITenantNetworkManager tenantNetworkManager;
+
+    public OF13Provider(IAdminConfigManager adminConfigManager,
+                        IInternalNetworkManager internalNetworkManager,
+                        ITenantNetworkManager tenantNetworkManager) {
+        this.adminConfigManager = adminConfigManager;
+        this.internalNetworkManager = internalNetworkManager;
+        this.tenantNetworkManager = tenantNetworkManager;
+    }
+
+    @Override
+    public boolean hasPerTenantTunneling() {
+        return false;
+    }
+
+    private Status getTunnelReadinessStatus (Node node, String tunnelKey) {
+        InetAddress srcTunnelEndPoint = adminConfigManager.getTunnelEndPoint(node);
+        if (srcTunnelEndPoint == null) {
+            logger.error("Tunnel Endpoint not configured for Node {}", node);
+            return new Status(StatusCode.NOTFOUND, "Tunnel Endpoint not configured for "+ node);
+        }
+
+        if (!internalNetworkManager.isInternalNetworkNeutronReady(node)) {
+            logger.error(node+" is not Overlay ready");
+            return new Status(StatusCode.NOTACCEPTABLE, node+" is not Overlay ready");
+        }
+
+        if (!tenantNetworkManager.isTenantNetworkPresentInNode(node, tunnelKey)) {
+            logger.debug(node+" has no VM corresponding to segment "+ tunnelKey);
+            return new Status(StatusCode.NOTACCEPTABLE, node+" has no VM corresponding to segment "+ tunnelKey);
+        }
+        return new Status(StatusCode.SUCCESS);
+    }
+
+    private String getTunnelName(String tunnelType, InetAddress dst) {
+        return tunnelType+"-"+dst.getHostAddress();
+    }
+
+    private boolean isTunnelPresent(Node node, String tunnelName, String bridgeUUID) throws Exception {
+        OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
+        Bridge bridge = (Bridge)ovsdbTable.getRow(node, Bridge.NAME.getName(), bridgeUUID);
+        if (bridge != null) {
+            Set<UUID> ports = bridge.getPorts();
+            for (UUID portUUID : ports) {
+                Port port = (Port)ovsdbTable.getRow(node, Port.NAME.getName(), portUUID.toString());
+                if (port != null && port.getName().equalsIgnoreCase(tunnelName)) return true;
+            }
+        }
+        return false;
+    }
+
+    private String getPortUuid(Node node, String name, String bridgeUUID) throws Exception {
+        OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
+        Bridge bridge = (Bridge)ovsdbTable.getRow(node, Bridge.NAME.getName(), bridgeUUID);
+        if (bridge != null) {
+            Set<UUID> ports = bridge.getPorts();
+            for (UUID portUUID : ports) {
+                Port port = (Port)ovsdbTable.getRow(node, Port.NAME.getName(), portUUID.toString());
+                if (port != null && port.getName().equalsIgnoreCase(name)) return portUUID.toString();
+            }
+        }
+        return null;
+    }
+
+    private Status addTunnelPort (Node node, String tunnelType, InetAddress src, InetAddress dst) {
+        try {
+            String bridgeUUID = null;
+            String tunnelBridgeName = adminConfigManager.getIntegrationBridgeName();
+            OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
+            Map<String, org.opendaylight.ovsdb.lib.table.Table<?>> bridgeTable = ovsdbTable.getRows(node, Bridge.NAME.getName());
+            if (bridgeTable != null) {
+                for (String uuid : bridgeTable.keySet()) {
+                    Bridge bridge = (Bridge)bridgeTable.get(uuid);
+                    if (bridge.getName().equals(tunnelBridgeName)) {
+                        bridgeUUID = uuid;
+                        break;
+                    }
+                }
+            }
+            if (bridgeUUID == null) {
+                logger.error("Could not find Bridge {} in {}", tunnelBridgeName, node);
+                return new Status(StatusCode.NOTFOUND, "Could not find "+tunnelBridgeName+" in "+node);
+            }
+            String portName = getTunnelName(tunnelType, dst);
+
+            if (this.isTunnelPresent(node, portName, bridgeUUID)) {
+                logger.trace("Tunnel {} is present in {} of {}", portName, tunnelBridgeName, node);
+                return new Status(StatusCode.SUCCESS);
+            }
+
+            Port tunnelPort = new Port();
+            tunnelPort.setName(portName);
+            StatusWithUuid statusWithUuid = ovsdbTable.insertRow(node, Port.NAME.getName(), bridgeUUID, tunnelPort);
+            if (!statusWithUuid.isSuccess()) {
+                logger.error("Failed to insert Tunnel port {} in {}", portName, bridgeUUID);
+                return statusWithUuid;
+            }
+
+            String tunnelPortUUID = statusWithUuid.getUuid().toString();
+            String interfaceUUID = null;
+            int timeout = 6;
+            while ((interfaceUUID == null) && (timeout > 0)) {
+                tunnelPort = (Port)ovsdbTable.getRow(node, Port.NAME.getName(), tunnelPortUUID);
+                OvsDBSet<UUID> interfaces = tunnelPort.getInterfaces();
+                if (interfaces == null || interfaces.size() == 0) {
+                    // Wait for the OVSDB update to sync up the Local cache.
+                    Thread.sleep(500);
+                    timeout--;
+                    continue;
+                }
+                interfaceUUID = interfaces.toArray()[0].toString();
+                Interface intf = (Interface)ovsdbTable.getRow(node, Interface.NAME.getName(), interfaceUUID);
+                if (intf == null) interfaceUUID = null;
+            }
+
+            if (interfaceUUID == null) {
+                logger.error("Cannot identify Tunnel Interface for port {}/{}", portName, tunnelPortUUID);
+                return new Status(StatusCode.INTERNALERROR);
+            }
+
+            Interface tunInterface = new Interface();
+            tunInterface.setType(tunnelType);
+            OvsDBMap<String, String> options = new OvsDBMap<String, String>();
+            options.put("key", "flow");
+            options.put("local_ip", src.getHostAddress());
+            options.put("remote_ip", dst.getHostAddress());
+            tunInterface.setOptions(options);
+            Status status = ovsdbTable.updateRow(node, Interface.NAME.getName(), tunnelPortUUID, interfaceUUID, tunInterface);
+            logger.debug("Tunnel {} add status : {}", tunInterface, status);
+            return status;
+        } catch (Exception e) {
+            logger.error("Exception in addTunnelPort", e);
+            return new Status(StatusCode.INTERNALERROR);
+        }
+    }
+
+    /* delete port from ovsdb port table */
+    private Status deletePort(Node node, String bridgeName, String portName) {
+        try {
+            String bridgeUUID = null;
+            OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
+            Map<String, org.opendaylight.ovsdb.lib.table.Table<?>> bridgeTable = ovsdbTable.getRows(node, Bridge.NAME.getName());
+            if (bridgeTable != null) {
+                for (String uuid : bridgeTable.keySet()) {
+                    Bridge bridge = (Bridge)bridgeTable.get(uuid);
+                    if (bridge.getName().equals(bridgeName)) {
+                        bridgeUUID = uuid;
+                        break;
+                    }
+                }
+            }
+            if (bridgeUUID == null) {
+                logger.debug("Could not find Bridge {} in {}", bridgeName, node);
+                return new Status(StatusCode.SUCCESS);
+            }
+
+            String portUUID = this.getPortUuid(node, portName, bridgeUUID);
+            Status status = new Status(StatusCode.SUCCESS);
+            if (portUUID != null) {
+               status = ovsdbTable.deleteRow(node, Port.NAME.getName(), portUUID);
+               if (!status.isSuccess()) {
+                   logger.error("Failed to delete port {} in {} status : {}", portName, bridgeUUID,
+                                status);
+                   return status;
+               }
+               logger.debug("Port {} delete status : {}", portName, status);
+            }
+            return status;
+        } catch (Exception e) {
+            logger.error("Exception in deletePort", e);
+            return new Status(StatusCode.INTERNALERROR);
+        }
+    }
+
+    private Status deleteTunnelPort(Node node, String tunnelType, InetAddress src, InetAddress dst) {
+        String tunnelBridgeName = adminConfigManager.getIntegrationBridgeName();
+        String portName = getTunnelName(tunnelType, dst);
+        Status status = deletePort(node, tunnelBridgeName, portName);
+        return status;
+    }
+
+    private Status deletePhysicalPort(Node node, String phyIntfName) {
+        String intBridgeName = adminConfigManager.getIntegrationBridgeName();
+        Status status = deletePort(node, intBridgeName, phyIntfName);
+        return status;
+    }
+
+    private void programLocalBridgeRules(Node node, Long dpid, String segmentationId, String attachedMac, long localPort) {
+         /*
+         * Table(0) Rule #3
+         * ----------------
+         * Match: VM sMac and Local Ingress Port
+         * Action:Action: Set Tunnel ID and GOTO Local Table (5)
+         */
+
+         handleLocalInPort(dpid, TABLE_0_DEFAULT_INGRESS, TABLE_1_ISOLATE_TENANT, segmentationId, localPort, attachedMac, true);
+
+        /*
+         * Table(0) Rule #4
+         * ----------------
+         * Match: Drop any remaining Ingress Local VM Packets
+         * Action: Drop w/ a low priority
+         */
+
+         handleDropSrcIface(dpid, localPort, true);
+
+         /*
+          * Table(2) Rule #1
+          * ----------------
+          * Match: Match TunID and Destination DL/dMAC Addr
+          * Action: Output Port
+          * table=2,tun_id=0x5,dl_dst=00:00:00:00:00:01 actions=output:2
+          */
+
+         handleLocalUcastOut(dpid, TABLE_2_LOCAL_FORWARD, segmentationId, localPort, attachedMac, true);
+
+         /*
+          * Table(2) Rule #2
+          * ----------------
+          * Match: Tunnel ID and dMAC (::::FF:FF)
+          * table=2,priority=16384,tun_id=0x5,dl_dst=ff:ff:ff:ff:ff:ff \
+          * actions=output:2,3,4,5
+          */
+
+          handleLocalBcastOut(dpid, TABLE_2_LOCAL_FORWARD, segmentationId, localPort, true);
+
+          /*
+           * TODO : Optimize the following 2 writes to be restricted only for the very first port known in a segment.
+           */
+          /*
+           * Table(1) Rule #3
+           * ----------------
+           * Match:  Any remaining Ingress Local VM Packets
+           * Action: Drop w/ a low priority
+           * -------------------------------------------
+           * table=1,priority=8192,tun_id=0x5 actions=goto_table:2
+           */
+
+           handleTunnelMiss(dpid, TABLE_1_ISOLATE_TENANT, TABLE_2_LOCAL_FORWARD, segmentationId, true);
+
+          /*
+           * Table(2) Rule #3
+           * ----------------
+           * Match: Any Remaining Flows w/a TunID
+           * Action: Drop w/ a low priority
+           * table=2,priority=8192,tun_id=0x5 actions=drop
+           */
+
+           handleLocalTableMiss(dpid, TABLE_2_LOCAL_FORWARD, segmentationId, true);
+    }
+
+    private void removeLocalBridgeRules(Node node, Long dpid, String segmentationId, String attachedMac, long localPort) {
+        /*
+         * Table(0) Rule #3
+         * ----------------
+         * Match: VM sMac and Local Ingress Port
+         * Action:Action: Set Tunnel ID and GOTO Local Table (5)
+         */
+
+         handleLocalInPort(dpid, TABLE_0_DEFAULT_INGRESS, TABLE_1_ISOLATE_TENANT, segmentationId, localPort, attachedMac, false);
+
+        /*
+         * Table(0) Rule #4
+         * ----------------
+         * Match: Drop any remaining Ingress Local VM Packets
+         * Action: Drop w/ a low priority
+         */
+
+         handleDropSrcIface(dpid, localPort, false);
+
+         /*
+          * Table(2) Rule #1
+          * ----------------
+          * Match: Match TunID and Destination DL/dMAC Addr
+          * Action: Output Port
+          * table=2,tun_id=0x5,dl_dst=00:00:00:00:00:01 actions=output:2
+          */
+
+         handleLocalUcastOut(dpid, TABLE_2_LOCAL_FORWARD, segmentationId, localPort, attachedMac, false);
+
+         /*
+          * Table(2) Rule #2
+          * ----------------
+          * Match: Tunnel ID and dMAC (::::FF:FF)
+          * table=2,priority=16384,tun_id=0x5,dl_dst=ff:ff:ff:ff:ff:ff \
+          * actions=output:2,3,4,5
+          */
+
+          handleLocalBcastOut(dpid, TABLE_2_LOCAL_FORWARD, segmentationId, localPort, false);
+    }
+
+    private void programLocalIngressTunnelBridgeRules(Node node, Long dpid, String segmentationId, String attachedMac, long tunnelOFPort, long localPort) {
+        /*
+         * Table(0) Rule #2
+         * ----------------
+         * Match: Ingress Port, Tunnel ID
+         * Action: GOTO Local Table (20)
+         */
+
+         handleTunnelIn(dpid, TABLE_0_DEFAULT_INGRESS, TABLE_2_LOCAL_FORWARD, segmentationId, tunnelOFPort, true);
+
+         /*
+          * Table(1) Rule #2
+          * ----------------
+          * Match: Match Tunnel ID and L2 ::::FF:FF Flooding
+          * Action: Flood to selected destination TEPs
+          * -------------------------------------------
+          * table=1,priority=16384,tun_id=0x5,dl_dst=ff:ff:ff:ff:ff:ff \
+          * actions=output:10,output:11,goto_table:2
+          */
+
+         handleTunnelFloodOut(dpid, TABLE_1_ISOLATE_TENANT, TABLE_2_LOCAL_FORWARD, segmentationId, tunnelOFPort, true);
+
+    }
+
+    private void programRemoteEgressTunnelBridgeRules(Node node, Long dpid, String segmentationId, String attachedMac, long tunnelOFPort, long localPort) {
+        /*
+         * Table(1) Rule #1
+         * ----------------
+         * Match: Drop any remaining Ingress Local VM Packets
+         * Action: Drop w/ a low priority
+         * -------------------------------------------
+         * table=1,tun_id=0x5,dl_dst=00:00:00:00:00:08 \
+         * actions=output:11,goto_table:2
+         */
+
+        handleTunnelOut(dpid, TABLE_1_ISOLATE_TENANT, TABLE_2_LOCAL_FORWARD, segmentationId, tunnelOFPort, attachedMac, true);
+    }
+
+    private void removeRemoteEgressTunnelBridgeRules(Node node, Long dpid, String segmentationId, String attachedMac, long tunnelOFPort, long localPort) {
+        /*
+         * Table(1) Rule #1
+         * ----------------
+         * Match: Drop any remaining Ingress Local VM Packets
+         * Action: Drop w/ a low priority
+         * -------------------------------------------
+         * table=1,tun_id=0x5,dl_dst=00:00:00:00:00:08 \
+         * actions=output:11,goto_table:2
+         */
+
+        handleTunnelOut(dpid, TABLE_1_ISOLATE_TENANT, TABLE_2_LOCAL_FORWARD, segmentationId, tunnelOFPort, attachedMac, false);
+    }
+
+    /* Remove tunnel rules if last node in this tenant network */
+    private void removePerTunnelRules(Node node, Long dpid, String segmentationId, long tunnelOFPort) {
+        /*
+         * TODO : Optimize the following 2 writes to be restricted only for the very first port known in a segment.
+         */
+        /*
+         * Table(1) Rule #3
+         * ----------------
+         * Match:  Any remaining Ingress Local VM Packets
+         * Action: Drop w/ a low priority
+         * -------------------------------------------
+         * table=1,priority=8192,tun_id=0x5 actions=goto_table:2
+         */
+
+        handleTunnelMiss(dpid, TABLE_1_ISOLATE_TENANT, TABLE_2_LOCAL_FORWARD, segmentationId, false);
+
+        /*
+         * Table(2) Rule #3
+         * ----------------
+         * Match: Any Remaining Flows w/a TunID
+         * Action: Drop w/ a low priority
+         * table=2,priority=8192,tun_id=0x5 actions=drop
+         */
+
+        handleLocalTableMiss(dpid, TABLE_2_LOCAL_FORWARD, segmentationId, false);
+
+        /*
+         * Table(0) Rule #2
+         * ----------------
+         * Match: Ingress Port, Tunnel ID
+         * Action: GOTO Local Table (10)
+         */
+
+        handleTunnelIn(dpid, TABLE_0_DEFAULT_INGRESS, TABLE_2_LOCAL_FORWARD, segmentationId, tunnelOFPort, false);
+
+         /*
+          * Table(1) Rule #2
+          * ----------------
+          * Match: Match Tunnel ID and L2 ::::FF:FF Flooding
+          * Action: Flood to selected destination TEPs
+          * -------------------------------------------
+          * table=1,priority=16384,tun_id=0x5,dl_dst=ff:ff:ff:ff:ff:ff \
+          * actions=output:10,output:11,goto_table:2
+          */
+
+        handleTunnelFloodOut(dpid, TABLE_1_ISOLATE_TENANT, TABLE_2_LOCAL_FORWARD, segmentationId, tunnelOFPort, false);
+    }
+
+    private void programLocalVlanRules(Node node, Long dpid, String segmentationId, String attachedMac, long localPort) {
+        /*
+         * Table(0) Rule #1
+         * ----------------
+         * Match: VM sMac and Local Ingress Port
+         * Action: Set VLAN ID and GOTO Local Table 1
+         */
+
+        handleLocalInPortSetVlan(dpid, TABLE_0_DEFAULT_INGRESS,
+                TABLE_1_ISOLATE_TENANT, segmentationId, localPort,
+                attachedMac, true);
+
+        /*
+         * Table(0) Rule #3
+         * ----------------
+         * Match: Drop any remaining Ingress Local VM Packets
+         * Action: Drop w/ a low priority
+         */
+
+        handleDropSrcIface(dpid, localPort, true);
+
+        /*
+         * Table(2) Rule #1
+         * ----------------
+         * Match: Match VLAN ID and Destination DL/dMAC Addr
+         * Action: strip vlan, output to local port
+         * Example: table=2,vlan_id=0x5,dl_dst=00:00:00:00:00:01 actions= strip vlan, output:2
+         */
+
+        handleLocalVlanUcastOut(dpid, TABLE_2_LOCAL_FORWARD, segmentationId,
+                localPort, attachedMac, true);
+
+        /*
+         * Table(2) Rule #2
+         * ----------------
+         * Match: VLAN ID and dMAC (::::FF:FF)
+         * Action: strip vlan, output to all local ports in this vlan
+         * Example: table=2,priority=16384,vlan_id=0x5,dl_dst=ff:ff:ff:ff:ff:ff \
+         * actions= strip_vlan, output:2,3,4,5
+         */
+
+        handleLocalVlanBcastOut(dpid, TABLE_2_LOCAL_FORWARD, segmentationId,
+                localPort, true);
+
+         /*
+          * Table(2) Rule #3
+          * ----------------
+          * Match: Any Remaining Flows w/a VLAN ID
+          * Action: Drop w/ a low priority
+          * Example: table=2,priority=8192,vlan_id=0x5 actions=drop
+          */
+
+          handleLocalVlanTableMiss(dpid, TABLE_2_LOCAL_FORWARD, segmentationId,
+                                   true);
+   }
+
+    private void removeLocalVlanRules(Node node, Long dpid,
+                                      String segmentationId, String attachedMac,
+                                      long localPort) {
+        /*
+         * Table(0) Rule #1
+         * ----------------
+         * Match: VM sMac and Local Ingress Port
+         * Action: Set VLAN ID and GOTO Local Table 1
+         */
+
+        handleLocalInPortSetVlan(dpid, TABLE_0_DEFAULT_INGRESS,
+                TABLE_1_ISOLATE_TENANT, segmentationId, localPort,
+                attachedMac, false);
+
+        /*
+         * Table(0) Rule #3
+         * ----------------
+         * Match: Drop any remaining Ingress Local VM Packets
+         * Action: Drop w/ a low priority
+         */
+
+        handleDropSrcIface(dpid, localPort, false);
+
+        /*
+         * Table(2) Rule #1
+         * ----------------
+         * Match: Match VLAN ID and Destination DL/dMAC Addr
+         * Action: strip vlan, output to local port
+         * Example: table=2,vlan_id=0x5,dl_dst=00:00:00:00:00:01 actions= strip vlan, output:2
+         */
+
+        handleLocalVlanUcastOut(dpid, TABLE_2_LOCAL_FORWARD, segmentationId,
+                localPort, attachedMac, false);
+
+        /*
+         * Table(2) Rule #2
+         * ----------------
+         * Match: VLAN ID and dMAC (::::FF:FF)
+         * Action: strip vlan, output to all local ports in this vlan
+         * Example: table=2,priority=16384,vlan_id=0x5,dl_dst=ff:ff:ff:ff:ff:ff \
+         * actions= strip_vlan, output:2,3,4,5
+         */
+
+        handleLocalVlanBcastOut(dpid, TABLE_2_LOCAL_FORWARD, segmentationId,
+                localPort, false);
+   }
+
+   private void programLocalIngressVlanRules(Node node, Long dpid, String segmentationId, String attachedMac, long ethPort) {
+       /*
+        * Table(0) Rule #2
+        * ----------------
+        * Match: Ingress port = physical interface, Vlan ID
+        * Action: GOTO Local Table 2
+        */
+
+       handleVlanIn(dpid, TABLE_0_DEFAULT_INGRESS, TABLE_2_LOCAL_FORWARD,
+                    segmentationId, ethPort, true);
+
+        /*
+         * Table(1) Rule #2
+         * ----------------
+         * Match: Match VLAN ID and L2 ::::FF:FF Flooding
+         * Action: Flood to local and remote VLAN members
+         * -------------------------------------------
+         * Example: table=1,priority=16384,vlan_id=0x5,dl_dst=ff:ff:ff:ff:ff:ff \
+         * actions=output:10 (eth port),goto_table:2
+         */
+
+        handleVlanFloodOut(dpid, TABLE_1_ISOLATE_TENANT, TABLE_2_LOCAL_FORWARD,
+                           segmentationId, ethPort, true);
+   }
+
+   private void programRemoteEgressVlanRules(Node node, Long dpid, String segmentationId, String attachedMac, long ethPort) {
+       /*
+        * Table(1) Rule #1
+        * ----------------
+        * Match: Destination MAC is local VM MAC and vlan id
+        * Action: go to table 2
+        * -------------------------------------------
+        * Example: table=1,vlan_id=0x5,dl_dst=00:00:00:00:00:08 \
+        * actions=goto_table:2
+        */
+
+       handleVlanOut(dpid, TABLE_1_ISOLATE_TENANT, TABLE_2_LOCAL_FORWARD,
+                     segmentationId, ethPort, attachedMac, true);
+
+       /*
+        * Table(1) Rule #3
+        * ----------------
+        * Match:  VLAN ID
+        * Action: Go to table 2
+        * -------------------------------------------
+        * Example: table=1,priority=8192,vlan_id=0x5 actions=output:1,goto_table:2
+        */
+
+       handleVlanMiss(dpid, TABLE_1_ISOLATE_TENANT, TABLE_2_LOCAL_FORWARD,
+                      segmentationId, ethPort, true);
+   }
+
+   private void removeRemoteEgressVlanRules(Node node, Long dpid, String segmentationId, String attachedMac, long ethPort) {
+       /*
+        * Table(1) Rule #1
+        * ----------------
+        * Match: Destination MAC is local VM MAC and vlan id
+        * Action: go to table 2
+        * -------------------------------------------
+        * Example: table=1,vlan_id=0x5,dl_dst=00:00:00:00:00:08 \
+        * actions=goto_table:2
+        */
+
+       handleVlanOut(dpid, TABLE_1_ISOLATE_TENANT, TABLE_2_LOCAL_FORWARD,
+                     segmentationId, ethPort, attachedMac, false);
+   }
+
+   private void removePerVlanRules(Node node, Long dpid, String segmentationId, long ethPort) {
+       /*
+        * Table(2) Rule #3
+        * ----------------
+        * Match: Any Remaining Flows w/a VLAN ID
+        * Action: Drop w/ a low priority
+        * Example: table=2,priority=8192,vlan_id=0x5 actions=drop
+        */
+
+        handleLocalVlanTableMiss(dpid, TABLE_2_LOCAL_FORWARD, segmentationId,
+                                 false);
+
+        /*
+         * Table(0) Rule #2
+         * ----------------
+         * Match: Ingress port = physical interface, Vlan ID
+         * Action: GOTO Local Table 2
+         */
+
+        handleVlanIn(dpid, TABLE_0_DEFAULT_INGRESS, TABLE_2_LOCAL_FORWARD,
+                     segmentationId, ethPort, false);
+
+         /*
+          * Table(1) Rule #2
+          * ----------------
+          * Match: Match VLAN ID and L2 ::::FF:FF Flooding
+          * Action: Flood to local and remote VLAN members
+          * -------------------------------------------
+          * Example: table=1,priority=16384,vlan_id=0x5,dl_dst=ff:ff:ff:ff:ff:ff \
+          * actions=output:10 (eth port),goto_table:2
+          */
+
+         handleVlanFloodOut(dpid, TABLE_1_ISOLATE_TENANT, TABLE_2_LOCAL_FORWARD,
+                            segmentationId, ethPort, false);
+
+         /*
+          * Table(1) Rule #3
+          * ----------------
+          * Match:  VLAN ID
+          * Action: Go to table 2
+          * -------------------------------------------
+          * Example: table=1,priority=8192,vlan_id=0x5 actions=output:1,goto_table:2
+          */
+
+         handleVlanMiss(dpid, TABLE_1_ISOLATE_TENANT, TABLE_2_LOCAL_FORWARD,
+                        segmentationId, ethPort, false);
+   }
+    private Long getDpid (Node node, String bridgeUuid) {
+        try {
+            OVSDBConfigService ovsdbTable = (OVSDBConfigService) ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
+            Bridge bridge = (Bridge) ovsdbTable.getRow(node, Bridge.NAME.getName(), bridgeUuid);
+            Set<String> dpids = bridge.getDatapath_id();
+            if (dpids == null || dpids.size() == 0) return 0L;
+            return Long.valueOf(HexEncode.stringToLong((String) dpids.toArray()[0]));
+        } catch (Exception e) {
+            logger.error("Error finding Bridge's OF DPID", e);
+            return 0L;
+        }
+    }
+
+    private Long getIntegrationBridgeOFDPID (Node node) {
+        try {
+            String bridgeName = adminConfigManager.getIntegrationBridgeName();
+            String brIntId = this.getInternalBridgeUUID(node, bridgeName);
+            if (brIntId == null) {
+                logger.error("Unable to spot Bridge Identifier for {} in {}", bridgeName, node);
+                return 0L;
+            }
+
+            return getDpid(node, brIntId);
+        } catch (Exception e) {
+            logger.error("Error finding Integration Bridge's OF DPID", e);
+            return 0L;
+        }
+    }
+
+    private Long getExternalBridgeDpid (Node node) {
+        try {
+            String bridgeName = adminConfigManager.getExternalBridgeName();
+            String brUuid = this.getInternalBridgeUUID(node, bridgeName);
+            if (brUuid == null) {
+                logger.error("Unable to spot Bridge Identifier for {} in {}", bridgeName, node);
+                return 0L;
+            }
+
+            return getDpid(node, brUuid);
+        } catch (Exception e) {
+            logger.error("Error finding External Bridge's OF DPID", e);
+            return 0L;
+        }
+    }
+
+    private void programLocalRules (String networkType, String segmentationId, Node node, Interface intf) {
+        try {
+            Long dpid = this.getIntegrationBridgeOFDPID(node);
+            if (dpid == 0L) {
+                logger.debug("Openflow Datapath-ID not set for the integration bridge in {}", node);
+                return;
+            }
+
+            Set<BigInteger> of_ports = intf.getOfport();
+            if (of_ports == null || of_ports.size() <= 0) {
+                logger.error("Could NOT Identify OF value for port {} on {}", intf.getName(), node);
+                return;
+            }
+            long localPort = ((BigInteger)of_ports.toArray()[0]).longValue();
+
+            Map<String, String> externalIds = intf.getExternal_ids();
+            if (externalIds == null) {
+                logger.error("No external_ids seen in {}", intf);
+                return;
+            }
+
+            String attachedMac = externalIds.get(ITenantNetworkManager.EXTERNAL_ID_VM_MAC);
+            if (attachedMac == null) {
+                logger.error("No AttachedMac seen in {}", intf);
+                return;
+            }
+
+            /* Program local rules based on network type */
+            if (networkType.equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VLAN)) {
+                logger.debug("Program local vlan rules for interface {}", intf.getName());
+                programLocalVlanRules(node, dpid, segmentationId, attachedMac, localPort);
+            } else if (networkType.equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_GRE) ||
+                       networkType.equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VXLAN)) {
+                logger.debug("Program local bridge rules for interface {}", intf.getName());
+                programLocalBridgeRules(node, dpid, segmentationId, attachedMac, localPort);
+            }
+        } catch (Exception e) {
+            logger.error("Exception in programming Local Rules for "+intf+" on "+node, e);
+        }
+    }
+
+    private void removeLocalRules (String networkType, String segmentationId, Node node, Interface intf) {
+        try {
+            Long dpid = this.getIntegrationBridgeOFDPID(node);
+            if (dpid == 0L) {
+                logger.debug("Openflow Datapath-ID not set for the integration bridge in {}", node);
+                return;
+            }
+
+            Set<BigInteger> of_ports = intf.getOfport();
+            if (of_ports == null || of_ports.size() <= 0) {
+                logger.error("Could NOT Identify OF value for port {} on {}", intf.getName(), node);
+                return;
+            }
+            long localPort = ((BigInteger)of_ports.toArray()[0]).longValue();
+
+            Map<String, String> externalIds = intf.getExternal_ids();
+            if (externalIds == null) {
+                logger.error("No external_ids seen in {}", intf);
+                return;
+            }
+
+            String attachedMac = externalIds.get(ITenantNetworkManager.EXTERNAL_ID_VM_MAC);
+            if (attachedMac == null) {
+                logger.error("No AttachedMac seen in {}", intf);
+                return;
+            }
+
+            /* Program local rules based on network type */
+            if (networkType.equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VLAN)) {
+                logger.debug("Remove local vlan rules for interface {}", intf.getName());
+                removeLocalVlanRules(node, dpid, segmentationId, attachedMac, localPort);
+            } else if (networkType.equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_GRE) ||
+                       networkType.equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VXLAN)) {
+                logger.debug("Remove local bridge rules for interface {}", intf.getName());
+                removeLocalBridgeRules(node, dpid, segmentationId, attachedMac, localPort);
+            }
+        } catch (Exception e) {
+            logger.error("Exception in removing Local Rules for "+intf+" on "+node, e);
+        }
+    }
+
+    private void programTunnelRules (String tunnelType, String segmentationId, InetAddress dst, Node node,
+            Interface intf, boolean local) {
+        try {
+
+            Long dpid = this.getIntegrationBridgeOFDPID(node);
+            if (dpid == 0L) {
+                logger.debug("Openflow Datapath-ID not set for the integration bridge in {}", node);
+                return;
+            }
+            OVSDBConfigService ovsdbTable = (OVSDBConfigService) ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
+
+            Set<BigInteger> of_ports = intf.getOfport();
+            if (of_ports == null || of_ports.size() <= 0) {
+                logger.error("Could NOT Identify OF value for port {} on {}", intf.getName(), node);
+                return;
+            }
+            long localPort = ((BigInteger)of_ports.toArray()[0]).longValue();
+
+            Map<String, String> externalIds = intf.getExternal_ids();
+            if (externalIds == null) {
+                logger.error("No external_ids seen in {}", intf);
+                return;
+            }
+
+            String attachedMac = externalIds.get(ITenantNetworkManager.EXTERNAL_ID_VM_MAC);
+            if (attachedMac == null) {
+                logger.error("No AttachedMac seen in {}", intf);
+                return;
+            }
+
+            Map<String, org.opendaylight.ovsdb.lib.table.Table<?>> intfs = ovsdbTable.getRows(node, Interface.NAME.getName());
+            if (intfs != null) {
+                for (org.opendaylight.ovsdb.lib.table.Table<?> row : intfs.values()) {
+                    Interface tunIntf = (Interface)row;
+                    if (tunIntf.getName().equals(this.getTunnelName(tunnelType, dst))) {
+                        of_ports = tunIntf.getOfport();
+                        if (of_ports == null || of_ports.size() <= 0) {
+                            logger.error("Could NOT Identify Tunnel port {} on {}", tunIntf.getName(), node);
+                            continue;
+                        }
+                        long tunnelOFPort = ((BigInteger)of_ports.toArray()[0]).longValue();
+
+                        if (tunnelOFPort == -1) {
+                            logger.error("Could NOT Identify Tunnel port {} -> OF ({}) on {}", tunIntf.getName(), tunnelOFPort, node);
+                            return;
+                        }
+                        logger.debug("Identified Tunnel port {} -> OF ({}) on {}", tunIntf.getName(), tunnelOFPort, node);
+
+                        if (!local) {
+                            programRemoteEgressTunnelBridgeRules(node, dpid, segmentationId, attachedMac, tunnelOFPort, localPort);
+                        }
+                        logger.trace("program local ingress tunnel rules: node" + node.getNodeIDString() + " intf " + intf.getName());
+                        if (local) {
+                            programLocalIngressTunnelBridgeRules(node, dpid, segmentationId, attachedMac, tunnelOFPort, localPort);
+                        }
+                        return;
+                    }
+                }
+            }
+        } catch (Exception e) {
+            logger.error("", e);
+        }
+    }
+
+    private void removeTunnelRules (String tunnelType, String segmentationId, InetAddress dst, Node node,
+            Interface intf, boolean local, boolean isLastInstanceOnNode) {
+        try {
+
+            Long dpid = this.getIntegrationBridgeOFDPID(node);
+            if (dpid == 0L) {
+                logger.debug("Openflow Datapath-ID not set for the integration bridge in {}", node);
+                return;
+            }
+            OVSDBConfigService ovsdbTable = (OVSDBConfigService) ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
+
+            Set<BigInteger> of_ports = intf.getOfport();
+            if (of_ports == null || of_ports.size() <= 0) {
+                logger.error("Could NOT Identify OF value for port {} on {}", intf.getName(), node);
+                return;
+            }
+            long localPort = ((BigInteger)of_ports.toArray()[0]).longValue();
+
+            Map<String, String> externalIds = intf.getExternal_ids();
+            if (externalIds == null) {
+                logger.error("No external_ids seen in {}", intf);
+                return;
+            }
+
+            String attachedMac = externalIds.get(ITenantNetworkManager.EXTERNAL_ID_VM_MAC);
+            if (attachedMac == null) {
+                logger.error("No AttachedMac seen in {}", intf);
+                return;
+            }
+
+            Map<String, org.opendaylight.ovsdb.lib.table.Table<?>> intfs = ovsdbTable.getRows(node, Interface.NAME.getName());
+            if (intfs != null) {
+                for (org.opendaylight.ovsdb.lib.table.Table<?> row : intfs.values()) {
+                    Interface tunIntf = (Interface)row;
+                    if (tunIntf.getName().equals(this.getTunnelName(tunnelType, dst))) {
+                        of_ports = tunIntf.getOfport();
+                        if (of_ports == null || of_ports.size() <= 0) {
+                            logger.error("Could NOT Identify Tunnel port {} on {}", tunIntf.getName(), node);
+                            continue;
+                        }
+                        long tunnelOFPort = ((BigInteger)of_ports.toArray()[0]).longValue();
+
+                        if (tunnelOFPort == -1) {
+                            logger.error("Could NOT Identify Tunnel port {} -> OF ({}) on {}", tunIntf.getName(), tunnelOFPort, node);
+                            return;
+                        }
+                        logger.debug("Identified Tunnel port {} -> OF ({}) on {}", tunIntf.getName(), tunnelOFPort, node);
+
+                        if (!local) {
+                            removeRemoteEgressTunnelBridgeRules(node, dpid, segmentationId, attachedMac, tunnelOFPort, localPort);
+                        }
+                        if (local && isLastInstanceOnNode) {
+                            removePerTunnelRules(node, dpid, segmentationId, tunnelOFPort);
+                        }
+                        return;
+                    }
+                }
+            }
+        } catch (Exception e) {
+            logger.error("", e);
+        }
+    }
+
+    private void programVlanRules (NeutronNetwork network, Node node, Interface intf) {
+        logger.debug("Program vlan rules for interface {}", intf.getName());
+
+        try {
+
+            Long dpid = this.getIntegrationBridgeOFDPID(node);
+            if (dpid == 0L) {
+                logger.debug("Openflow Datapath-ID not set for the integration bridge in {}", node);
+                return;
+            }
+            OVSDBConfigService ovsdbTable = (OVSDBConfigService) ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
+
+            Set<BigInteger> of_ports = intf.getOfport();
+            int timeout = 6;
+            while ((of_ports == null) && (timeout > 0)) {
+                of_ports = intf.getOfport();
+                if (of_ports == null || of_ports.size() <= 0) {
+                    // Wait for the OVSDB update to sync up the Local cache.
+                    Thread.sleep(500);
+                    timeout--;
+                    continue;
+                }
+            }
+            if (of_ports == null || of_ports.size() <= 0) {
+                logger.error("Could NOT Identify OF value for port {} on {}", intf.getName(), node);
+                return;
+            }
+
+            Map<String, String> externalIds = intf.getExternal_ids();
+            if (externalIds == null) {
+                logger.error("No external_ids seen in {}", intf);
+                return;
+            }
+
+            String attachedMac = externalIds.get(tenantNetworkManager.EXTERNAL_ID_VM_MAC);
+            if (attachedMac == null) {
+                logger.error("No AttachedMac seen in {}", intf);
+                return;
+            }
+
+            Map<String, org.opendaylight.ovsdb.lib.table.Table<?>> intfs = ovsdbTable.getRows(node, Interface.NAME.getName());
+            if (intfs != null) {
+                for (org.opendaylight.ovsdb.lib.table.Table<?> row : intfs.values()) {
+                    Interface ethIntf = (Interface)row;
+                    if (ethIntf.getName().equalsIgnoreCase(adminConfigManager.getPhysicalInterfaceName(node, network.getProviderPhysicalNetwork()))) {
+                        of_ports = ethIntf.getOfport();
+                        timeout = 6;
+                        while ((of_ports == null) && (timeout > 0)) {
+                            of_ports = ethIntf.getOfport();
+                            if (of_ports == null || of_ports.size() <= 0) {
+                                // Wait for the OVSDB update to sync up the Local cache.
+                                Thread.sleep(500);
+                                timeout--;
+                                continue;
+                            }
+                        }
+
+                        if (of_ports == null || of_ports.size() <= 0) {
+                            logger.error("Could NOT Identify eth port {} on {}", ethIntf.getName(), node);
+                            continue;
+                        }
+                        long ethOFPort = ((BigInteger)of_ports.toArray()[0]).longValue();
+
+                        if (ethOFPort == -1) {
+                            logger.error("Could NOT Identify eth port {} -> OF ({}) on {}", ethIntf.getName(), ethOFPort, node);
+                            throw new Exception("port number < 0");
+                        }
+                        logger.debug("Identified eth port {} -> OF ({}) on {}", ethIntf.getName(), ethOFPort, node);
+
+                        programRemoteEgressVlanRules(node, dpid, network.getProviderSegmentationID(), attachedMac, ethOFPort);
+                        programLocalIngressVlanRules(node, dpid, network.getProviderSegmentationID(), attachedMac, ethOFPort);
+                        return;
+                    }
+                }
+            }
+        } catch (Exception e) {
+            logger.error("", e);
+        }
+    }
+
+    private void removeVlanRules (NeutronNetwork network, Node node,
+                      Interface intf, boolean isLastInstanceOnNode) {
+        logger.debug("Remove vlan rules for interface {}", intf.getName());
+
+        try {
+
+            Long dpid = this.getIntegrationBridgeOFDPID(node);
+            if (dpid == 0L) {
+                logger.debug("Openflow Datapath-ID not set for the integration bridge in {}", node);
+                return;
+            }
+            OVSDBConfigService ovsdbTable = (OVSDBConfigService) ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
+
+            Set<BigInteger> of_ports = intf.getOfport();
+            if (of_ports == null || of_ports.size() <= 0) {
+                logger.error("Could NOT Identify OF value for port {} on {}", intf.getName(), node);
+                return;
+            }
+
+            Map<String, String> externalIds = intf.getExternal_ids();
+            if (externalIds == null) {
+                logger.error("No external_ids seen in {}", intf);
+                return;
+            }
+
+            String attachedMac = externalIds.get(tenantNetworkManager.EXTERNAL_ID_VM_MAC);
+            if (attachedMac == null) {
+                logger.error("No AttachedMac seen in {}", intf);
+                return;
+            }
+
+            Map<String, org.opendaylight.ovsdb.lib.table.Table<?>> intfs = ovsdbTable.getRows(node, Interface.NAME.getName());
+            if (intfs != null) {
+                for (org.opendaylight.ovsdb.lib.table.Table<?> row : intfs.values()) {
+                    Interface ethIntf = (Interface)row;
+                    if (ethIntf.getName().equalsIgnoreCase(adminConfigManager.getPhysicalInterfaceName(node,
+                                                                   network.getProviderPhysicalNetwork()))) {
+                        of_ports = ethIntf.getOfport();
+                        if (of_ports == null || of_ports.size() <= 0) {
+                            logger.error("Could NOT Identify eth port {} on {}", ethIntf.getName(), node);
+                            continue;
+                        }
+                        long ethOFPort = ((BigInteger)of_ports.toArray()[0]).longValue();
+
+                        if (ethOFPort == -1) {
+                            logger.error("Could NOT Identify eth port {} -> OF ({}) on {}", ethIntf.getName(), ethOFPort, node);
+                            throw new Exception("port number < 0");
+                        }
+                        logger.debug("Identified eth port {} -> OF ({}) on {}", ethIntf.getName(), ethOFPort, node);
+
+                        removeRemoteEgressVlanRules(node, dpid, network.getProviderSegmentationID(), attachedMac, ethOFPort);
+                        if (isLastInstanceOnNode) {
+                            removePerVlanRules(node, dpid, network.getProviderSegmentationID(), ethOFPort);
+                        }
+                        return;
+                    }
+                }
+            }
+        } catch (Exception e) {
+            logger.error("", e);
+        }
+    }
+
+    @Override
+    public Status handleInterfaceUpdate(NeutronNetwork network, Node srcNode, Interface intf) {
+        ISwitchManager switchManager = (ISwitchManager) ServiceHelper.getInstance(ISwitchManager.class, "default", this);
+        if (switchManager == null) {
+            logger.error("Unable to identify SwitchManager");
+        } else {
+            Long dpid = this.getIntegrationBridgeOFDPID(srcNode);
+            if (dpid == 0L) {
+                logger.debug("Openflow Datapath-ID not set for the integration bridge in {}", srcNode);
+                return new Status(StatusCode.NOTFOUND);
+            }
+            Set<Node> ofNodes = switchManager.getNodes();
+            boolean ofNodeFound = false;
+            if (ofNodes != null) {
+                for (Node ofNode : ofNodes) {
+                    if (ofNode.toString().contains(dpid+"")) {
+                        logger.debug("Identified the Openflow node via toString {}", ofNode);
+                        ofNodeFound = true;
+                        break;
+                    }
+                }
+            } else {
+                logger.error("Unable to find any Node from SwitchManager");
+            }
+            if (!ofNodeFound) {
+                logger.error("Unable to find OF Node for {} with update {} on node {}", dpid, intf, srcNode);
+                return new Status(StatusCode.NOTFOUND);
+            }
+        }
+
+        IConnectionServiceInternal connectionService = (IConnectionServiceInternal)ServiceHelper.getGlobalInstance(IConnectionServiceInternal.class, this);
+        List<Node> nodes = connectionService.getNodes();
+        nodes.remove(srcNode);
+        this.programLocalRules(network.getProviderNetworkType(), network.getProviderSegmentationID(), srcNode, intf);
+
+        if (network.getProviderNetworkType().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VLAN)) {
+            this.programVlanRules(network, srcNode, intf);
+        } else if (network.getProviderNetworkType().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_GRE)
+                   || network.getProviderNetworkType().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VXLAN)){
+            for (Node dstNode : nodes) {
+                InetAddress src = adminConfigManager.getTunnelEndPoint(srcNode);
+                InetAddress dst = adminConfigManager.getTunnelEndPoint(dstNode);
+                Status status = addTunnelPort(srcNode, network.getProviderNetworkType(), src, dst);
+                if (status.isSuccess()) {
+                    this.programTunnelRules(network.getProviderNetworkType(), network.getProviderSegmentationID(), dst, srcNode, intf, true);
+                }
+                addTunnelPort(dstNode, network.getProviderNetworkType(), dst, src);
+                if (status.isSuccess()) {
+                    this.programTunnelRules(network.getProviderNetworkType(), network.getProviderSegmentationID(), src, dstNode, intf, false);
+                }
+            }
+        }
+
+        return new Status(StatusCode.SUCCESS);
+    }
+
+    private Status triggerInterfaceUpdates(Node node) {
+        try {
+            OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
+            Map<String, org.opendaylight.ovsdb.lib.table.Table<?>> intfs = ovsdbTable.getRows(node, Interface.NAME.getName());
+            if (intfs != null) {
+                for (org.opendaylight.ovsdb.lib.table.Table<?> row : intfs.values()) {
+                    Interface intf = (Interface)row;
+                    NeutronNetwork network = tenantNetworkManager.getTenantNetworkForInterface(intf);
+                    logger.debug("Trigger Interface update for {}", intf);
+                    if (network != null) {
+                        this.handleInterfaceUpdate(network, node, intf);
+                    }
+                }
+            }
+        } catch (Exception e) {
+            logger.error("Error Triggering the lost interface updates for "+ node, e);
+            return new Status(StatusCode.INTERNALERROR, e.getLocalizedMessage());
+        }
+        return new Status(StatusCode.SUCCESS);
+    }
+    @Override
+    public Status handleInterfaceUpdate(String tunnelType, String tunnelKey) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Status handleInterfaceDelete(String tunnelType, NeutronNetwork network, Node srcNode, Interface intf,
+            boolean isLastInstanceOnNode) {
+        Status status = new Status(StatusCode.SUCCESS);
+        IConnectionServiceInternal connectionService = (IConnectionServiceInternal)ServiceHelper.getGlobalInstance(IConnectionServiceInternal.class, this);
+        List<Node> nodes = connectionService.getNodes();
+        nodes.remove(srcNode);
+
+        logger.info("Delete intf " + intf.getName() + " isLastInstanceOnNode " + isLastInstanceOnNode);
+        List<String> phyIfName = adminConfigManager.getAllPhysicalInterfaceNames(srcNode);
+        if (intf.getType().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VXLAN)
+            || intf.getType().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_GRE)) {
+            /* Delete tunnel port */
+            try {
+                OvsDBMap<String, String> options = intf.getOptions();
+                InetAddress src = InetAddress.getByName(options.get("local_ip"));
+                InetAddress dst = InetAddress.getByName(options.get("remote_ip"));
+                status = deleteTunnelPort(srcNode, intf.getType(), src, dst);
+            } catch (Exception e) {
+                logger.error(e.getMessage(), e);
+            }
+        } else if (phyIfName.contains(intf.getName())) {
+            deletePhysicalPort(srcNode, intf.getName());
+        } else {
+            /* delete all other interfaces */
+            this.removeLocalRules(network.getProviderNetworkType(), network.getProviderSegmentationID(),
+                    srcNode, intf);
+
+            if (network.getProviderNetworkType().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VLAN)) {
+                this.removeVlanRules(network, srcNode,
+                                 intf, isLastInstanceOnNode);
+            } else if (network.getProviderNetworkType().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_GRE)
+                   || network.getProviderNetworkType().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VXLAN)) {
+
+                for (Node dstNode : nodes) {
+                    InetAddress src = adminConfigManager.getTunnelEndPoint(srcNode);
+                    InetAddress dst = adminConfigManager.getTunnelEndPoint(dstNode);
+                    logger.info("Remove tunnel rules for interface " + intf.getName() + " on srcNode" + srcNode.getNodeIDString());
+                    this.removeTunnelRules(tunnelType, network.getProviderSegmentationID(),
+                                           dst, srcNode, intf, true, isLastInstanceOnNode);
+                    logger.info("Remove tunnel rules for interface " + intf.getName() + " on dstNode" + dstNode.getNodeIDString());
+                    this.removeTunnelRules(tunnelType, network.getProviderSegmentationID(),
+                                           src, dstNode, intf, false, isLastInstanceOnNode);
+                }
+            }
+        }
+        return status;
+    }
+
+    @Override
+    public void initializeFlowRules(Node node) {
+        this.initializeFlowRules(node, adminConfigManager.getIntegrationBridgeName());
+        this.initializeFlowRules(node, adminConfigManager.getExternalBridgeName());
+        this.triggerInterfaceUpdates(node);
+    }
+
+    /**
+     * @param node
+     * @param bridgeName
+     */
+    private void initializeFlowRules(Node node, String bridgeName) {
+        String bridgeUuid = this.getInternalBridgeUUID(node, bridgeName);
+        if (bridgeUuid == null) {
+            return;
+        }
+
+        Long dpid = getDpid(node, bridgeUuid);
+
+        if (dpid == 0L) {
+            logger.debug("Openflow Datapath-ID not set for the integration bridge in {}", node);
+            return;
+        }
+
+        /*
+         * Table(0) Rule #1
+         * ----------------
+         * Match: LLDP (0x88CCL)
+         * Action: Packet_In to Controller Reserved Port
+         */
+
+         writeLLDPRule(dpid);
+         if (bridgeName == adminConfigManager.getExternalBridgeName()) {
+             writeNormalRule(dpid);
+         }
+    }
+
+    /*
+    * Create an LLDP Flow Rule to encapsulate into
+    * a packet_in that is sent to the controller
+    * for topology handling.
+    * Match: Ethertype 0x88CCL
+    * Action: Punt to Controller in a Packet_In msg
+    */
+
+    private void writeLLDPRule(Long dpidLong) {
+
+        String nodeName = "openflow:" + dpidLong;
+        EtherType etherType = new EtherType(0x88CCL);
+
+        MatchBuilder matchBuilder = new MatchBuilder();
+        NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
+        FlowBuilder flowBuilder = new FlowBuilder();
+
+        // Create Match(es) and Set them in the FlowBuilder Object
+        flowBuilder.setMatch(createEtherTypeMatch(matchBuilder, etherType).build());
+
+        // Create the OF Actions and Instructions
+        InstructionBuilder ib = new InstructionBuilder();
+        InstructionsBuilder isb = new InstructionsBuilder();
+
+        // Instructions List Stores Individual Instructions
+        List<Instruction> instructions = new ArrayList<Instruction>();
+
+        // Call the InstructionBuilder Methods Containing Actions
+        createSendToControllerInstructions(ib);
+        ib.setOrder(0);
+        ib.setKey(new InstructionKey(0));
+        instructions.add(ib.build());
+
+        // Add InstructionBuilder to the Instruction(s)Builder List
+        isb.setInstruction(instructions);
+
+        // Add InstructionsBuilder to FlowBuilder
+        flowBuilder.setInstructions(isb.build());
+
+        String flowId = "LLDP";
+        flowBuilder.setId(new FlowId(flowId));
+        FlowKey key = new FlowKey(new FlowId(flowId));
+        flowBuilder.setBarrier(true);
+        flowBuilder.setTableId((short) 0);
+        flowBuilder.setKey(key);
+        flowBuilder.setFlowName(flowId);
+        flowBuilder.setHardTimeout(0);
+        flowBuilder.setIdleTimeout(0);
+        writeFlow(flowBuilder, nodeBuilder);
+    }
+
+    /*
+    * Create a NORMAL Table Miss Flow Rule
+    * Match: any
+    * Action: forward to NORMAL pipeline
+    */
+
+    private void writeNormalRule(Long dpidLong) {
+
+        String nodeName = "openflow:" + dpidLong;
+
+        MatchBuilder matchBuilder = new MatchBuilder();
+        NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
+        FlowBuilder flowBuilder = new FlowBuilder();
+
+        // Create the OF Actions and Instructions
+        InstructionBuilder ib = new InstructionBuilder();
+        InstructionsBuilder isb = new InstructionsBuilder();
+
+        // Instructions List Stores Individual Instructions
+        List<Instruction> instructions = new ArrayList<Instruction>();
+
+        // Call the InstructionBuilder Methods Containing Actions
+        createNormalInstructions(ib);
+        ib.setOrder(0);
+        ib.setKey(new InstructionKey(0));
+        instructions.add(ib.build());
+
+        // Add InstructionBuilder to the Instruction(s)Builder List
+        isb.setInstruction(instructions);
+
+        // Add InstructionsBuilder to FlowBuilder
+        flowBuilder.setInstructions(isb.build());
+
+        String flowId = "NORMAL";
+        flowBuilder.setId(new FlowId(flowId));
+        FlowKey key = new FlowKey(new FlowId(flowId));
+        flowBuilder.setMatch(matchBuilder.build());
+        flowBuilder.setPriority(0);
+        flowBuilder.setBarrier(true);
+        flowBuilder.setTableId((short) 0);
+        flowBuilder.setKey(key);
+        flowBuilder.setFlowName(flowId);
+        flowBuilder.setHardTimeout(0);
+        flowBuilder.setIdleTimeout(0);
+        writeFlow(flowBuilder, nodeBuilder);
+    }
+
+    /*
+     * (Table:0) Ingress Tunnel Traffic
+     * Match: OpenFlow InPort and Tunnel ID
+     * Action: GOTO Local Table (10)
+     * table=0,tun_id=0x5,in_port=10, actions=goto_table:2
+     */
+
+    private void handleTunnelIn(Long dpidLong, Short writeTable,
+                                Short goToTableId, String segmentationId,
+                                Long ofPort, boolean write) {
+
+        String nodeName = "openflow:" + dpidLong;
+
+        BigInteger tunnelId = new BigInteger(segmentationId);
+        MatchBuilder matchBuilder = new MatchBuilder();
+        NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
+        FlowBuilder flowBuilder = new FlowBuilder();
+
+        // Create Match(es) and Set them in the FlowBuilder Object
+        flowBuilder.setMatch(createTunnelIDMatch(matchBuilder, tunnelId).build());
+        flowBuilder.setMatch(createInPortMatch(matchBuilder, dpidLong, ofPort).build());
+
+        if (write) {
+            // Create the OF Actions and Instructions
+            InstructionBuilder ib = new InstructionBuilder();
+            InstructionsBuilder isb = new InstructionsBuilder();
+
+            // Instructions List Stores Individual Instructions
+            List<Instruction> instructions = new ArrayList<Instruction>();
+
+            // Call the InstructionBuilder Methods Containing Actions
+            createGotoTableInstructions(ib, goToTableId);
+            ib.setOrder(0);
+            ib.setKey(new InstructionKey(0));
+            instructions.add(ib.build());
+
+            // Add InstructionBuilder to the Instruction(s)Builder List
+            isb.setInstruction(instructions);
+
+            // Add InstructionsBuilder to FlowBuilder
+            flowBuilder.setInstructions(isb.build());
+        }
+
+        String flowId = "TunnelIn_"+segmentationId+"_"+ofPort;
+        // Add Flow Attributes
+        flowBuilder.setId(new FlowId(flowId));
+        FlowKey key = new FlowKey(new FlowId(flowId));
+        flowBuilder.setStrict(true);
+        flowBuilder.setBarrier(false);
+        flowBuilder.setTableId(writeTable);
+        flowBuilder.setKey(key);
+        flowBuilder.setFlowName(flowId);
+        flowBuilder.setHardTimeout(0);
+        flowBuilder.setIdleTimeout(0);
+
+        if (write) {
+            writeFlow(flowBuilder, nodeBuilder);
+        } else {
+            removeFlow(flowBuilder, nodeBuilder);
+        }
+    }
+
+    /*
+     * (Table:0) Ingress VLAN Traffic
+     * Match: OpenFlow InPort and vlan ID
+     * Action: GOTO Local Table (20)
+     * table=0,vlan_id=0x5,in_port=10, actions=goto_table:2
+     */
+
+    private void handleVlanIn(Long dpidLong, Short writeTable, Short goToTableId,
+                      String segmentationId,  Long ethPort, boolean write) {
+
+        String nodeName = "openflow:" + dpidLong;
+
+        MatchBuilder matchBuilder = new MatchBuilder();
+        NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
+        FlowBuilder flowBuilder = new FlowBuilder();
+
+        // Create Match(es) and Set them in the FlowBuilder Object
+        flowBuilder.setMatch(createVlanIdMatch(matchBuilder, new VlanId(Integer.valueOf(segmentationId))).build());
+        flowBuilder.setMatch(createInPortMatch(matchBuilder, dpidLong, ethPort).build());
+
+        if (write) {
+            // Create the OF Actions and Instructions
+            InstructionBuilder ib = new InstructionBuilder();
+            InstructionsBuilder isb = new InstructionsBuilder();
+
+            // Instructions List Stores Individual Instructions
+            List<Instruction> instructions = new ArrayList<Instruction>();
+
+            // Call the InstructionBuilder Methods Containing Actions
+            createGotoTableInstructions(ib, goToTableId);
+            ib.setOrder(0);
+            ib.setKey(new InstructionKey(0));
+            instructions.add(ib.build());
+
+            // Add InstructionBuilder to the Instruction(s)Builder List
+            isb.setInstruction(instructions);
+
+            // Add InstructionsBuilder to FlowBuilder
+            flowBuilder.setInstructions(isb.build());
+        }
+
+        String flowId = "VlanIn_"+segmentationId+"_"+ethPort;
+        // Add Flow Attributes
+        flowBuilder.setId(new FlowId(flowId));
+        FlowKey key = new FlowKey(new FlowId(flowId));
+        flowBuilder.setStrict(true);
+        flowBuilder.setBarrier(false);
+        flowBuilder.setTableId(writeTable);
+        flowBuilder.setKey(key);
+        flowBuilder.setFlowName(flowId);
+        flowBuilder.setHardTimeout(0);
+        flowBuilder.setIdleTimeout(0);
+        if (write) {
+            writeFlow(flowBuilder, nodeBuilder);
+        } else {
+            removeFlow(flowBuilder, nodeBuilder);
+        }
+    }
+
+   /*
+    * (Table:0) Egress VM Traffic Towards TEP
+    * Match: Destination Ethernet Addr and OpenFlow InPort
+    * Instruction: Set TunnelID and GOTO Table Tunnel Table (n)
+    * table=0,in_port=2,dl_src=00:00:00:00:00:01 \
+    * actions=set_field:5->tun_id,goto_table=1"
+    */
+
+    private void handleLocalInPort(Long dpidLong, Short writeTable, Short goToTableId,
+                           String segmentationId, Long inPort, String attachedMac,
+                           boolean write) {
+
+        String nodeName = "openflow:" + dpidLong;
+
+        MatchBuilder matchBuilder = new MatchBuilder();
+        NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
+        FlowBuilder flowBuilder = new FlowBuilder();
+
+        // Create the OF Match using MatchBuilder
+        flowBuilder.setMatch(createEthSrcMatch(matchBuilder, new MacAddress(attachedMac)).build());
+        // TODO Broken In_Port Match
+        flowBuilder.setMatch(createInPortMatch(matchBuilder, dpidLong, inPort).build());
+
+        String flowId = "LocalMac_"+segmentationId+"_"+inPort+"_"+attachedMac;
+        // Add Flow Attributes
+        flowBuilder.setId(new FlowId(flowId));
+        FlowKey key = new FlowKey(new FlowId(flowId));
+        flowBuilder.setStrict(true);
+        flowBuilder.setBarrier(false);
+        flowBuilder.setTableId(writeTable);
+        flowBuilder.setKey(key);
+        flowBuilder.setFlowName(flowId);
+        flowBuilder.setHardTimeout(0);
+        flowBuilder.setIdleTimeout(0);
+
+        if (write) {
+            // Instantiate the Builders for the OF Actions and Instructions
+            InstructionBuilder ib = new InstructionBuilder();
+            InstructionsBuilder isb = new InstructionsBuilder();
+
+            // Instructions List Stores Individual Instructions
+            List<Instruction> instructions = new ArrayList<Instruction>();
+
+            // GOTO Instuctions Need to be added first to the List
+            createGotoTableInstructions(ib, goToTableId);
+            ib.setOrder(0);
+            ib.setKey(new InstructionKey(0));
+            instructions.add(ib.build());
+            // TODO Broken SetTunID
+            createSetTunnelIdInstructions(ib, new BigInteger(segmentationId));
+            ib.setOrder(1);
+            ib.setKey(new InstructionKey(1));
+            instructions.add(ib.build());
+
+            // Add InstructionBuilder to the Instruction(s)Builder List
+            isb.setInstruction(instructions);
+
+            // Add InstructionsBuilder to FlowBuilder
+            flowBuilder.setInstructions(isb.build());
+
+            writeFlow(flowBuilder, nodeBuilder);
+        } else {
+            removeFlow(flowBuilder, nodeBuilder);
+        }
+    }
+
+    /*
+     * (Table:0) Egress VM Traffic Towards TEP
+     * Match: Source Ethernet Addr and OpenFlow InPort
+     * Instruction: Set VLANID and GOTO Table Egress (n)
+     * table=0,in_port=2,dl_src=00:00:00:00:00:01 \
+     * actions=push_vlan, set_field:5->vlan_id,goto_table=1"
+     */
+
+     private void handleLocalInPortSetVlan(Long dpidLong, Short writeTable,
+                                  Short goToTableId, String segmentationId,
+                                  Long inPort, String attachedMac,
+                                  boolean write) {
+
+         String nodeName = "openflow:" + dpidLong;
+
+         MatchBuilder matchBuilder = new MatchBuilder();
+         NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
+         FlowBuilder flowBuilder = new FlowBuilder();
+
+         // Create the OF Match using MatchBuilder
+         flowBuilder.setMatch(createEthSrcMatch(matchBuilder, new MacAddress(attachedMac)).build());
+         // TODO Broken In_Port Match
+         flowBuilder.setMatch(createInPortMatch(matchBuilder, dpidLong, inPort).build());
+
+         String flowId = "LocalMac_"+segmentationId+"_"+inPort+"_"+attachedMac;
+         // Add Flow Attributes
+         flowBuilder.setId(new FlowId(flowId));
+         FlowKey key = new FlowKey(new FlowId(flowId));
+         flowBuilder.setStrict(true);
+         flowBuilder.setBarrier(false);
+         flowBuilder.setTableId(writeTable);
+         flowBuilder.setKey(key);
+         flowBuilder.setFlowName(flowId);
+         flowBuilder.setHardTimeout(0);
+         flowBuilder.setIdleTimeout(0);
+
+         if (write) {
+             // Instantiate the Builders for the OF Actions and Instructions
+             InstructionBuilder ib = new InstructionBuilder();
+             InstructionsBuilder isb = new InstructionsBuilder();
+
+             // Instructions List Stores Individual Instructions
+             List<Instruction> instructions = new ArrayList<Instruction>();
+
+             // GOTO Instructions Need to be added first to the List
+             createGotoTableInstructions(ib, goToTableId);
+             ib.setOrder(0);
+             ib.setKey(new InstructionKey(0));
+             instructions.add(ib.build());
+             // Set VLAN ID Instruction
+             createSetVlanInstructions(ib, new VlanId(Integer.valueOf(segmentationId)));
+             ib.setOrder(1);
+             ib.setKey(new InstructionKey(1));
+             instructions.add(ib.build());
+
+             // Add InstructionBuilder to the Instruction(s)Builder List
+             isb.setInstruction(instructions);
+
+             // Add InstructionsBuilder to FlowBuilder
+             flowBuilder.setInstructions(isb.build());
+
+             writeFlow(flowBuilder, nodeBuilder);
+         } else {
+             removeFlow(flowBuilder, nodeBuilder);
+         }
+     }
+
+    /*
+     * (Table:0) Drop frames source from a VM that do not
+     * match the associated MAC address of the local VM.
+     * Match: Low priority anything not matching the VM SMAC
+     * Instruction: Drop
+     * table=0,priority=16384,in_port=1 actions=drop"
+     */
+
+    private void handleDropSrcIface(Long dpidLong, Long inPort, boolean write) {
+
+        String nodeName = "openflow:" + dpidLong;
+
+        MatchBuilder matchBuilder = new MatchBuilder();
+        NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
+        FlowBuilder flowBuilder = new FlowBuilder();
+
+        // Create the OF Match using MatchBuilder
+        flowBuilder.setMatch(createInPortMatch(matchBuilder, dpidLong, inPort).build());
+
+        if (write) {
+            // Instantiate the Builders for the OF Actions and Instructions
+            InstructionBuilder ib = new InstructionBuilder();
+            InstructionsBuilder isb = new InstructionsBuilder();
+
+            // Instructions List Stores Individual Instructions
+            List<Instruction> instructions = new ArrayList<Instruction>();
+
+            // Call the InstructionBuilder Methods Containing Actions
+            createDropInstructions(ib);
+            ib.setOrder(0);
+            ib.setKey(new InstructionKey(0));
+            instructions.add(ib.build());
+
+            // Add InstructionBuilder to the Instruction(s)Builder List
+            isb.setInstruction(instructions);
+
+            // Add InstructionsBuilder to FlowBuilder
+            flowBuilder.setInstructions(isb.build());
+        }
+
+        String flowId = "DropFilter_"+inPort;
+        // Add Flow Attributes
+        flowBuilder.setId(new FlowId(flowId));
+        FlowKey key = new FlowKey(new FlowId(flowId));
+        flowBuilder.setStrict(true);
+        flowBuilder.setBarrier(false);
+        flowBuilder.setTableId((short) 0);
+        flowBuilder.setKey(key);
+        flowBuilder.setFlowName(flowId);
+        flowBuilder.setPriority(8192);
+        flowBuilder.setHardTimeout(0);
+        flowBuilder.setIdleTimeout(0);
+        if (write) {
+            writeFlow(flowBuilder, nodeBuilder);
+        } else {
+            removeFlow(flowBuilder, nodeBuilder);
+        }
+    }
+
+   /*
+    * (Table:1) Egress Tunnel Traffic
+    * Match: Destination Ethernet Addr and Local InPort
+    * Instruction: Set TunnelID and GOTO Table Tunnel Table (n)
+    * table=1,tun_id=0x5,dl_dst=00:00:00:00:00:08 \
+    * actions=output:10,goto_table:2"
+    */
+    private void handleTunnelOut(Long dpidLong, Short writeTable,
+                         Short goToTableId, String segmentationId,
+                         Long OFPortOut, String attachedMac,
+                         boolean write) {
+
+        String nodeName = "openflow:" + dpidLong;
+
+        MatchBuilder matchBuilder = new MatchBuilder();
+        NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
+        FlowBuilder flowBuilder = new FlowBuilder();
+
+        // Create the OF Match using MatchBuilder
+        flowBuilder.setMatch(createTunnelIDMatch(matchBuilder, new BigInteger(segmentationId)).build());
+        flowBuilder.setMatch(createDestEthMatch(matchBuilder, new MacAddress(attachedMac), null).build());
+
+        String flowId = "TunnelOut_"+segmentationId+"_"+OFPortOut+"_"+attachedMac;
+        // Add Flow Attributes
+        flowBuilder.setId(new FlowId(flowId));
+        FlowKey key = new FlowKey(new FlowId(flowId));
+        flowBuilder.setStrict(true);
+        flowBuilder.setBarrier(false);
+        flowBuilder.setTableId(writeTable);
+        flowBuilder.setKey(key);
+        flowBuilder.setFlowName(flowId);
+        flowBuilder.setHardTimeout(0);
+        flowBuilder.setIdleTimeout(0);
+
+        if (write) {
+            // Instantiate the Builders for the OF Actions and Instructions
+            InstructionBuilder ib = new InstructionBuilder();
+            InstructionsBuilder isb = new InstructionsBuilder();
+
+            // Instructions List Stores Individual Instructions
+            List<Instruction> instructions = new ArrayList<Instruction>();
+
+            // GOTO Instuctions
+            createGotoTableInstructions(ib, goToTableId);
+            ib.setOrder(0);
+            ib.setKey(new InstructionKey(0));
+            instructions.add(ib.build());
+            // Set the Output Port/Iface
+            createOutputPortInstructions(ib, dpidLong, OFPortOut);
+            ib.setOrder(1);
+            ib.setKey(new InstructionKey(1));
+            instructions.add(ib.build());
+
+            // Add InstructionBuilder to the Instruction(s)Builder List
+            isb.setInstruction(instructions);
+
+            // Add InstructionsBuilder to FlowBuilder
+            flowBuilder.setInstructions(isb.build());
+
+            writeFlow(flowBuilder, nodeBuilder);
+        } else {
+            removeFlow(flowBuilder, nodeBuilder);
+        }
+    }
+
+    /*
+     * (Table:1) Egress VLAN Traffic
+     * Match: Destination Ethernet Addr and VLAN id
+     * Instruction: GOTO Table Table 2
+     * table=1,vlan_id=0x5,dl_dst=00:00:00:00:00:08 \
+     * actions= goto_table:2"
+     */
+
+     private void handleVlanOut(Long dpidLong, Short writeTable,
+                        Short goToTableId, String segmentationId,
+                        Long ethPort, String attachedMac, boolean write) {
+
+         String nodeName = "openflow:" + dpidLong;
+
+         MatchBuilder matchBuilder = new MatchBuilder();
+         NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
+         FlowBuilder flowBuilder = new FlowBuilder();
+
+         // Create the OF Match using MatchBuilder
+         flowBuilder.setMatch(createVlanIdMatch(matchBuilder, new VlanId(Integer.valueOf(segmentationId))).build());
+         flowBuilder.setMatch(createDestEthMatch(matchBuilder, new MacAddress(attachedMac), null).build());
+
+         String flowId = "VlanOut_"+segmentationId+"_"+ethPort+"_"+attachedMac;
+         // Add Flow Attributes
+         flowBuilder.setId(new FlowId(flowId));
+         FlowKey key = new FlowKey(new FlowId(flowId));
+         flowBuilder.setStrict(true);
+         flowBuilder.setBarrier(false);
+         flowBuilder.setTableId(writeTable);
+         flowBuilder.setKey(key);
+         flowBuilder.setFlowName(flowId);
+         flowBuilder.setHardTimeout(0);
+         flowBuilder.setIdleTimeout(0);
+
+         if (write) {
+             // Instantiate the Builders for the OF Actions and Instructions
+             InstructionBuilder ib = new InstructionBuilder();
+             InstructionsBuilder isb = new InstructionsBuilder();
+
+             // Instructions List Stores Individual Instructions
+             List<Instruction> instructions = new ArrayList<Instruction>();
+
+             // GOTO Instuctions
+             createGotoTableInstructions(ib, goToTableId);
+             ib.setOrder(0);
+             ib.setKey(new InstructionKey(0));
+             instructions.add(ib.build());
+
+             // Add InstructionBuilder to the Instruction(s)Builder List
+             isb.setInstruction(instructions);
+
+             // Add InstructionsBuilder to FlowBuilder
+             flowBuilder.setInstructions(isb.build());
+
+             writeFlow(flowBuilder, nodeBuilder);
+         } else {
+             removeFlow(flowBuilder, nodeBuilder);
+         }
+     }
+
+       /*
+    * (Table:1) Egress Tunnel Traffic
+    * Match: Destination Ethernet Addr and Local InPort
+    * Instruction: Set TunnelID and GOTO Table Tunnel Table (n)
+    * table=1,priority=16384,tun_id=0x5,dl_dst=ff:ff:ff:ff:ff:ff \
+    * actions=output:10,output:11,goto_table:2
+    */
+
+    private void handleTunnelFloodOut(Long dpidLong, Short writeTable,
+                             Short localTable, String segmentationId,
+                             Long OFPortOut, boolean write) {
+
+        String nodeName = "openflow:" + dpidLong;
+
+        MatchBuilder matchBuilder = new MatchBuilder();
+        NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
+        FlowBuilder flowBuilder = new FlowBuilder();
+
+        // Create the OF Match using MatchBuilder
+        // Match TunnelID
+        flowBuilder.setMatch(createTunnelIDMatch(matchBuilder, new BigInteger(segmentationId)).build());
+        // Match DMAC
+
+        flowBuilder.setMatch(createDestEthMatch(matchBuilder, new MacAddress("01:00:00:00:00:00"), new MacAddress("01:00:00:00:00:00")).build());
+
+        String flowId = "TunnelFloodOut_"+segmentationId;
+        // Add Flow Attributes
+        flowBuilder.setId(new FlowId(flowId));
+        FlowKey key = new FlowKey(new FlowId(flowId));
+        flowBuilder.setBarrier(true);
+        flowBuilder.setTableId(writeTable);
+        flowBuilder.setKey(key);
+        flowBuilder.setPriority(16384);
+        flowBuilder.setFlowName(flowId);
+        flowBuilder.setHardTimeout(0);
+        flowBuilder.setIdleTimeout(0);
+
+        Flow flow = this.getFlow(flowBuilder, nodeBuilder);
+        // Instantiate the Builders for the OF Actions and Instructions
+        InstructionBuilder ib = new InstructionBuilder();
+        InstructionsBuilder isb = new InstructionsBuilder();
+        List<Instruction> instructions = new ArrayList<Instruction>();
+        List<Instruction> existingInstructions = null;
+        if (flow != null) {
+            Instructions ins = flow.getInstructions();
+            if (ins != null) {
+                existingInstructions = ins.getInstruction();
+            }
+        }
+
+        if (write) {
+            // GOTO Instruction
+            createGotoTableInstructions(ib, localTable);
+            ib.setOrder(0);
+            ib.setKey(new InstructionKey(0));
+            instructions.add(ib.build());
+            // Set the Output Port/Iface
+            //createOutputGroupInstructions(nodeBuilder, ib, dpidLong, OFPortOut, existingInstructions);
+            createOutputPortInstructions(ib, dpidLong, OFPortOut, existingInstructions);
+            ib.setOrder(1);
+            ib.setKey(new InstructionKey(1));
+            instructions.add(ib.build());
+
+            // Add InstructionBuilder to the Instruction(s)Builder List
+            isb.setInstruction(instructions);
+
+            // Add InstructionsBuilder to FlowBuilder
+            flowBuilder.setInstructions(isb.build());
+
+            writeFlow(flowBuilder, nodeBuilder);
+        } else {
+            /* remove port from action list */
+            boolean flowRemove = removeOutputPortFromInstructions(ib, dpidLong,
+                                   OFPortOut, existingInstructions);
+            if (flowRemove) {
+                /* if all port are removed, remove the flow too. */
+                removeFlow(flowBuilder, nodeBuilder);
+            } else {
+                /* Install instruction with new output port list*/
+                ib.setOrder(0);
+                ib.setKey(new InstructionKey(0));
+                instructions.add(ib.build());
+
+                // Add InstructionBuilder to the Instruction(s)Builder List
+                isb.setInstruction(instructions);
+
+                // Add InstructionsBuilder to FlowBuilder
+                flowBuilder.setInstructions(isb.build());
+            }
+        }
+    }
+
+    /*
+     * (Table:1) Egress VLAN Traffic
+     * Match: Destination Ethernet Addr and VLAN id
+     * Instruction: GOTO table 2 and Output port eth interface
+     * Example: table=1,priority=16384,vlan_id=0x5,dl_dst=ff:ff:ff:ff:ff:ff \
+     * actions=output:eth1,goto_table:2
+     */
+
+     private void handleVlanFloodOut(Long dpidLong, Short writeTable,
+                           Short localTable, String segmentationId,
+                           Long ethPort, boolean write) {
+
+         String nodeName = "openflow:" + dpidLong;
+
+         MatchBuilder matchBuilder = new MatchBuilder();
+         NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
+         FlowBuilder flowBuilder = new FlowBuilder();
+
+         // Create the OF Match using MatchBuilder
+         // Match Vlan ID
+         flowBuilder.setMatch(createVlanIdMatch(matchBuilder, new VlanId(Integer.valueOf(segmentationId))).build());
+         // Match DMAC
+         flowBuilder.setMatch(createDestEthMatch(matchBuilder, new MacAddress("01:00:00:00:00:00"), new MacAddress("01:00:00:00:00:00")).build());
+
+         String flowId = "VlanFloodOut_"+segmentationId;
+         // Add Flow Attributes
+         flowBuilder.setId(new FlowId(flowId));
+         FlowKey key = new FlowKey(new FlowId(flowId));
+         flowBuilder.setBarrier(true);
+         flowBuilder.setTableId(writeTable);
+         flowBuilder.setKey(key);
+         flowBuilder.setPriority(16384);
+         flowBuilder.setFlowName(flowId);
+         flowBuilder.setHardTimeout(0);
+         flowBuilder.setIdleTimeout(0);
+
+         Flow flow = this.getFlow(flowBuilder, nodeBuilder);
+         // Instantiate the Builders for the OF Actions and Instructions
+         InstructionBuilder ib = new InstructionBuilder();
+         InstructionsBuilder isb = new InstructionsBuilder();
+         List<Instruction> instructions = new ArrayList<Instruction>();
+
+         if (write) {
+             // GOTO Instuction
+             createGotoTableInstructions(ib, localTable);
+             ib.setOrder(0);
+             ib.setKey(new InstructionKey(0));
+             instructions.add(ib.build());
+             // Set the Output Port/Iface
+             createOutputPortInstructions(ib, dpidLong, ethPort);
+             ib.setOrder(1);
+             ib.setKey(new InstructionKey(1));
+             instructions.add(ib.build());
+
+             // Add InstructionBuilder to the Instruction(s)Builder List
+             isb.setInstruction(instructions);
+
+             // Add InstructionsBuilder to FlowBuilder
+             flowBuilder.setInstructions(isb.build());
+
+             writeFlow(flowBuilder, nodeBuilder);
+         } else {
+             removeFlow(flowBuilder, nodeBuilder);
+         }
+     }
+
+   /*
+    * (Table:1) Table Drain w/ Catch All
+    * Match: Tunnel ID
+    * Action: GOTO Local Table (10)
+    * table=2,priority=8192,tun_id=0x5 actions=drop
+    */
+
+    private void handleTunnelMiss(Long dpidLong, Short writeTable,
+                          Short goToTableId, String segmentationId,
+                          boolean write) {
+
+        String nodeName = "openflow:" + dpidLong;
+
+        MatchBuilder matchBuilder = new MatchBuilder();
+        NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
+        FlowBuilder flowBuilder = new FlowBuilder();
+
+        // Create Match(es) and Set them in the FlowBuilder Object
+        flowBuilder.setMatch(createTunnelIDMatch(matchBuilder, new BigInteger(segmentationId)).build());
+
+        if (write) {
+            // Create the OF Actions and Instructions
+            InstructionBuilder ib = new InstructionBuilder();
+            InstructionsBuilder isb = new InstructionsBuilder();
+
+            // Instructions List Stores Individual Instructions
+            List<Instruction> instructions = new ArrayList<Instruction>();
+
+            // Call the InstructionBuilder Methods Containing Actions
+            createGotoTableInstructions(ib, goToTableId);
+            ib.setOrder(0);
+            ib.setKey(new InstructionKey(0));
+            instructions.add(ib.build());
+
+            // Add InstructionBuilder to the Instruction(s)Builder List
+            isb.setInstruction(instructions);
+
+            // Add InstructionsBuilder to FlowBuilder
+            flowBuilder.setInstructions(isb.build());
+        }
+
+        String flowId = "TunnelMiss_"+segmentationId;
+        // Add Flow Attributes
+        flowBuilder.setId(new FlowId(flowId));
+        FlowKey key = new FlowKey(new FlowId(flowId));
+        flowBuilder.setStrict(true);
+        flowBuilder.setBarrier(false);
+        flowBuilder.setTableId(writeTable);
+        flowBuilder.setKey(key);
+        flowBuilder.setPriority(8192);
+        flowBuilder.setFlowName(flowId);
+        flowBuilder.setHardTimeout(0);
+        flowBuilder.setIdleTimeout(0);
+        if (write) {
+            writeFlow(flowBuilder, nodeBuilder);
+        } else {
+            removeFlow(flowBuilder, nodeBuilder);
+        }
+    }
+
+
+    /*
+     * (Table:1) Table Drain w/ Catch All
+     * Match: Vlan ID
+     * Action: Output port eth interface
+     * table=1,priority=8192,vlan_id=0x5 actions= output port:eth1
+     */
+
+     private void handleVlanMiss(Long dpidLong, Short writeTable,
+                         Short goToTableId, String segmentationId,
+                         Long ethPort, boolean write) {
+
+         String nodeName = "openflow:" + dpidLong;
+
+         MatchBuilder matchBuilder = new MatchBuilder();
+         NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
+         FlowBuilder flowBuilder = new FlowBuilder();
+
+         // Create Match(es) and Set them in the FlowBuilder Object
+         flowBuilder.setMatch(createVlanIdMatch(matchBuilder, new VlanId(Integer.valueOf(segmentationId))).build());
+
+         if (write) {
+             // Create the OF Actions and Instructions
+             InstructionBuilder ib = new InstructionBuilder();
+             InstructionsBuilder isb = new InstructionsBuilder();
+
+             // Instructions List Stores Individual Instructions
+             List<Instruction> instructions = new ArrayList<Instruction>();
+
+             // Call the InstructionBuilder Methods Containing Actions
+             //createGotoTableInstructions(ib, goToTableId);
+             //ib.setOrder(0);
+             //ib.setKey(new InstructionKey(0));
+             //instructions.add(ib.build());
+             // Set the Output Port/Iface
+             createOutputPortInstructions(ib, dpidLong, ethPort);
+             ib.setOrder(0);
+             ib.setKey(new InstructionKey(1));
+             instructions.add(ib.build());
+
+             // Add InstructionBuilder to the Instruction(s)Builder List
+             isb.setInstruction(instructions);
+
+             // Add InstructionsBuilder to FlowBuilder
+             flowBuilder.setInstructions(isb.build());
+         }
+
+         String flowId = "VlanMiss_"+segmentationId;
+         // Add Flow Attributes
+         flowBuilder.setId(new FlowId(flowId));
+         FlowKey key = new FlowKey(new FlowId(flowId));
+         flowBuilder.setStrict(true);
+         flowBuilder.setBarrier(false);
+         flowBuilder.setTableId(writeTable);
+         flowBuilder.setKey(key);
+         flowBuilder.setPriority(8192);
+         flowBuilder.setFlowName(flowId);
+         flowBuilder.setHardTimeout(0);
+         flowBuilder.setIdleTimeout(0);
+         if (write) {
+             writeFlow(flowBuilder, nodeBuilder);
+         } else {
+             removeFlow(flowBuilder, nodeBuilder);
+         }
+     }
+
+    /*
+     * (Table:1) Local Broadcast Flood
+     * Match: Tunnel ID and dMAC
+     * Action: Output Port
+     * table=2,tun_id=0x5,dl_dst=00:00:00:00:00:01 actions=output:2
+     */
+
+    private void handleLocalUcastOut(Long dpidLong, Short writeTable,
+                             String segmentationId, Long localPort,
+                             String attachedMac, boolean write) {
+
+        String nodeName = "openflow:" + dpidLong;
+
+        MatchBuilder matchBuilder = new MatchBuilder();
+        NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
+        FlowBuilder flowBuilder = new FlowBuilder();
+
+        // Create the OF Match using MatchBuilder
+        flowBuilder.setMatch(createTunnelIDMatch(matchBuilder, new BigInteger(segmentationId)).build());
+        flowBuilder.setMatch(createDestEthMatch(matchBuilder, new MacAddress(attachedMac), null).build());
+
+        String flowId = "UcastOut_"+segmentationId+"_"+localPort+"_"+attachedMac;
+        // Add Flow Attributes
+        flowBuilder.setId(new FlowId(flowId));
+        FlowKey key = new FlowKey(new FlowId(flowId));
+        flowBuilder.setStrict(true);
+        flowBuilder.setBarrier(false);
+        flowBuilder.setTableId(writeTable);
+        flowBuilder.setKey(key);
+        flowBuilder.setFlowName(flowId);
+        flowBuilder.setHardTimeout(0);
+        flowBuilder.setIdleTimeout(0);
+
+        if (write) {
+            // Instantiate the Builders for the OF Actions and Instructions
+            InstructionBuilder ib = new InstructionBuilder();
+            InstructionsBuilder isb = new InstructionsBuilder();
+
+            // Instructions List Stores Individual Instructions
+            List<Instruction> instructions = new ArrayList<Instruction>();
+
+            // Set the Output Port/Iface
+            createOutputPortInstructions(ib, dpidLong, localPort);
+            ib.setOrder(0);
+            ib.setKey(new InstructionKey(0));
+            instructions.add(ib.build());
+
+            // Add InstructionBuilder to the Instruction(s)Builder List
+            isb.setInstruction(instructions);
+
+            // Add InstructionsBuilder to FlowBuilder
+            flowBuilder.setInstructions(isb.build());
+            writeFlow(flowBuilder, nodeBuilder);
+        } else {
+            removeFlow(flowBuilder, nodeBuilder);
+        }
+    }
+
+    /*
+     * (Table:2) Local VLAN unicast
+     * Match: VLAN ID and dMAC
+     * Action: Output Port
+     * table=2,vlan_id=0x5,dl_dst=00:00:00:00:00:01 actions=output:2
+     */
+
+    private void handleLocalVlanUcastOut(Long dpidLong, Short writeTable,
+                                 String segmentationId, Long localPort,
+                                 String attachedMac, boolean write) {
+
+        String nodeName = "openflow:" + dpidLong;
+
+        MatchBuilder matchBuilder = new MatchBuilder();
+        NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
+        FlowBuilder flowBuilder = new FlowBuilder();
+
+        // Create the OF Match using MatchBuilder
+        flowBuilder.setMatch(createVlanIdMatch(matchBuilder, new VlanId(Integer.valueOf(segmentationId))).build());
+        flowBuilder.setMatch(createDestEthMatch(matchBuilder, new MacAddress(attachedMac), null).build());
+
+        String flowId = "VlanUcastOut_"+segmentationId+"_"+localPort+"_"+attachedMac;
+        // Add Flow Attributes
+        flowBuilder.setId(new FlowId(flowId));
+        FlowKey key = new FlowKey(new FlowId(flowId));
+        flowBuilder.setStrict(true);
+        flowBuilder.setBarrier(false);
+        flowBuilder.setTableId(writeTable);
+        flowBuilder.setKey(key);
+        flowBuilder.setFlowName(flowId);
+        flowBuilder.setHardTimeout(0);
+        flowBuilder.setIdleTimeout(0);
+
+        if (write) {
+            // Instantiate the Builders for the OF Actions and Instructions
+            InstructionBuilder ib = new InstructionBuilder();
+            InstructionsBuilder isb = new InstructionsBuilder();
+
+            // Instructions List Stores Individual Instructions
+            List<Instruction> instructions = new ArrayList<Instruction>();
+            List<Instruction> instructions_tmp = new ArrayList<Instruction>();
+
+            /* Strip vlan and store to tmp instruction space*/
+            createPopVlanInstructions(ib);
+            ib.setOrder(0);
+            ib.setKey(new InstructionKey(0));
+            instructions_tmp.add(ib.build());
+
+            // Set the Output Port/Iface
+            ib = new InstructionBuilder();
+            addOutputPortInstructions(ib, dpidLong, localPort, instructions_tmp);
+            ib.setOrder(0);
+            ib.setKey(new InstructionKey(0));
+            instructions.add(ib.build());
+
+            // Add InstructionBuilder to the Instruction(s)Builder List
+            isb.setInstruction(instructions);
+
+            // Add InstructionsBuilder to FlowBuilder
+            flowBuilder.setInstructions(isb.build());
+            writeFlow(flowBuilder, nodeBuilder);
+        } else {
+            removeFlow(flowBuilder, nodeBuilder);
+        }
+    }
+
+    /*
+     * (Table:2) Local Broadcast Flood
+     * Match: Tunnel ID and dMAC (::::FF:FF)
+     * table=2,priority=16384,tun_id=0x5,dl_dst=ff:ff:ff:ff:ff:ff \
+     * actions=output:2,3,4,5
+     */
+
+    private void handleLocalBcastOut(Long dpidLong, Short writeTable,
+                             String segmentationId, Long localPort,
+                             boolean write) {
+
+        String nodeName = "openflow:" + dpidLong;
+
+        MatchBuilder matchBuilder = new MatchBuilder();
+        NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
+        FlowBuilder flowBuilder = new FlowBuilder();
+
+        // Create the OF Match using MatchBuilder
+        flowBuilder.setMatch(createTunnelIDMatch(matchBuilder, new BigInteger(segmentationId)).build());
+        flowBuilder.setMatch(createDestEthMatch(matchBuilder, new MacAddress("01:00:00:00:00:00"), new MacAddress("01:00:00:00:00:00")).build());
+
+        String flowId = "BcastOut_"+segmentationId;
+        // Add Flow Attributes
+        flowBuilder.setId(new FlowId(flowId));
+        FlowKey key = new FlowKey(new FlowId(flowId));
+        flowBuilder.setStrict(true);
+        flowBuilder.setBarrier(false);
+        flowBuilder.setTableId(writeTable);
+        flowBuilder.setKey(key);
+        flowBuilder.setPriority(16384);
+        flowBuilder.setFlowName(flowId);
+        flowBuilder.setHardTimeout(0);
+        flowBuilder.setIdleTimeout(0);
+        Flow flow = this.getFlow(flowBuilder, nodeBuilder);
+        // Instantiate the Builders for the OF Actions and Instructions
+        InstructionBuilder ib = new InstructionBuilder();
+        InstructionsBuilder isb = new InstructionsBuilder();
+        List<Instruction> instructions = new ArrayList<Instruction>();
+        List<Instruction> existingInstructions = null;
+        if (flow != null) {
+            Instructions ins = flow.getInstructions();
+            if (ins != null) {
+                existingInstructions = ins.getInstruction();
+            }
+        }
+
+        if (write) {
+            // Create output port list
+            createOutputPortInstructions(ib, dpidLong, localPort, existingInstructions);
+            ib.setOrder(0);
+            ib.setKey(new InstructionKey(0));
+            instructions.add(ib.build());
+
+            // Add InstructionBuilder to the Instruction(s)Builder List
+            isb.setInstruction(instructions);
+
+            // Add InstructionsBuilder to FlowBuilder
+            flowBuilder.setInstructions(isb.build());
+
+            writeFlow(flowBuilder, nodeBuilder);
+        } else {
+            boolean flowRemove = removeOutputPortFromInstructions(ib, dpidLong, localPort,
+                                                                  existingInstructions);
+            if (flowRemove) {
+                /* if all ports are removed, remove flow */
+                removeFlow(flowBuilder, nodeBuilder);
+            } else {
+                /* Install instruction with new output port list*/
+                ib.setOrder(0);
+                ib.setKey(new InstructionKey(0));
+                instructions.add(ib.build());
+
+                // Add InstructionBuilder to the Instruction(s)Builder List
+                isb.setInstruction(instructions);
+
+                // Add InstructionsBuilder to FlowBuilder
+                flowBuilder.setInstructions(isb.build());
+
+                writeFlow(flowBuilder, nodeBuilder);
+            }
+        }
+    }
+
+    /*
+     * (Table:2) Local VLAN Broadcast Flood
+     * Match: vlan ID and dMAC (::::FF:FF)
+     * table=2,priority=16384,vlan_id=0x5,dl_dst=ff:ff:ff:ff:ff:ff \
+     * actions=strip_vlan, output:2,3,4,5
+     */
+
+    private void handleLocalVlanBcastOut(Long dpidLong, Short writeTable,
+                                 String segmentationId, Long localPort,
+                                 boolean write) {
+
+        String nodeName = "openflow:" + dpidLong;
+
+        MatchBuilder matchBuilder = new MatchBuilder();
+        NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
+        FlowBuilder flowBuilder = new FlowBuilder();
+
+        // Create the OF Match using MatchBuilder
+        flowBuilder.setMatch(createVlanIdMatch(matchBuilder, new VlanId(Integer.valueOf(segmentationId))).build());
+        flowBuilder.setMatch(createDestEthMatch(matchBuilder, new MacAddress("01:00:00:00:00:00"), new MacAddress("01:00:00:00:00:00")).build());
+
+        String flowId = "VlanBcastOut_"+segmentationId;
+        // Add Flow Attributes
+        flowBuilder.setId(new FlowId(flowId));
+        FlowKey key = new FlowKey(new FlowId(flowId));
+        flowBuilder.setStrict(true);
+        flowBuilder.setBarrier(false);
+        flowBuilder.setTableId(writeTable);
+        flowBuilder.setKey(key);
+        flowBuilder.setPriority(16384);
+        flowBuilder.setFlowName(flowId);
+        flowBuilder.setHardTimeout(0);
+        flowBuilder.setIdleTimeout(0);
+        Flow flow = this.getFlow(flowBuilder, nodeBuilder);
+        // Instantiate the Builders for the OF Actions and Instructions
+        InstructionBuilder ib = new InstructionBuilder();
+        InstructionsBuilder isb = new InstructionsBuilder();
+        List<Instruction> instructions = new ArrayList<Instruction>();
+        List<Instruction> existingInstructions = null;
+        boolean add_pop_vlan = true;
+        if (flow != null) {
+            Instructions ins = flow.getInstructions();
+            if (ins != null) {
+                existingInstructions = ins.getInstruction();
+            }
+        }
+
+        if (write) {
+            if (existingInstructions != null) {
+                /* Check if pop vlan is already the first action in action list */
+                List<Action> existingActions = null;
+                for (Instruction in : existingInstructions) {
+                    if (in.getInstruction() instanceof ApplyActionsCase) {
+                        existingActions = (((ApplyActionsCase)
+                                in.getInstruction()).getApplyActions().getAction());
+                        if (existingActions.get(0).getAction() instanceof PopVlanActionCase) {
+                            add_pop_vlan = false;
+                            break;
+                        }
+                    }
+                }
+            } else {
+                existingInstructions = new ArrayList<Instruction>();
+            }
+
+            if (add_pop_vlan) {
+                /* pop vlan */
+                createPopVlanInstructions(ib);
+                ib.setOrder(0);
+                ib.setKey(new InstructionKey(0));
+                existingInstructions.add(ib.build());
+                ib = new InstructionBuilder();
+            }
+
+            // Create port list
+            //createOutputGroupInstructions(nodeBuilder, ib, dpidLong, localPort, existingInstructions);
+            createOutputPortInstructions(ib, dpidLong, localPort, existingInstructions);
+            ib.setOrder(0);
+            ib.setKey(new InstructionKey(0));
+            instructions.add(ib.build());
+
+            // Add InstructionBuilder to the Instruction(s)Builder List
+            isb.setInstruction(instructions);
+
+            // Add InstructionsBuilder to FlowBuilder
+            flowBuilder.setInstructions(isb.build());
+
+            writeFlow(flowBuilder, nodeBuilder);
+        } else {
+            //boolean flowRemove = removeOutputPortFromGroup(nodeBuilder, ib, dpidLong,
+            //                     localPort, existingInstructions);
+            boolean flowRemove = removeOutputPortFromInstructions(ib, dpidLong,
+                                                    localPort, existingInstructions);
+            if (flowRemove) {
+                /* if all ports are removed, remove flow */
+                removeFlow(flowBuilder, nodeBuilder);
+            } else {
+                /* Install instruction with new output port list*/
+                ib.setOrder(0);
+                ib.setKey(new InstructionKey(0));
+                instructions.add(ib.build());
+
+                // Add InstructionBuilder to the Instruction(s)Builder List
+                isb.setInstruction(instructions);
+
+                // Add InstructionsBuilder to FlowBuilder
+                flowBuilder.setInstructions(isb.build());
+                writeFlow(flowBuilder, nodeBuilder);
+            }
+        }
+    }
+
+    /*
+     * (Table:1) Local Table Miss
+     * Match: Any Remaining Flows w/a TunID
+     * Action: Drop w/ a low priority
+     * table=2,priority=8192,tun_id=0x5 actions=drop
+     */
+
+    private void handleLocalTableMiss(Long dpidLong, Short writeTable,
+                             String segmentationId, boolean write) {
+
+        String nodeName = "openflow:" + dpidLong;
+
+        MatchBuilder matchBuilder = new MatchBuilder();
+        NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
+        FlowBuilder flowBuilder = new FlowBuilder();
+
+        // Create Match(es) and Set them in the FlowBuilder Object
+        flowBuilder.setMatch(createTunnelIDMatch(matchBuilder, new BigInteger(segmentationId)).build());
+
+        if (write) {
+            // Create the OF Actions and Instructions
+            InstructionBuilder ib = new InstructionBuilder();
+            InstructionsBuilder isb = new InstructionsBuilder();
+
+            // Instructions List Stores Individual Instructions
+            List<Instruction> instructions = new ArrayList<Instruction>();
+
+            // Call the InstructionBuilder Methods Containing Actions
+            createDropInstructions(ib);
+            ib.setOrder(0);
+            ib.setKey(new InstructionKey(0));
+            instructions.add(ib.build());
+
+            // Add InstructionBuilder to the Instruction(s)Builder List
+            isb.setInstruction(instructions);
+
+            // Add InstructionsBuilder to FlowBuilder
+            flowBuilder.setInstructions(isb.build());
+        }
+
+        String flowId = "LocalTableMiss_"+segmentationId;
+        // Add Flow Attributes
+        flowBuilder.setId(new FlowId(flowId));
+        FlowKey key = new FlowKey(new FlowId(flowId));
+        flowBuilder.setStrict(true);
+        flowBuilder.setBarrier(false);
+        flowBuilder.setTableId(writeTable);
+        flowBuilder.setKey(key);
+        flowBuilder.setPriority(8192);
+        flowBuilder.setFlowName(flowId);
+        flowBuilder.setHardTimeout(0);
+        flowBuilder.setIdleTimeout(0);
+        if (write) {
+            writeFlow(flowBuilder, nodeBuilder);
+        } else {
+            removeFlow(flowBuilder, nodeBuilder);
+        }
+    }
+
+    /*
+     * (Table:1) Local Table Miss
+     * Match: Any Remaining Flows w/a VLAN ID
+     * Action: Drop w/ a low priority
+     * table=2,priority=8192,vlan_id=0x5 actions=drop
+     */
+
+    private void handleLocalVlanTableMiss(Long dpidLong, Short writeTable,
+                                  String segmentationId, boolean write) {
+
+        String nodeName = "openflow:" + dpidLong;
+
+        MatchBuilder matchBuilder = new MatchBuilder();
+        NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
+        FlowBuilder flowBuilder = new FlowBuilder();
+
+        // Create Match(es) and Set them in the FlowBuilder Object
+        flowBuilder.setMatch(createVlanIdMatch(matchBuilder, new VlanId(Integer.valueOf(segmentationId))).build());
+
+        if (write) {
+            // Create the OF Actions and Instructions
+            InstructionBuilder ib = new InstructionBuilder();
+            InstructionsBuilder isb = new InstructionsBuilder();
+
+            // Instructions List Stores Individual Instructions
+            List<Instruction> instructions = new ArrayList<Instruction>();
+
+            // Call the InstructionBuilder Methods Containing Actions
+            createDropInstructions(ib);
+            ib.setOrder(0);
+            ib.setKey(new InstructionKey(0));
+            instructions.add(ib.build());
+
+            // Add InstructionBuilder to the Instruction(s)Builder List
+            isb.setInstruction(instructions);
+
+            // Add InstructionsBuilder to FlowBuilder
+            flowBuilder.setInstructions(isb.build());
+        }
+
+        String flowId = "LocalTableMiss_"+segmentationId;
+        // Add Flow Attributes
+        flowBuilder.setId(new FlowId(flowId));
+        FlowKey key = new FlowKey(new FlowId(flowId));
+        flowBuilder.setStrict(true);
+        flowBuilder.setBarrier(false);
+        flowBuilder.setTableId(writeTable);
+        flowBuilder.setKey(key);
+        flowBuilder.setPriority(8192);
+        flowBuilder.setFlowName(flowId);
+        flowBuilder.setHardTimeout(0);
+        flowBuilder.setIdleTimeout(0);
+        if (write) {
+            writeFlow(flowBuilder, nodeBuilder);
+        } else {
+            removeFlow(flowBuilder, nodeBuilder);
+        }
+    }
+
+    private Group getGroup(GroupBuilder groupBuilder, NodeBuilder nodeBuilder) {
+        IMDSALConsumer mdsalConsumer = (IMDSALConsumer) ServiceHelper.getInstance(IMDSALConsumer.class, "default", this);
+        if (mdsalConsumer == null) {
+            logger.error("ERROR finding MDSAL Service. Its possible that writeFlow is called too soon ?");
+            return null;
+        }
+
+        dataBrokerService = mdsalConsumer.getDataBrokerService();
+
+        if (dataBrokerService == null) {
+            logger.error("ERROR finding reference for DataBrokerService. Please check out the MD-SAL support on the Controller.");
+            return null;
+        }
+
+        InstanceIdentifier<Group> path1 = InstanceIdentifier.builder(Nodes.class).child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory
+                .rev130819.nodes.Node.class, nodeBuilder.getKey()).augmentation(FlowCapableNode.class).child(Group.class,
+                new GroupKey(groupBuilder.getGroupId())).build();
+        return (Group)dataBrokerService.readConfigurationData(path1);
+    }
+
+    private Group writeGroup(GroupBuilder groupBuilder, NodeBuilder nodeBuilder) {
+        IMDSALConsumer mdsalConsumer = (IMDSALConsumer) ServiceHelper.getInstance(IMDSALConsumer.class, "default", this);
+        if (mdsalConsumer == null) {
+            logger.error("ERROR finding MDSAL Service. Its possible that writeFlow is called too soon ?");
+            return null;
+        }
+
+        dataBrokerService = mdsalConsumer.getDataBrokerService();
+
+        if (dataBrokerService == null) {
+            logger.error("ERROR finding reference for DataBrokerService. Please check out the MD-SAL support on the Controller.");
+            return null;
+        }
+        DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
+        InstanceIdentifier<Group> path1 = InstanceIdentifier.builder(Nodes.class).child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory
+                .rev130819.nodes.Node.class, nodeBuilder.getKey()).augmentation(FlowCapableNode.class).child(Group.class,
+                new GroupKey(groupBuilder.getGroupId())).build();
+        modification.putConfigurationData(nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
+        modification.putConfigurationData(path1, groupBuilder.build());
+        Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
+
+        try {
+            RpcResult<TransactionStatus> result = commitFuture.get();
+            TransactionStatus status = result.getResult();
+            logger.debug("Transaction Status "+status.toString()+" for Group "+groupBuilder.getGroupName());
+        } catch (InterruptedException e) {
+            logger.error(e.getMessage(), e);
+        } catch (ExecutionException e) {
+            logger.error(e.getMessage(), e);
+        }
+        return (Group)dataBrokerService.readConfigurationData(path1);
+    }
+
+    private Group removeGroup(GroupBuilder groupBuilder, NodeBuilder nodeBuilder) {
+        IMDSALConsumer mdsalConsumer = (IMDSALConsumer) ServiceHelper.getInstance(IMDSALConsumer.class, "default", this);
+        if (mdsalConsumer == null) {
+            logger.error("ERROR finding MDSAL Service. Its possible that writeFlow is called too soon ?");
+            return null;
+        }
+
+        dataBrokerService = mdsalConsumer.getDataBrokerService();
+
+        if (dataBrokerService == null) {
+            logger.error("ERROR finding reference for DataBrokerService. Please check out the MD-SAL support on the Controller.");
+            return null;
+        }
+        DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
+        InstanceIdentifier<Group> path1 = InstanceIdentifier.builder(Nodes.class).child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory
+                .rev130819.nodes.Node.class, nodeBuilder.getKey()).augmentation(FlowCapableNode.class).child(Group.class,
+                new GroupKey(groupBuilder.getGroupId())).build();
+        modification.removeConfigurationData(path1);
+        Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
+
+        try {
+            RpcResult<TransactionStatus> result = commitFuture.get();
+            TransactionStatus status = result.getResult();
+            logger.debug("Transaction Status "+status.toString()+" for Group "+groupBuilder.getGroupName());
+        } catch (InterruptedException e) {
+            logger.error(e.getMessage(), e);
+        } catch (ExecutionException e) {
+            logger.error(e.getMessage(), e);
+        }
+        return (Group)dataBrokerService.readConfigurationData(path1);
+    }
+    private Flow getFlow(FlowBuilder flowBuilder, NodeBuilder nodeBuilder) {
+        IMDSALConsumer mdsalConsumer = (IMDSALConsumer) ServiceHelper.getInstance(IMDSALConsumer.class, "default", this);
+        if (mdsalConsumer == null) {
+            logger.error("ERROR finding MDSAL Service. Its possible that writeFlow is called too soon ?");
+            return null;
+        }
+
+        dataBrokerService = mdsalConsumer.getDataBrokerService();
+
+        if (dataBrokerService == null) {
+            logger.error("ERROR finding reference for DataBrokerService. Please check out the MD-SAL support on the Controller.");
+            return null;
+        }
+
+        InstanceIdentifier<Flow> path1 = InstanceIdentifier.builder(Nodes.class).child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory
+                .rev130819.nodes.Node.class, nodeBuilder.getKey()).augmentation(FlowCapableNode.class).child(Table.class,
+                new TableKey(flowBuilder.getTableId())).child(Flow.class, flowBuilder.getKey()).build();
+        return (Flow)dataBrokerService.readConfigurationData(path1);
+    }
+
+    private void writeFlow(FlowBuilder flowBuilder, NodeBuilder nodeBuilder) {
+        IMDSALConsumer mdsalConsumer = (IMDSALConsumer) ServiceHelper.getInstance(IMDSALConsumer.class, "default", this);
+        if (mdsalConsumer == null) {
+            logger.error("ERROR finding MDSAL Service. Its possible that writeFlow is called too soon ?");
+            return;
+        }
+
+        dataBrokerService = mdsalConsumer.getDataBrokerService();
+
+        if (dataBrokerService == null) {
+            logger.error("ERROR finding reference for DataBrokerService. Please check out the MD-SAL support on the Controller.");
+            return;
+        }
+        DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
+        InstanceIdentifier<Flow> path1 = InstanceIdentifier.builder(Nodes.class).child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory
+                .rev130819.nodes.Node.class, nodeBuilder.getKey()).augmentation(FlowCapableNode.class).child(Table.class,
+                new TableKey(flowBuilder.getTableId())).child(Flow.class, flowBuilder.getKey()).build();
+        //modification.putOperationalData(nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
+        //modification.putOperationalData(path1, flowBuilder.build());
+        modification.putConfigurationData(nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
+        modification.putConfigurationData(path1, flowBuilder.build());
+        Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
+        try {
+            RpcResult<TransactionStatus> result = commitFuture.get();
+            TransactionStatus status = result.getResult();
+            logger.debug("Transaction Status "+status.toString()+" for Flow "+flowBuilder.getFlowName());
+        } catch (InterruptedException e) {
+            logger.error(e.getMessage(), e);
+        } catch (ExecutionException e) {
+            logger.error(e.getMessage(), e);
+        }
+    }
+
+    private void removeFlow(FlowBuilder flowBuilder, NodeBuilder nodeBuilder) {
+        IMDSALConsumer mdsalConsumer = (IMDSALConsumer) ServiceHelper.getInstance(IMDSALConsumer.class, "default", this);
+        if (mdsalConsumer == null) {
+            logger.error("ERROR finding MDSAL Service.");
+            return;
+        }
+
+        dataBrokerService = mdsalConsumer.getDataBrokerService();
+
+        if (dataBrokerService == null) {
+            logger.error("ERROR finding reference for DataBrokerService. Please check out the MD-SAL support on the Controller.");
+            return;
+        }
+        DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
+        InstanceIdentifier<Flow> path1 = InstanceIdentifier.builder(Nodes.class)
+                .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory
+                .rev130819.nodes.Node.class, nodeBuilder.getKey())
+                .augmentation(FlowCapableNode.class).child(Table.class,
+                new TableKey(flowBuilder.getTableId())).child(Flow.class, flowBuilder.getKey()).build();
+        //modification.removeOperationalData(nodeBuilderToInstanceId(nodeBuilder));
+        //modification.removeOperationalData(path1);
+        //modification.removeConfigurationData(nodeBuilderToInstanceId(nodeBuilder));
+        modification.removeConfigurationData(path1);
+        Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
+        try {
+            RpcResult<TransactionStatus> result = commitFuture.get();
+            TransactionStatus status = result.getResult();
+            logger.debug("Transaction Status "+status.toString()+" for Flow "+flowBuilder.getFlowName());
+        } catch (InterruptedException e) {
+            logger.error(e.getMessage(), e);
+        } catch (ExecutionException e) {
+            logger.error(e.getMessage(), e);
+        }
+    }
+
+    /**
+     * Create Ingress Port Match dpidLong, inPort
+     *
+     * @param matchBuilder  Map matchBuilder MatchBuilder Object without a match
+     * @param dpidLong      Long the datapath ID of a switch/node
+     * @param inPort        Long ingress port on a switch
+     * @return matchBuilder Map MatchBuilder Object with a match
+     */
+    protected static MatchBuilder createInPortMatch(MatchBuilder matchBuilder, Long dpidLong, Long inPort) {
+
+        NodeConnectorId ncid = new NodeConnectorId("openflow:" + dpidLong + ":" + inPort);
+        logger.debug("createInPortMatch() Node Connector ID is - Type=openflow: DPID={} inPort={} ", dpidLong, inPort);
+        matchBuilder.setInPort(NodeConnectorId.getDefaultInstance(ncid.getValue()));
+        matchBuilder.setInPort(ncid);
+
+        return matchBuilder;
+    }
+
+    /**
+     * Create EtherType Match
+     *
+     * @param matchBuilder  Map matchBuilder MatchBuilder Object without a match
+     * @param etherType     Long EtherType
+     * @return matchBuilder Map MatchBuilder Object with a match
+     */
+    protected static MatchBuilder createEtherTypeMatch(MatchBuilder matchBuilder, EtherType etherType) {
+
+        EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
+        EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
+        ethTypeBuilder.setType(new EtherType(etherType));
+        ethernetMatch.setEthernetType(ethTypeBuilder.build());
+        matchBuilder.setEthernetMatch(ethernetMatch.build());
+
+        return matchBuilder;
+    }
+
+    /**
+     * Create Ethernet Source Match
+     *
+     * @param matchBuilder  MatchBuilder Object without a match yet
+     * @param sMacAddr      String representing a source MAC
+     * @return matchBuilder Map MatchBuilder Object with a match
+     */
+    protected static MatchBuilder createEthSrcMatch(MatchBuilder matchBuilder, MacAddress sMacAddr) {
+
+        EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
+        EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
+        ethSourceBuilder.setAddress(new MacAddress(sMacAddr));
+        ethernetMatch.setEthernetSource(ethSourceBuilder.build());
+        matchBuilder.setEthernetMatch(ethernetMatch.build());
+
+        return matchBuilder;
+    }
+
+    /**
+     * Create Ethernet Destination Match
+     *
+     * @param matchBuilder MatchBuilder Object without a match yet
+     * @param vlanId       Integer representing a VLAN ID Integer representing a VLAN ID
+     * @return matchBuilder Map MatchBuilder Object with a match
+     */
+
+    protected static MatchBuilder createVlanIdMatch(MatchBuilder matchBuilder, VlanId vlanId) {
+        VlanMatchBuilder vlanMatchBuilder = new VlanMatchBuilder();
+        VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
+        vlanIdBuilder.setVlanId(new VlanId(vlanId));
+        vlanIdBuilder.setVlanIdPresent(true);
+        vlanMatchBuilder.setVlanId(vlanIdBuilder.build());
+        matchBuilder.setVlanMatch(vlanMatchBuilder.build());
+
+        return matchBuilder;
+    }
+
+    /**
+     * Create Ethernet Destination Match
+     *
+     * @param matchBuilder  MatchBuilder Object without a match yet
+     * @param dMacAddr      String representing a destination MAC
+     * @return matchBuilder Map MatchBuilder Object with a match
+     */
+
+    protected static MatchBuilder createDestEthMatch(MatchBuilder matchBuilder, MacAddress dMacAddr, MacAddress mask) {
+
+        EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
+        EthernetDestinationBuilder ethDestinationBuilder = new EthernetDestinationBuilder();
+        ethDestinationBuilder.setAddress(new MacAddress(dMacAddr));
+        if (mask != null) {
+            ethDestinationBuilder.setMask(mask);
+        }
+        ethernetMatch.setEthernetDestination(ethDestinationBuilder.build());
+        matchBuilder.setEthernetMatch(ethernetMatch.build());
+
+        return matchBuilder;
+    }
+
+    /**
+     * Tunnel ID Match Builder
+     *
+     * @param matchBuilder  MatchBuilder Object without a match yet
+     * @param tunnelId      BigInteger representing a tunnel ID
+     * @return matchBuilder Map MatchBuilder Object with a match
+     */
+    protected static MatchBuilder createTunnelIDMatch(MatchBuilder matchBuilder, BigInteger tunnelId) {
+
+        TunnelBuilder tunnelBuilder = new TunnelBuilder();
+        tunnelBuilder.setTunnelId(tunnelId);
+        matchBuilder.setTunnel(tunnelBuilder.build());
+
+        return matchBuilder;
+    }
+
+    /**
+     * Match ICMP code and type
+     *
+     * @param matchBuilder  MatchBuilder Object without a match yet
+     * @param type          short representing an ICMP type
+     * @param code          short representing an ICMP code
+     * @return matchBuilder Map MatchBuilder Object with a match
+     */
+    protected static MatchBuilder createICMPv4Match(MatchBuilder matchBuilder, short type, short code) {
+
+        EthernetMatchBuilder eth = new EthernetMatchBuilder();
+        EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
+        ethTypeBuilder.setType(new EtherType(0x0800L));
+        eth.setEthernetType(ethTypeBuilder.build());
+        matchBuilder.setEthernetMatch(eth.build());
+
+        // Build the IPv4 Match requied per OVS Syntax
+        IpMatchBuilder ipmatch = new IpMatchBuilder();
+        ipmatch.setIpProtocol((short) 1);
+        matchBuilder.setIpMatch(ipmatch.build());
+
+        // Build the ICMPv4 Match
+        Icmpv4MatchBuilder icmpv4match = new Icmpv4MatchBuilder();
+        icmpv4match.setIcmpv4Type(type);
+        icmpv4match.setIcmpv4Code(code);
+        matchBuilder.setIcmpv4Match(icmpv4match.build());
+
+        return matchBuilder;
+    }
+
+    /**
+     * @param matchBuilder MatchBuilder Object without a match yet
+     * @param dstip        String containing an IPv4 prefix
+     * @return matchBuilder Map Object with a match
+     */
+    private static MatchBuilder createDstL3IPv4Match(MatchBuilder matchBuilder, Ipv4Prefix dstip) {
+
+        EthernetMatchBuilder eth = new EthernetMatchBuilder();
+        EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
+        ethTypeBuilder.setType(new EtherType(0x0800L));
+        eth.setEthernetType(ethTypeBuilder.build());
+        matchBuilder.setEthernetMatch(eth.build());
+
+        Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder();
+        ipv4match.setIpv4Destination(dstip);
+
+        matchBuilder.setLayer3Match(ipv4match.build());
+
+        return matchBuilder;
+
+    }
+
+    /**
+     * @param matchBuilder MatchBuilder Object without a match yet
+     * @param srcip        String containing an IPv4 prefix
+     * @return             matchBuilder Map Object with a match
+     */
+    private static MatchBuilder createSrcL3IPv4Match(MatchBuilder matchBuilder, Ipv4Prefix srcip) {
+
+        EthernetMatchBuilder eth = new EthernetMatchBuilder();
+        EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
+        ethTypeBuilder.setType(new EtherType(0x0800L));
+        eth.setEthernetType(ethTypeBuilder.build());
+        matchBuilder.setEthernetMatch(eth.build());
+
+        Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
+        Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder();
+        ipv4match.setIpv4Source(srcip);
+        matchBuilder.setLayer3Match(ipv4match.build());
+
+        return matchBuilder;
+
+    }
+
+    /**
+     * Create Source TCP Port Match
+     *
+     * @param matchBuilder @param matchbuilder MatchBuilder Object without a match yet
+     * @param tcpport      Integer representing a source TCP port
+     * @return             matchBuilder Map MatchBuilder Object with a match
+     */
+    protected static MatchBuilder createSetSrcTcpMatch(MatchBuilder matchBuilder, PortNumber tcpport) {
+
+        EthernetMatchBuilder ethType = new EthernetMatchBuilder();
+        EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
+        ethTypeBuilder.setType(new EtherType(0x0800L));
+        ethType.setEthernetType(ethTypeBuilder.build());
+        matchBuilder.setEthernetMatch(ethType.build());
+
+        IpMatchBuilder ipmatch = new IpMatchBuilder();
+        ipmatch.setIpProtocol((short) 6);
+        matchBuilder.setIpMatch(ipmatch.build());
+
+        TcpMatchBuilder tcpmatch = new TcpMatchBuilder();
+        tcpmatch.setTcpSourcePort(tcpport);
+        matchBuilder.setLayer4Match(tcpmatch.build());
+
+        return matchBuilder;
+
+    }
+
+    /**
+     * Create Destination TCP Port Match
+     *
+     * @param matchBuilder MatchBuilder Object without a match yet
+     * @param tcpport      Integer representing a destination TCP port
+     * @return             matchBuilder Map MatchBuilder Object with a match
+     */
+    protected static MatchBuilder createSetDstTcpMatch(MatchBuilder matchBuilder, PortNumber tcpport) {
+
+        EthernetMatchBuilder ethType = new EthernetMatchBuilder();
+        EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
+        ethTypeBuilder.setType(new EtherType(0x0800L));
+        ethType.setEthernetType(ethTypeBuilder.build());
+        matchBuilder.setEthernetMatch(ethType.build());
+
+        IpMatchBuilder ipmatch = new IpMatchBuilder();
+        ipmatch.setIpProtocol((short) 6);
+        matchBuilder.setIpMatch(ipmatch.build());
+
+        PortNumber dstport = new PortNumber(tcpport);
+        TcpMatchBuilder tcpmatch = new TcpMatchBuilder();
+
+        tcpmatch.setTcpDestinationPort(tcpport);
+        matchBuilder.setLayer4Match(tcpmatch.build());
+
+        return matchBuilder;
+    }
+
+    /**
+     * Create Send to Controller Reserved Port Instruction (packet_in)
+     *
+     * @param ib Map InstructionBuilder without any instructions
+     * @return ib Map InstructionBuilder with instructions
+     */
+
+    protected static InstructionBuilder createSendToControllerInstructions(InstructionBuilder ib) {
+
+        List<Action> actionList = new ArrayList<Action>();
+        ActionBuilder ab = new ActionBuilder();
+
+        OutputActionBuilder output = new OutputActionBuilder();
+        output.setMaxLength(0xffff);
+        Uri value = new Uri("CONTROLLER");
+        output.setOutputNodeConnector(value);
+        ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
+        ab.setOrder(0);
+        ab.setKey(new ActionKey(0));
+        actionList.add(ab.build());
+
+        // Create an Apply Action
+        ApplyActionsBuilder aab = new ApplyActionsBuilder();
+        aab.setAction(actionList);
+
+        // Wrap our Apply Action in an Instruction
+        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
+
+        return ib;
+    }
+
+    /**
+     * Create NORMAL Reserved Port Instruction (packet_in)
+     *
+     * @param ib Map InstructionBuilder without any instructions
+     * @return ib Map InstructionBuilder with instructions
+     */
+
+    protected static InstructionBuilder createNormalInstructions(InstructionBuilder ib) {
+
+        List<Action> actionList = new ArrayList<Action>();
+        ActionBuilder ab = new ActionBuilder();
+
+        OutputActionBuilder output = new OutputActionBuilder();
+        Uri value = new Uri("NORMAL");
+        output.setOutputNodeConnector(value);
+        ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
+        ab.setOrder(0);
+        ab.setKey(new ActionKey(0));
+        actionList.add(ab.build());
+
+        // Create an Apply Action
+        ApplyActionsBuilder aab = new ApplyActionsBuilder();
+        aab.setAction(actionList);
+
+        // Wrap our Apply Action in an Instruction
+        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
+
+        return ib;
+    }
+
+    /**
+     * Create Output Port Instruction
+     *
+     * @param ib       Map InstructionBuilder without any instructions
+     * @param dpidLong Long the datapath ID of a switch/node
+     * @param port     Long representing a port on a switch/node
+     * @return ib InstructionBuilder Map with instructions
+     */
+    protected static InstructionBuilder createOutputPortInstructions(InstructionBuilder ib, Long dpidLong, Long port) {
+
+        NodeConnectorId ncid = new NodeConnectorId("openflow:" + dpidLong + ":" + port);
+        logger.debug("createOutputPortInstructions() Node Connector ID is - Type=openflow: DPID={} inPort={} ", dpidLong, port);
+
+        List<Action> actionList = new ArrayList<Action>();
+        ActionBuilder ab = new ActionBuilder();
+        OutputActionBuilder oab = new OutputActionBuilder();
+        oab.setOutputNodeConnector(ncid);
+
+        ab.setAction(new OutputActionCaseBuilder().setOutputAction(oab.build()).build());
+        ab.setOrder(0);
+        ab.setKey(new ActionKey(0));
+        actionList.add(ab.build());
+
+        // Create an Apply Action
+        ApplyActionsBuilder aab = new ApplyActionsBuilder();
+        aab.setAction(actionList);
+        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
+
+        return ib;
+    }
+
+    /**
+     * Create Output Port Group Instruction
+     *
+     * @param ib       Map InstructionBuilder without any instructions
+     * @param dpidLong Long the datapath ID of a switch/node
+     * @param port     Long representing a port on a switch/node
+     * @return ib InstructionBuilder Map with instructions
+     */
+    protected InstructionBuilder createOutputPortInstructions(InstructionBuilder ib,
+                                                              Long dpidLong, Long port ,
+                                                              List<Instruction> instructions) {
+        NodeConnectorId ncid = new NodeConnectorId("openflow:" + dpidLong + ":" + port);
+        logger.debug("createOutputPortInstructions() Node Connector ID is - Type=openflow: DPID={} port={} existingInstructions={}", dpidLong, port, instructions);
+
+        List<Action> actionList = new ArrayList<Action>();
+        ActionBuilder ab = new ActionBuilder();
+
+        List<Action> existingActions = null;
+        if (instructions != null) {
+            for (Instruction in : instructions) {
+                if (in.getInstruction() instanceof ApplyActionsCase) {
+                    existingActions = (((ApplyActionsCase) in.getInstruction()).getApplyActions().getAction());
+                    actionList.addAll(existingActions);
+                }
+            }
+        }
+        /* Create output action for this port*/
+        OutputActionBuilder oab = new OutputActionBuilder();
+        oab.setOutputNodeConnector(ncid);
+        ab.setAction(new OutputActionCaseBuilder().setOutputAction(oab.build()).build());
+        boolean addNew = true;
+
+        /* Find the group action and get the group */
+        for (Action action : actionList) {
+            if (action.getAction() instanceof OutputActionCase) {
+                OutputActionCase opAction = (OutputActionCase)action.getAction();
+                /* If output port action already in the action list of one of the buckets, skip */
+                if (opAction.getOutputAction().getOutputNodeConnector().equals(new Uri(ncid))) {
+                    addNew = false;
+                    break;
+                }
+            }
+        }
+        if (addNew) {
+            ab.setOrder(actionList.size());
+            ab.setKey(new ActionKey(actionList.size()));
+            actionList.add(ab.build());
+        }
+        // Create an Apply Action
+        ApplyActionsBuilder aab = new ApplyActionsBuilder();
+        aab.setAction(actionList);
+        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
+        logger.debug("createOutputPortInstructions() : applyAction {}", aab.build());
+        return ib;
+    }
+
+    /**
+     * Create Output Port Group Instruction
+     *
+     * @param ib       Map InstructionBuilder without any instructions
+     * @param dpidLong Long the datapath ID of a switch/node
+     * @param port     Long representing a port on a switch/node
+     * @return ib InstructionBuilder Map with instructions
+     */
+    protected InstructionBuilder createOutputGroupInstructions(NodeBuilder nodeBuilder,
+                                                               InstructionBuilder ib,
+                                                               Long dpidLong, Long port ,
+                                                               List<Instruction> instructions) {
+        NodeConnectorId ncid = new NodeConnectorId("openflow:" + dpidLong + ":" + port);
+        logger.debug("createOutputGroupInstructions() Node Connector ID is - Type=openflow: DPID={} port={} existingInstructions={}", dpidLong, port, instructions);
+
+        List<Action> actionList = new ArrayList<Action>();
+        ActionBuilder ab = new ActionBuilder();
+
+        List<Action> existingActions = null;
+        if (instructions != null) {
+            for (Instruction in : instructions) {
+                if (in.getInstruction() instanceof ApplyActionsCase) {
+                    existingActions = (((ApplyActionsCase) in.getInstruction()).getApplyActions().getAction());
+                    actionList.addAll(existingActions);
+                }
+            }
+        }
+
+        GroupBuilder groupBuilder = new GroupBuilder();
+        Group group = null;
+
+        /* Create output action for this port*/
+        OutputActionBuilder oab = new OutputActionBuilder();
+        oab.setOutputNodeConnector(ncid);
+        ab.setAction(new OutputActionCaseBuilder().setOutputAction(oab.build()).build());
+        logger.debug("createOutputGroupInstructions(): output action {}", ab.build());
+        boolean addNew = true;
+        boolean groupActionAdded = false;
+
+        /* Find the group action and get the group */
+        for (Action action : actionList) {
+            if (action.getAction() instanceof GroupActionCase) {
+                groupActionAdded = true;
+                GroupActionCase groupAction = (GroupActionCase) action.getAction();
+                Long id = groupAction.getGroupAction().getGroupId();
+                String groupName = groupAction.getGroupAction().getGroup();
+                GroupKey key = new GroupKey(new GroupId(id));
+
+                groupBuilder.setGroupId(new GroupId(id));
+                groupBuilder.setGroupName(groupName);
+                groupBuilder.setGroupType(GroupTypes.GroupAll);
+                groupBuilder.setKey(key);
+                group = getGroup(groupBuilder, nodeBuilder);
+                logger.debug("createOutputGroupInstructions: group {}", group);
+                break;
+            }
+        }
+
+        logger.debug("createOutputGroupInstructions: groupActionAdded {}", groupActionAdded);
+        if (groupActionAdded) {
+            /* modify the action bucket in group */
+            groupBuilder = new GroupBuilder(group);
+            Buckets buckets = groupBuilder.getBuckets();
+            for (Bucket bucket : buckets.getBucket()) {
+                List<Action> bucketActions = bucket.getAction();
+                logger.debug("createOutputGroupInstructions: bucketActions {}", bucketActions);
+                for (Action action : bucketActions) {
+                    if (action.getAction() instanceof OutputActionCase) {
+                        OutputActionCase opAction = (OutputActionCase)action.getAction();
+                        /* If output port action already in the action list of one of the buckets, skip */
+                        if (opAction.getOutputAction().getOutputNodeConnector().equals(new Uri(ncid))) {
+                            addNew = false;
+                            break;
+                        }
+                    }
+                }
+            }
+            logger.debug("createOutputGroupInstructions: addNew {}", addNew);
+            if (addNew) {
+                /* the new output action is not in the bucket, add to bucket */
+                if (!buckets.getBucket().isEmpty()) {
+                    Bucket bucket = buckets.getBucket().get(0);
+                    List<Action> bucketActionList = new ArrayList<Action>();
+                    bucketActionList.addAll(bucket.getAction());
+                    /* set order for new action and add to action list */
+                    ab.setOrder(bucketActionList.size());
+                    ab.setKey(new ActionKey(bucketActionList.size()));
+                    bucketActionList.add(ab.build());
+
+                    /* set bucket and buckets list. Reset groupBuilder with new buckets.*/
+                    BucketsBuilder bucketsBuilder = new BucketsBuilder();
+                    List<Bucket> bucketList = new ArrayList<Bucket>();
+                    BucketBuilder bucketBuilder = new BucketBuilder();
+                    bucketBuilder.setBucketId(new BucketId((long) 1));
+                    bucketBuilder.setKey(new BucketKey(new BucketId((long) 1)));
+                    bucketBuilder.setAction(bucketActionList);
+                    bucketList.add(bucketBuilder.build());
+                    bucketsBuilder.setBucket(bucketList);
+                    groupBuilder.setBuckets(bucketsBuilder.build());
+                    logger.debug("createOutputGroupInstructions: bucketList {}", bucketList);
+                }
+            }
+        } else {
+            /* create group */
+            groupBuilder = new GroupBuilder();
+            groupBuilder.setGroupType(GroupTypes.GroupAll);
+            groupBuilder.setGroupId(new GroupId(groupId));
+            groupBuilder.setKey(new GroupKey(new GroupId(groupId)));
+            groupBuilder.setGroupName("Output port group" + groupId);
+            groupBuilder.setBarrier(false);
+
+            BucketsBuilder bucketBuilder = new BucketsBuilder();
+            List<Bucket> bucketList = new ArrayList<Bucket>();
+            BucketBuilder bucket = new BucketBuilder();
+            bucket.setBucketId(new BucketId((long) 1));
+            bucket.setKey(new BucketKey(new BucketId((long) 1)));
+
+            /* put output action to the bucket */
+            List<Action> bucketActionList = new ArrayList<Action>();
+            /* set order for new action and add to action list */
+            ab.setOrder(bucketActionList.size());
+            ab.setKey(new ActionKey(bucketActionList.size()));
+            bucketActionList.add(ab.build());
+
+            bucket.setAction(bucketActionList);
+            bucketList.add(bucket.build());
+            bucketBuilder.setBucket(bucketList);
+            groupBuilder.setBuckets(bucketBuilder.build());
+
+            /* Add new group action */
+            GroupActionBuilder groupActionB = new GroupActionBuilder();
+            groupActionB.setGroupId(groupId);
+            groupActionB.setGroup("Output port group" + groupId);
+            ab = new ActionBuilder();
+            ab.setAction(new GroupActionCaseBuilder().setGroupAction(groupActionB.build()).build());
+            ab.setOrder(actionList.size());
+            ab.setKey(new ActionKey(actionList.size()));
+            actionList.add(ab.build());
+
+            groupId++;
+        }
+        logger.debug("createOutputGroupInstructions: group {}", groupBuilder.build());
+        logger.debug("createOutputGroupInstructions: actionList {}", actionList);
+
+        if (addNew) {
+            /* rewrite the group to group table */
+            writeGroup(groupBuilder, nodeBuilder);
+        }
+
+        // Create an Apply Action
+        ApplyActionsBuilder aab = new ApplyActionsBuilder();
+        aab.setAction(actionList);
+        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
+
+        return ib;
+    }
+
+    /**
+     * add Output Port action to Instruction action list.
+     * This is use for flow with single output port actions.
+     * Flow with mutiple output port actions should use createOutputPortInstructions() method.
+     *
+     * @param ib       Map InstructionBuilder without any instructions
+     * @param dpidLong Long the datapath ID of a switch/node
+     * @param port     Long representing a port on a switch/node
+     * @return ib InstructionBuilder Map with instructions
+     */
+    protected static InstructionBuilder addOutputPortInstructions(InstructionBuilder ib,
+                                                                     Long dpidLong, Long port ,
+                                                                     List<Instruction> instructions) {
+        NodeConnectorId ncid = new NodeConnectorId("openflow:" + dpidLong + ":" + port);
+        logger.debug("addOutputPortInstructions() Node Connector ID is - Type=openflow: DPID={} port={} existingInstructions={}", dpidLong, port, instructions);
+
+        List<Action> actionList = new ArrayList<Action>();
+        ActionBuilder ab = new ActionBuilder();
+
+        List<Action> existingActions = null;
+        if (instructions != null) {
+            for (Instruction in : instructions) {
+                if (in.getInstruction() instanceof ApplyActionsCase) {
+                    existingActions = (((ApplyActionsCase) in.getInstruction()).getApplyActions().getAction());
+                    actionList.addAll(existingActions);
+                }
+            }
+        }
+
+        /* Create output action for this port*/
+        OutputActionBuilder oab = new OutputActionBuilder();
+        oab.setOutputNodeConnector(ncid);
+        ab.setAction(new OutputActionCaseBuilder().setOutputAction(oab.build()).build());
+        ab.setOrder(actionList.size());
+        ab.setKey(new ActionKey(actionList.size()));
+        actionList.add(ab.build());
+
+        // Create an Apply Action
+        ApplyActionsBuilder aab = new ApplyActionsBuilder();
+        aab.setAction(actionList);
+        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
+
+        return ib;
+    }
+
+    /**
+     * Remove Output Port from action list in group bucket
+     *
+     * @param ib       Map InstructionBuilder without any instructions
+     * @param dpidLong Long the datapath ID of a switch/node
+     * @param port     Long representing a port on a switch/node
+     * @return ib InstructionBuilder Map with instructions
+     */
+    protected boolean removeOutputPortFromGroup(NodeBuilder nodeBuilder, InstructionBuilder ib,
+                                Long dpidLong, Long port , List<Instruction> instructions) {
+
+        NodeConnectorId ncid = new NodeConnectorId("openflow:" + dpidLong + ":" + port);
+        logger.debug("removeOutputPortFromGroup() Node Connector ID is - Type=openflow: DPID={} port={} existingInstructions={}", dpidLong, port, instructions);
+
+        List<Action> actionList = new ArrayList<Action>();
+        ActionBuilder ab;
+
+        List<Action> existingActions = null;
+        if (instructions != null) {
+            for (Instruction in : instructions) {
+                if (in.getInstruction() instanceof ApplyActionsCase) {
+                    existingActions = (((ApplyActionsCase) in.getInstruction()).getApplyActions().getAction());
+                    actionList.addAll(existingActions);
+                    break;
+                }
+            }
+        }
+
+        GroupBuilder groupBuilder = new GroupBuilder();
+        Group group = null;
+        boolean groupActionAdded = false;
+        /* Find the group action and get the group */
+        for (Action action : actionList) {
+            if (action.getAction() instanceof GroupActionCase) {
+                groupActionAdded = true;
+                GroupActionCase groupAction = (GroupActionCase) action.getAction();
+                Long id = groupAction.getGroupAction().getGroupId();
+                String groupName = groupAction.getGroupAction().getGroup();
+                GroupKey key = new GroupKey(new GroupId(id));
+
+                groupBuilder.setGroupId(new GroupId(id));
+                groupBuilder.setGroupName(groupName);
+                groupBuilder.setGroupType(GroupTypes.GroupAll);
+                groupBuilder.setKey(key);
+                group = getGroup(groupBuilder, nodeBuilder);
+                break;
+            }
+        }
+
+        if (groupActionAdded) {
+            /* modify the action bucket in group */
+            groupBuilder = new GroupBuilder(group);
+            Buckets buckets = groupBuilder.getBuckets();
+            List<Action> bucketActions = new ArrayList<Action>();
+            for (Bucket bucket : buckets.getBucket()) {
+                int index = 0;
+                boolean isPortDeleted = false;
+                bucketActions = bucket.getAction();
+                for (Action action : bucketActions) {
+                    if (action.getAction() instanceof OutputActionCase) {
+                        OutputActionCase opAction = (OutputActionCase)action.getAction();
+                        if (opAction.getOutputAction().getOutputNodeConnector().equals(new Uri(ncid))) {
+                            /* Find the output port in action list and remove */
+                            index = bucketActions.indexOf(action);
+                            bucketActions.remove(action);
+                            isPortDeleted = true;
+                            break;
+                        }
+                    }
+                }
+                if (isPortDeleted && !bucketActions.isEmpty()) {
+                    for (int i = index; i< bucketActions.size(); i++) {
+                        Action action = bucketActions.get(i);
+                        if (action.getOrder() != i) {
+                            /* Shift the action order */
+                            ab = new ActionBuilder();
+                            ab.setAction(action.getAction());
+                            ab.setOrder(i);
+                            ab.setKey(new ActionKey(i));
+                            Action actionNewOrder = ab.build();
+                            bucketActions.remove(action);
+                            bucketActions.add(i, actionNewOrder);
+                        }
+                    }
+
+                } else if (bucketActions.isEmpty()) {
+                    /* remove bucket with empty action list */
+                    buckets.getBucket().remove(bucket);
+                    break;
+                }
+            }
+            if (!buckets.getBucket().isEmpty()) {
+                /* rewrite the group to group table */
+                /* set bucket and buckets list. Reset groupBuilder with new buckets.*/
+                BucketsBuilder bucketsBuilder = new BucketsBuilder();
+                List<Bucket> bucketList = new ArrayList<Bucket>();
+                BucketBuilder bucketBuilder = new BucketBuilder();
+                bucketBuilder.setBucketId(new BucketId((long) 1));
+                bucketBuilder.setKey(new BucketKey(new BucketId((long) 1)));
+                bucketBuilder.setAction(bucketActions);
+                bucketList.add(bucketBuilder.build());
+                bucketsBuilder.setBucket(bucketList);
+                groupBuilder.setBuckets(bucketsBuilder.build());
+                logger.debug("removeOutputPortFromGroup: bucketList {}", bucketList);
+
+                writeGroup(groupBuilder, nodeBuilder);
+                ApplyActionsBuilder aab = new ApplyActionsBuilder();
+                aab.setAction(actionList);
+                ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
+                return false;
+            } else {
+                /* remove group with empty bucket. return true to delete flow */
+                removeGroup(groupBuilder, nodeBuilder);
+                return true;
+            }
+        } else {
+            /* no group for port list. flow can be removed */
+            return true;
+        }
+    }
+
+    /**
+     * Remove Output Port from Instruction
+     *
+     * @param ib       Map InstructionBuilder without any instructions
+     * @param dpidLong Long the datapath ID of a switch/node
+     * @param port     Long representing a port on a switch/node
+     * @return ib InstructionBuilder Map with instructions
+     */
+    protected static boolean removeOutputPortFromInstructions(InstructionBuilder ib,
+                                Long dpidLong, Long port , List<Instruction> instructions) {
+
+        NodeConnectorId ncid = new NodeConnectorId("openflow:" + dpidLong + ":" + port);
+        logger.debug("createOutputPortInstructions() Node Connector ID is - Type=openflow: DPID={} port={} existingInstructions={}", dpidLong, port, instructions);
+
+        List<Action> actionList = new ArrayList<Action>();
+        ActionBuilder ab;
+
+        List<Action> existingActions = null;
+        if (instructions != null) {
+            for (Instruction in : instructions) {
+                if (in.getInstruction() instanceof ApplyActionsCase) {
+                    existingActions = (((ApplyActionsCase) in.getInstruction()).getApplyActions().getAction());
+                    actionList.addAll(existingActions);
+                    break;
+                }
+            }
+        }
+
+        int numOutputPort = 0;
+        int index = 0;
+        boolean isPortDeleted = false;
+        for (Action action : actionList) {
+            if (action.getAction() instanceof OutputActionCase) {
+                numOutputPort++;
+                OutputActionCase opAction = (OutputActionCase)action.getAction();
+                if (opAction.getOutputAction().getOutputNodeConnector().equals(new Uri(ncid))) {
+                    /* Find the output port in action list and remove */
+                    index = actionList.indexOf(action);
+                    actionList.remove(action);
+                    isPortDeleted = true;
+                    numOutputPort--;
+                    break;
+                }
+            }
+        }
+
+        if (isPortDeleted) {
+            for (int i = index; i< actionList.size(); i++) {
+                Action action = actionList.get(i);
+                if (action.getOrder() != i) {
+                    /* Shift the action order */
+                    ab = new ActionBuilder();
+                    ab.setAction(action.getAction());
+                    ab.setOrder(i);
+                    ab.setKey(new ActionKey(i));
+                    Action actionNewOrder = ab.build();
+                    actionList.remove(action);
+                    actionList.add(i, actionNewOrder);
+                }
+            }
+        }
+
+        /* Put new action list in Apply Action instruction */
+        if (numOutputPort > 0) {
+            ApplyActionsBuilder aab = new ApplyActionsBuilder();
+            aab.setAction(actionList);
+            ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
+            logger.debug("createOutputPortInstructions() : applyAction {}", aab.build());
+            return false;
+        } else {
+            /* if all output port are removed. Return true to indicate flow remove */
+            return true;
+        }
+    }
+
+    /**
+     * Create Set Vlan ID Instruction - This includes push vlan action, and set field -> vlan vid action
+     *
+     * @param ib     Map InstructionBuilder without any instructions
+     * @param vlanId Integer representing a VLAN ID Integer representing a VLAN ID
+     * @return ib Map InstructionBuilder with instructions
+     */
+    protected static InstructionBuilder createSetVlanInstructions(InstructionBuilder ib, VlanId vlanId) {
+
+        List<Action> actionList = new ArrayList<Action>();
+        ActionBuilder ab = new ActionBuilder();
+
+        /* First we push vlan header */
+        PushVlanActionBuilder vlan = new PushVlanActionBuilder();
+        vlan.setEthernetType(new Integer(0x8100));
+        ab.setAction(new PushVlanActionCaseBuilder().setPushVlanAction(vlan.build()).build());
+        ab.setOrder(0);
+        actionList.add(ab.build());
+
+        /* Then we set vlan id value as vlanId */
+        SetVlanIdActionBuilder vl = new SetVlanIdActionBuilder();
+        vl.setVlanId(vlanId);
+        ab = new ActionBuilder();
+        ab.setAction(new SetVlanIdActionCaseBuilder().setSetVlanIdAction(vl.build()).build());
+        ab.setOrder(1);
+        actionList.add(ab.build());
+        // Create an Apply Action
+        ApplyActionsBuilder aab = new ApplyActionsBuilder();
+        aab.setAction(actionList);
+
+        // Wrap our Apply Action in an Instruction
+        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
+
+        return ib;
+    }
+
+    /**
+     * Create Pop Vlan Instruction - this remove vlan header
+     *
+     * @param ib Map InstructionBuilder without any instructions
+     * @return ib Map InstructionBuilder with instructions
+     */
+    protected static InstructionBuilder createPopVlanInstructions(InstructionBuilder ib) {
+
+        List<Action> actionList = new ArrayList<Action>();
+        ActionBuilder ab = new ActionBuilder();
+
+        PopVlanActionBuilder popVlanActionBuilder = new PopVlanActionBuilder();
+        ab.setAction(new PopVlanActionCaseBuilder().setPopVlanAction(popVlanActionBuilder.build()).build());
+        ab.setOrder(0);
+        actionList.add(ab.build());
+
+        // Create an Apply Action
+        ApplyActionsBuilder aab = new ApplyActionsBuilder();
+        aab.setAction(actionList);
+
+        // Wrap our Apply Action in an Instruction
+        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
+
+        return ib;
+    }
+
+    /**
+     * Create Set IPv4 Source Instruction
+     *
+     * @param ib        Map InstructionBuilder without any instructions
+     * @param prefixsrc String containing an IPv4 prefix
+     * @return ib Map InstructionBuilder with instructions
+     */
+    protected static InstructionBuilder createNwSrcInstructions(InstructionBuilder ib, Ipv4Prefix prefixsrc) {
+
+        List<Action> actionList = new ArrayList<Action>();
+        ActionBuilder ab = new ActionBuilder();
+
+        SetNwSrcActionBuilder setNwsrcActionBuilder = new SetNwSrcActionBuilder();
+        Ipv4Builder ipsrc = new Ipv4Builder();
+        ipsrc.setIpv4Address(prefixsrc);
+        setNwsrcActionBuilder.setAddress(ipsrc.build());
+        ab.setAction(new SetNwSrcActionCaseBuilder().setSetNwSrcAction(setNwsrcActionBuilder.build()).build());
+        actionList.add(ab.build());
+
+        // Create an Apply Action
+        ApplyActionsBuilder aab = new ApplyActionsBuilder();
+        aab.setAction(actionList);
+
+        // Wrap our Apply Action in an Instruction
+        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
+
+        return ib;
+    }
+
+    /**
+     * Create Set IPv4 Destination Instruction
+     *
+     * @param ib           Map InstructionBuilder without any instructions
+     * @param prefixdst    String containing an IPv4 prefix
+     * @return ib Map InstructionBuilder with instructions
+     */
+    protected static InstructionBuilder createNwDstInstructions(InstructionBuilder ib, Ipv4Prefix prefixdst) {
+
+        List<Action> actionList = new ArrayList<Action>();
+        ActionBuilder ab = new ActionBuilder();
+
+        SetNwDstActionBuilder setNwDstActionBuilder = new SetNwDstActionBuilder();
+        Ipv4Builder ipdst = new Ipv4Builder();
+        ipdst.setIpv4Address(prefixdst);
+        setNwDstActionBuilder.setAddress(ipdst.build());
+        ab.setAction(new SetNwDstActionCaseBuilder().setSetNwDstAction(setNwDstActionBuilder.build()).build());
+        actionList.add(ab.build());
+
+        // Create an Apply Action
+        ApplyActionsBuilder aab = new ApplyActionsBuilder();
+        aab.setAction(actionList);
+
+        // Wrap our Apply Action in an Instruction
+        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
+
+        return ib;
+    }
+
+    /**
+     * Create Drop Instruction
+     *
+     * @param ib Map InstructionBuilder without any instructions
+     * @return ib Map InstructionBuilder with instructions
+     */
+    protected static InstructionBuilder createDropInstructions(InstructionBuilder ib) {
+
+        DropActionBuilder dab = new DropActionBuilder();
+        DropAction dropAction = dab.build();
+        ActionBuilder ab = new ActionBuilder();
+        ab.setAction(new DropActionCaseBuilder().setDropAction(dropAction).build());
+        ab.setOrder(0);
+
+        // Add our drop action to a list
+        List<Action> actionList = new ArrayList<Action>();
+        actionList.add(ab.build());
+
+        // Create an Apply Action
+        ApplyActionsBuilder aab = new ApplyActionsBuilder();
+        aab.setAction(actionList);
+
+        // Wrap our Apply Action in an Instruction
+        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
+
+        return ib;
+    }
+
+    /**
+     * Create GOTO Table Instruction Builder
+     *
+     * @param ib      Map InstructionBuilder without any instructions
+     * @param tableId short representing a flow table ID short representing a flow table ID
+     * @return ib Map InstructionBuilder with instructions
+     */
+    protected static InstructionBuilder createGotoTableInstructions(InstructionBuilder ib, short tableId) {
+
+        GoToTableBuilder gttb = new GoToTableBuilder();
+        gttb.setTableId(tableId);
+
+        // Wrap our Apply Action in an InstructionBuilder
+        ib.setInstruction(new GoToTableCaseBuilder().setGoToTable(gttb.build()).build());
+
+        return ib;
+    }
+
+    /**
+     * Create Set Tunnel ID Instruction Builder
+     *
+     * @param ib       Map InstructionBuilder without any instructions
+     * @param tunnelId BigInteger representing a tunnel ID
+     * @return ib Map InstructionBuilder with instructions
+     */
+    protected static InstructionBuilder createSetTunnelIdInstructions(InstructionBuilder ib, BigInteger tunnelId) {
+
+        List<Action> actionList = new ArrayList<Action>();
+        ActionBuilder ab = new ActionBuilder();
+        SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
+
+        // Build the Set Tunnel Field Action
+        TunnelBuilder tunnel = new TunnelBuilder();
+        tunnel.setTunnelId(tunnelId);
+        setFieldBuilder.setTunnel(tunnel.build());
+        ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
+        ab.setOrder(0);
+        actionList.add(ab.build());
+
+        ApplyActionsBuilder aab = new ApplyActionsBuilder();
+        aab.setAction(actionList);
+
+        // Wrap the Apply Action in an InstructionBuilder and return
+        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
+
+        return ib;
+    }
+
+    /**
+     * Create Set Source TCP Port Instruction
+     *
+     * @param ib      Map InstructionBuilder without any instructions
+     * @param tcpport Integer representing a source TCP port
+     * @return ib Map InstructionBuilder with instructions
+     */
+    protected static InstructionBuilder createSetSrcTCPPort(InstructionBuilder ib, PortNumber tcpport) {
+
+        List<Action> actionList = new ArrayList<Action>();
+        ActionBuilder ab = new ActionBuilder();
+        SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
+
+        // Build the Destination TCP Port
+        PortNumber tcpsrcport = new PortNumber(tcpport);
+        TcpMatchBuilder tcpmatch = new TcpMatchBuilder();
+        tcpmatch.setTcpSourcePort(tcpsrcport);
+
+        setFieldBuilder.setLayer4Match(tcpmatch.build());
+        ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
+        ab.setKey(new ActionKey(1));
+        actionList.add(ab.build());
+
+        ApplyActionsBuilder aab = new ApplyActionsBuilder();
+        aab.setAction(actionList);
+        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
+
+        return ib;
+    }
+
+    /**
+     * Create Set Destination TCP Port Instruction
+     *
+     * @param ib      Map InstructionBuilder without any instructions
+     * @param tcpport Integer representing a source TCP port
+     * @return ib Map InstructionBuilder with instructions
+     */
+    protected static InstructionBuilder createSetDstTCPPort(InstructionBuilder ib, PortNumber tcpport) {
+
+        List<Action> actionList = new ArrayList<Action>();
+        ActionBuilder ab = new ActionBuilder();
+        SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
+
+        // Build the Destination TCP Port
+        PortNumber tcpdstport = new PortNumber(tcpport);
+        TcpMatchBuilder tcpmatch = new TcpMatchBuilder();
+        tcpmatch.setTcpDestinationPort(tcpdstport);
+
+        setFieldBuilder.setLayer4Match(tcpmatch.build());
+        ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
+        ab.setKey(new ActionKey(1));
+        actionList.add(ab.build());
+
+        ApplyActionsBuilder aab = new ApplyActionsBuilder();
+        aab.setAction(actionList);
+        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
+
+        return ib;
+    }
+
+    /**
+     * Create Set Source UDP Port Instruction
+     *
+     * @param ib      Map InstructionBuilder without any instructions
+     * @param udpport Integer representing a source UDP port
+     * @return ib Map InstructionBuilder with instructions
+     */
+    protected static InstructionBuilder createSetSrcUDPPort(InstructionBuilder ib, PortNumber udpport) {
+
+        List<Action> actionList = new ArrayList<Action>();
+        ActionBuilder ab = new ActionBuilder();
+        SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
+
+        // Build the Destination TCP Port
+        PortNumber udpsrcport = new PortNumber(udpport);
+        UdpMatchBuilder udpmatch = new UdpMatchBuilder();
+        udpmatch.setUdpSourcePort(udpsrcport);
+
+        setFieldBuilder.setLayer4Match(udpmatch.build());
+        ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
+        ab.setKey(new ActionKey(1));
+        actionList.add(ab.build());
+
+        ApplyActionsBuilder aab = new ApplyActionsBuilder();
+        aab.setAction(actionList);
+        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
+
+        return ib;
+    }
+
+    /**
+     * Create Set Destination UDP Port Instruction
+     *
+     * @param ib      Map InstructionBuilder without any instructions
+     * @param udpport Integer representing a destination UDP port
+     * @return ib Map InstructionBuilder with instructions
+     */
+    protected static InstructionBuilder createSetDstUDPPort(InstructionBuilder ib, PortNumber udpport) {
+
+        List<Action> actionList = new ArrayList<Action>();
+        ActionBuilder ab = new ActionBuilder();
+        SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
+
+        // Build the Destination TCP Port
+        PortNumber udpdstport = new PortNumber(udpport);
+        UdpMatchBuilder udpmatch = new UdpMatchBuilder();
+        udpmatch.setUdpDestinationPort(udpdstport);
+
+        setFieldBuilder.setLayer4Match(udpmatch.build());
+        ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
+        ab.setKey(new ActionKey(1));
+        actionList.add(ab.build());
+
+        ApplyActionsBuilder aab = new ApplyActionsBuilder();
+        aab.setAction(actionList);
+        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
+
+        return ib;
+    }
+
+    /**
+     * Create Set ICMP Code Instruction
+     *
+     * @param ib   Map InstructionBuilder without any instructions
+     * @param code short repesenting an ICMP code
+     * @return ib Map InstructionBuilder with instructions
+     */
+
+    private static InstructionBuilder createSetIcmpCodeInstruction(InstructionBuilder ib, short code) {
+
+        List<Action> actionList = new ArrayList<Action>();
+        ActionBuilder ab = new ActionBuilder();
+        SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
+        Icmpv4MatchBuilder icmpv4match = new Icmpv4MatchBuilder();
+
+        // Build the ICMPv4 Code Match
+        icmpv4match.setIcmpv4Code(code);
+        setFieldBuilder.setIcmpv4Match(icmpv4match.build());
+
+        ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
+        ab.setKey(new ActionKey(0));
+        actionList.add(ab.build());
+        ApplyActionsBuilder aab = new ApplyActionsBuilder();
+        aab.setAction(actionList);
+
+        // Wrap our Apply Action in an Instruction
+        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
+
+        return ib;
+    }
+
+    /**
+     * Create Set ICMP Code Instruction
+     *
+     * @param ib Map InstructionBuilder without any instructions
+     * @return ib Map InstructionBuilder with instructions
+     */
+    private static InstructionBuilder createSetIcmpTypeInstruction(InstructionBuilder ib, short type) {
+
+        List<Action> actionList = new ArrayList<Action>();
+        ActionBuilder ab = new ActionBuilder();
+        SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
+        Icmpv4MatchBuilder icmpv4match = new Icmpv4MatchBuilder();
+
+        // Build the ICMPv4 Code Match
+        icmpv4match.setIcmpv4Code(type);
+        setFieldBuilder.setIcmpv4Match(icmpv4match.build());
+
+        ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
+        ab.setKey(new ActionKey(1));
+        actionList.add(ab.build());
+        ApplyActionsBuilder aab = new ApplyActionsBuilder();
+        aab.setAction(actionList);
+
+        // Wrap our Apply Action in an Instruction
+        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
+
+        return ib;
+    }
+
+    /**
+     * Create Decrement TTL Instruction
+     *
+     * @param ib Map InstructionBuilder without any instructions
+     * @return ib Map InstructionBuilder with instructions
+     */
+    private static InstructionBuilder createDecNwTtlInstructions(InstructionBuilder ib) {
+        DecNwTtlBuilder decNwTtlBuilder = new DecNwTtlBuilder();
+        DecNwTtl decNwTtl = decNwTtlBuilder.build();
+        ActionBuilder ab = new ActionBuilder();
+        ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(decNwTtl).build());
+
+        // Add our drop action to a list
+        List<Action> actionList = new ArrayList<Action>();
+        actionList.add(ab.build());
+
+        // Create an Apply Action
+        ApplyActionsBuilder aab = new ApplyActionsBuilder();
+        aab.setAction(actionList);
+
+        // Wrap our Apply Action in an Instruction
+        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
+
+        return ib;
+    }
+
+    /**
+     * Set Src Arp MAC
+     */
+    private static InstructionBuilder createSrcArpMacInstructions(InstructionBuilder ib, MacAddress macsrc) {
+
+        List<Action> actionList = new ArrayList<Action>();
+        ActionBuilder ab = new ActionBuilder();
+
+        SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
+        ArpMatchBuilder arpmatch = new ArpMatchBuilder();
+        ArpSourceHardwareAddressBuilder arpsrc = new ArpSourceHardwareAddressBuilder();
+        arpsrc.setAddress(macsrc);
+        arpmatch.setArpSourceHardwareAddress(arpsrc.build());
+        setFieldBuilder.setLayer3Match(arpmatch.build());
+        ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
+        ab.setKey(new ActionKey(0));
+        actionList.add(ab.build());
+
+        ApplyActionsBuilder aab = new ApplyActionsBuilder();
+        aab.setAction(actionList);
+
+        return ib;
+    }
+
+    /**
+     * Set Dst Arp MAC
+     */
+    private static InstructionBuilder createDstArpMacInstructions(InstructionBuilder ib, MacAddress macdst) {
+
+        List<Action> actionList = new ArrayList<Action>();
+        ActionBuilder ab = new ActionBuilder();
+        SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
+
+        ArpMatchBuilder arpmatch = new ArpMatchBuilder();
+        ArpTargetHardwareAddressBuilder arpdst = new ArpTargetHardwareAddressBuilder();
+        arpdst.setAddress(macdst);
+        setFieldBuilder.setLayer3Match(arpmatch.build());
+        ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
+        ab.setKey(new ActionKey(0));
+        actionList.add(ab.build());
+
+        ApplyActionsBuilder aab = new ApplyActionsBuilder();
+        aab.setAction(actionList);
+
+        return ib;
+    }
+
+    /**
+     * Set Dst Arp IP
+     */
+    private static InstructionBuilder createDstArpIpInstructions(InstructionBuilder ib, Ipv4Prefix dstiparp) {
+
+        List<Action> actionList = new ArrayList<Action>();
+        ActionBuilder ab = new ActionBuilder();
+        SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
+
+        ArpMatchBuilder arpmatch = new ArpMatchBuilder();
+        arpmatch.setArpTargetTransportAddress(dstiparp);
+        setFieldBuilder.setLayer3Match(arpmatch.build());
+        ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
+        ab.setKey(new ActionKey(0));
+        actionList.add(ab.build());
+
+        ApplyActionsBuilder aab = new ApplyActionsBuilder();
+        aab.setAction(actionList);
+
+        return ib;
+    }
+
+    /**
+     * Set Src Arp IP
+     */
+    private static InstructionBuilder createSrcArpIpInstructions(InstructionBuilder ib, Ipv4Prefix srciparp) {
+
+        List<Action> actionList = new ArrayList<Action>();
+        ActionBuilder ab = new ActionBuilder();
+        SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
+
+        ArpMatchBuilder arpmatch = new ArpMatchBuilder();
+        arpmatch.setArpSourceTransportAddress(srciparp);
+        setFieldBuilder.setLayer3Match(arpmatch.build());
+        ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
+        ab.setKey(new ActionKey(0));
+        actionList.add(ab.build());
+
+        ApplyActionsBuilder aab = new ApplyActionsBuilder();
+        aab.setAction(actionList);
+
+        return ib;
+    }
+
+    @Override
+    public void initializeOFFlowRules(Node openflowNode) {
+        IConnectionServiceInternal connectionService = (IConnectionServiceInternal)ServiceHelper.getGlobalInstance(IConnectionServiceInternal.class, this);
+        List<Node> ovsNodes = connectionService.getNodes();
+        if (ovsNodes == null) return;
+        for (Node ovsNode : ovsNodes) {
+            Long brIntDpid = this.getIntegrationBridgeOFDPID(ovsNode);
+            Long brExDpid = this.getExternalBridgeDpid(ovsNode);
+            logger.debug("Compare openflowNode to OVS node {} vs {} and {}", openflowNode.getID(), brIntDpid, brExDpid);
+            String openflowID = openflowNode.getID().toString();
+            if (openflowID.contains(brExDpid.toString())) {
+                this.initializeFlowRules(ovsNode, adminConfigManager.getExternalBridgeName());
+                this.triggerInterfaceUpdates(ovsNode);
+            }
+            if (openflowID.contains(brIntDpid.toString())) {
+                this.initializeFlowRules(ovsNode, adminConfigManager.getIntegrationBridgeName());
+                this.triggerInterfaceUpdates(ovsNode);
+            }
+        }
+    }
+
+    private NodeBuilder createNodeBuilder(String nodeId) {
+        NodeBuilder builder = new NodeBuilder();
+        builder.setId(new NodeId(nodeId));
+        builder.setKey(new NodeKey(builder.getId()));
+        return builder;
+    }
+
+    private InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node> nodeBuilderToInstanceId(NodeBuilder
+                                                                                                                                             node) {
+        return InstanceIdentifier.builder(Nodes.class).child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node.class,
+                node.getKey()).toInstance();
+    }
+
+    private String getInternalBridgeUUID (Node node, String bridgeName) {
+        try {
+            OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
+            Map<String, org.opendaylight.ovsdb.lib.table.Table<?>> bridgeTable = ovsdbTable.getRows(node, Bridge.NAME.getName());
+            if (bridgeTable == null) return null;
+            for (String key : bridgeTable.keySet()) {
+                Bridge bridge = (Bridge)bridgeTable.get(key);
+                if (bridge.getName().equals(bridgeName)) return key;
+            }
+        } catch (Exception e) {
+            logger.error("Error getting Bridge Identifier for {} / {}", node, bridgeName, e);
+        }
+        return null;
+    }
+}
diff --git a/neutron/src/main/java/org/opendaylight/ovsdb/neutron/provider/OF13ProviderManager.java b/neutron/src/main/java/org/opendaylight/ovsdb/neutron/provider/OF13ProviderManager.java
deleted file mode 100644 (file)
index 561039f..0000000
+++ /dev/null
@@ -1,2042 +0,0 @@
-/**
- * Copyright (C) 2013 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal, Brent Salisbury
- */
-package org.opendaylight.ovsdb.neutron.provider;
-
-import java.math.BigInteger;
-import java.net.InetAddress;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
-
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
-import org.opendaylight.controller.md.sal.common.api.data.DataModification;
-import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork;
-import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
-import org.opendaylight.controller.sal.core.Node;
-import org.opendaylight.controller.sal.utils.HexEncode;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
-import org.opendaylight.controller.sal.utils.Status;
-import org.opendaylight.controller.sal.utils.StatusCode;
-import org.opendaylight.controller.switchmanager.ISwitchManager;
-import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
-import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
-import org.opendaylight.ovsdb.lib.notation.UUID;
-import org.opendaylight.ovsdb.lib.table.Bridge;
-import org.opendaylight.ovsdb.lib.table.Interface;
-import org.opendaylight.ovsdb.lib.table.Port;
-import org.opendaylight.ovsdb.neutron.AdminConfigManager;
-import org.opendaylight.ovsdb.neutron.IMDSALConsumer;
-import org.opendaylight.ovsdb.neutron.InternalNetworkManager;
-import org.opendaylight.ovsdb.neutron.TenantNetworkManager;
-import org.opendaylight.ovsdb.plugin.IConnectionServiceInternal;
-import org.opendaylight.ovsdb.plugin.OVSDBConfigService;
-import org.opendaylight.ovsdb.plugin.StatusWithUuid;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecNwTtlCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DropActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwDstActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.StripVlanActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtl;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtlBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.field._case.SetFieldBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.dst.action._case.SetNwDstActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.src.action._case.SetNwSrcActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.vlan.id.action._case.SetVlanIdActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.strip.vlan.action._case.StripVlanAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.strip.vlan.action._case.StripVlanActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.GoToTableCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.go.to.table._case.GoToTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpSourceHardwareAddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpTargetHardwareAddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TunnelBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- *
- */
-class OF13ProviderManager extends ProviderNetworkManager {
-    private static final Logger logger = LoggerFactory.getLogger(OF13ProviderManager.class);
-    private DataBrokerService dataBrokerService;
-    private static final short TABLE_0_DEFAULT_INGRESS = 0;
-    private static final short TABLE_1_ISOLATE_TENANT = 10;
-    private static final short TABLE_2_LOCAL_FORWARD = 20;
-
-    @Override
-    public boolean hasPerTenantTunneling() {
-        return false;
-    }
-
-    private Status getTunnelReadinessStatus (Node node, String tunnelKey) {
-        InetAddress srcTunnelEndPoint = AdminConfigManager.getManager().getTunnelEndPoint(node);
-        if (srcTunnelEndPoint == null) {
-            logger.error("Tunnel Endpoint not configured for Node {}", node);
-            return new Status(StatusCode.NOTFOUND, "Tunnel Endpoint not configured for "+ node);
-        }
-
-        if (!InternalNetworkManager.getManager().isInternalNetworkNeutronReady(node)) {
-            logger.error(node+" is not Overlay ready");
-            return new Status(StatusCode.NOTACCEPTABLE, node+" is not Overlay ready");
-        }
-
-        if (!TenantNetworkManager.getManager().isTenantNetworkPresentInNode(node, tunnelKey)) {
-            logger.debug(node+" has no VM corresponding to segment "+ tunnelKey);
-            return new Status(StatusCode.NOTACCEPTABLE, node+" has no VM corresponding to segment "+ tunnelKey);
-        }
-        return new Status(StatusCode.SUCCESS);
-    }
-
-    private String getTunnelName(String tunnelType, InetAddress dst) {
-        return tunnelType+"-"+dst.getHostAddress();
-    }
-
-    private boolean isTunnelPresent(Node node, String tunnelName, String bridgeUUID) throws Exception {
-        OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
-        Bridge bridge = (Bridge)ovsdbTable.getRow(node, Bridge.NAME.getName(), bridgeUUID);
-        if (bridge != null) {
-            Set<UUID> ports = bridge.getPorts();
-            for (UUID portUUID : ports) {
-                Port port = (Port)ovsdbTable.getRow(node, Port.NAME.getName(), portUUID.toString());
-                if (port != null && port.getName().equalsIgnoreCase(tunnelName)) return true;
-            }
-        }
-        return false;
-    }
-
-    private Status addTunnelPort (Node node, String tunnelType, InetAddress src, InetAddress dst) {
-        try {
-            String bridgeUUID = null;
-            String tunnelBridgeName = AdminConfigManager.getManager().getIntegrationBridgeName();
-            OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
-            Map<String, org.opendaylight.ovsdb.lib.table.Table<?>> bridgeTable = ovsdbTable.getRows(node, Bridge.NAME.getName());
-            if (bridgeTable != null) {
-                for (String uuid : bridgeTable.keySet()) {
-                    Bridge bridge = (Bridge)bridgeTable.get(uuid);
-                    if (bridge.getName().equals(tunnelBridgeName)) {
-                        bridgeUUID = uuid;
-                        break;
-                    }
-                }
-            }
-            if (bridgeUUID == null) {
-                logger.error("Could not find Bridge {} in {}", tunnelBridgeName, node);
-                return new Status(StatusCode.NOTFOUND, "Could not find "+tunnelBridgeName+" in "+node);
-            }
-            String portName = getTunnelName(tunnelType, dst);
-
-            if (this.isTunnelPresent(node, portName, bridgeUUID)) {
-                logger.trace("Tunnel {} is present in {} of {}", portName, tunnelBridgeName, node);
-                return new Status(StatusCode.SUCCESS);
-            }
-
-            Port tunnelPort = new Port();
-            tunnelPort.setName(portName);
-            StatusWithUuid statusWithUuid = ovsdbTable.insertRow(node, Port.NAME.getName(), bridgeUUID, tunnelPort);
-            if (!statusWithUuid.isSuccess()) {
-                logger.error("Failed to insert Tunnel port {} in {}", portName, bridgeUUID);
-                return statusWithUuid;
-            }
-
-            String tunnelPortUUID = statusWithUuid.getUuid().toString();
-            String interfaceUUID = null;
-            int timeout = 6;
-            while ((interfaceUUID == null) && (timeout > 0)) {
-                tunnelPort = (Port)ovsdbTable.getRow(node, Port.NAME.getName(), tunnelPortUUID);
-                OvsDBSet<UUID> interfaces = tunnelPort.getInterfaces();
-                if (interfaces == null || interfaces.size() == 0) {
-                    // Wait for the OVSDB update to sync up the Local cache.
-                    Thread.sleep(500);
-                    timeout--;
-                    continue;
-                }
-                interfaceUUID = interfaces.toArray()[0].toString();
-                Interface intf = (Interface)ovsdbTable.getRow(node, Interface.NAME.getName(), interfaceUUID);
-                if (intf == null) interfaceUUID = null;
-            }
-
-            if (interfaceUUID == null) {
-                logger.error("Cannot identify Tunnel Interface for port {}/{}", portName, tunnelPortUUID);
-                return new Status(StatusCode.INTERNALERROR);
-            }
-
-            Interface tunInterface = new Interface();
-            tunInterface.setType(tunnelType);
-            OvsDBMap<String, String> options = new OvsDBMap<String, String>();
-            options.put("key", "flow");
-            options.put("local_ip", src.getHostAddress());
-            options.put("remote_ip", dst.getHostAddress());
-            tunInterface.setOptions(options);
-            Status status = ovsdbTable.updateRow(node, Interface.NAME.getName(), tunnelPortUUID, interfaceUUID, tunInterface);
-            logger.debug("Tunnel {} add status : {}", tunInterface, status);
-            return status;
-        } catch (Exception e) {
-            logger.error("Exception in addTunnelPort", e);
-            return new Status(StatusCode.INTERNALERROR);
-        }
-    }
-
-    private void programLocalBridgeRules(Node node, Long dpid, String segmentationId, String attachedMac, long localPort) {
-         /*
-         * Table(0) Rule #3
-         * ----------------
-         * Match: VM sMac and Local Ingress Port
-         * Action:Action: Set Tunnel ID and GOTO Local Table (5)
-         */
-
-         writeLocalInPort(dpid, TABLE_0_DEFAULT_INGRESS, TABLE_1_ISOLATE_TENANT, segmentationId, localPort, attachedMac);
-
-        /*
-         * Table(0) Rule #4
-         * ----------------
-         * Match: Drop any remaining Ingress Local VM Packets
-         * Action: Drop w/ a low priority
-         */
-
-         writeDropSrcIface(dpid, localPort);
-
-         /*
-          * Table(2) Rule #1
-          * ----------------
-          * Match: Match TunID and Destination DL/dMAC Addr
-          * Action: Output Port
-          * table=2,tun_id=0x5,dl_dst=00:00:00:00:00:01 actions=output:2
-          */
-
-          writeLocalUcastOut(dpid, TABLE_2_LOCAL_FORWARD, segmentationId, localPort, attachedMac);
-
-         /*
-          * Table(2) Rule #2
-          * ----------------
-          * Match: Tunnel ID and dMAC (::::FF:FF)
-          * table=2,priority=16384,tun_id=0x5,dl_dst=ff:ff:ff:ff:ff:ff \
-          * actions=output:2,3,4,5
-          */
-
-          writeLocalBcastOut(dpid, TABLE_2_LOCAL_FORWARD, segmentationId, localPort);
-
-          /*
-           * TODO : Optimize the following 2 writes to be restricted only for the very first port known in a segment.
-           */
-          /*
-           * Table(1) Rule #3
-           * ----------------
-           * Match:  Any remaining Ingress Local VM Packets
-           * Action: Drop w/ a low priority
-           * -------------------------------------------
-           * table=1,priority=8192,tun_id=0x5 actions=goto_table:2
-           */
-
-           writeTunnelMiss(dpid, TABLE_1_ISOLATE_TENANT, TABLE_2_LOCAL_FORWARD, segmentationId);
-
-          /*
-           * Table(2) Rule #3
-           * ----------------
-           * Match: Any Remaining Flows w/a TunID
-           * Action: Drop w/ a low priority
-           * table=2,priority=8192,tun_id=0x5 actions=drop
-           */
-
-           writeLocalTableMiss(dpid, TABLE_2_LOCAL_FORWARD, segmentationId);
-    }
-
-    private void programLocalIngressTunnelBridgeRules(Node node, Long dpid, String segmentationId, String attachedMac, long tunnelOFPort, long localPort) {
-        /*
-         * Table(0) Rule #2
-         * ----------------
-         * Match: Ingress Port, Tunnel ID
-         * Action: GOTO Local Table (10)
-         */
-
-         writeTunnelIn(dpid, TABLE_0_DEFAULT_INGRESS, TABLE_2_LOCAL_FORWARD, segmentationId, tunnelOFPort);
-
-         /*
-          * Table(1) Rule #2
-          * ----------------
-          * Match: Match Tunnel ID and L2 ::::FF:FF Flooding
-          * Action: Flood to selected destination TEPs
-          * -------------------------------------------
-          * table=1,priority=16384,tun_id=0x5,dl_dst=ff:ff:ff:ff:ff:ff \
-          * actions=output:10,output:11,goto_table:2
-          */
-
-         writeTunnelFloodOut(dpid, TABLE_1_ISOLATE_TENANT, TABLE_2_LOCAL_FORWARD, segmentationId, tunnelOFPort);
-
-    }
-
-    private void programRemoteEgressTunnelBridgeRules(Node node, Long dpid, String segmentationId, String attachedMac, long tunnelOFPort, long localPort) {
-        /*
-         * Table(1) Rule #1
-         * ----------------
-         * Match: Drop any remaining Ingress Local VM Packets
-         * Action: Drop w/ a low priority
-         * -------------------------------------------
-         * table=1,tun_id=0x5,dl_dst=00:00:00:00:00:08 \
-         * actions=output:11,goto_table:2
-         */
-
-        writeTunnelOut(dpid, TABLE_1_ISOLATE_TENANT, TABLE_2_LOCAL_FORWARD, segmentationId, tunnelOFPort, attachedMac);
-    }
-
-    private Long getIntegrationBridgeOFDPID (Node node) {
-        try {
-            String bridgeName = AdminConfigManager.getManager().getIntegrationBridgeName();
-            String brIntId = this.getInternalBridgeUUID(node, bridgeName);
-            if (brIntId == null) {
-                logger.error("Unable to spot Bridge Identifier for {} in {}", bridgeName, node);
-                return 0L;
-            }
-
-            OVSDBConfigService ovsdbTable = (OVSDBConfigService) ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
-            Bridge bridge = (Bridge) ovsdbTable.getRow(node, Bridge.NAME.getName(), brIntId);
-            Set<String> dpids = bridge.getDatapath_id();
-            if (dpids == null || dpids.size() == 0) return 0L;
-            return Long.valueOf(HexEncode.stringToLong((String) dpids.toArray()[0]));
-        } catch (Exception e) {
-            logger.error("Error finding Integration Bridge's OF DPID", e);
-            return 0L;
-        }
-    }
-    private void programLocalRules (String tunnelType, String segmentationId, Node node, Interface intf) {
-        try {
-            Long dpid = this.getIntegrationBridgeOFDPID(node);
-            if (dpid == 0L) {
-                logger.debug("Openflow Datapath-ID not set for the integration bridge in {}", node);
-                return;
-            }
-
-            Set<BigInteger> of_ports = intf.getOfport();
-            if (of_ports == null || of_ports.size() <= 0) {
-                logger.error("Could NOT Identify OF value for port {} on {}", intf.getName(), node);
-                return;
-            }
-            long localPort = ((BigInteger)of_ports.toArray()[0]).longValue();
-
-            Map<String, String> externalIds = intf.getExternal_ids();
-            if (externalIds == null) {
-                logger.error("No external_ids seen in {}", intf);
-                return;
-            }
-
-            String attachedMac = externalIds.get(TenantNetworkManager.EXTERNAL_ID_VM_MAC);
-            if (attachedMac == null) {
-                logger.error("No AttachedMac seen in {}", intf);
-                return;
-            }
-
-            programLocalBridgeRules(node, dpid, segmentationId, attachedMac, localPort);
-        } catch (Exception e) {
-            logger.error("Exception in programming Local Rules for "+intf+" on "+node, e);
-        }
-    }
-
-    private void programTunnelRules (String tunnelType, String segmentationId, InetAddress dst, Node node,
-            Interface intf, boolean local) {
-        try {
-
-            Long dpid = this.getIntegrationBridgeOFDPID(node);
-            if (dpid == 0L) {
-                logger.debug("Openflow Datapath-ID not set for the integration bridge in {}", node);
-                return;
-            }
-            OVSDBConfigService ovsdbTable = (OVSDBConfigService) ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
-
-            Set<BigInteger> of_ports = intf.getOfport();
-            if (of_ports == null || of_ports.size() <= 0) {
-                logger.error("Could NOT Identify OF value for port {} on {}", intf.getName(), node);
-                return;
-            }
-            long localPort = ((BigInteger)of_ports.toArray()[0]).longValue();
-
-            Map<String, String> externalIds = intf.getExternal_ids();
-            if (externalIds == null) {
-                logger.error("No external_ids seen in {}", intf);
-                return;
-            }
-
-            String attachedMac = externalIds.get(TenantNetworkManager.EXTERNAL_ID_VM_MAC);
-            if (attachedMac == null) {
-                logger.error("No AttachedMac seen in {}", intf);
-                return;
-            }
-
-            Map<String, org.opendaylight.ovsdb.lib.table.Table<?>> intfs = ovsdbTable.getRows(node, Interface.NAME.getName());
-            if (intfs != null) {
-                for (org.opendaylight.ovsdb.lib.table.Table<?> row : intfs.values()) {
-                    Interface tunIntf = (Interface)row;
-                    if (tunIntf.getName().equals(this.getTunnelName(tunnelType, dst))) {
-                        of_ports = tunIntf.getOfport();
-                        if (of_ports == null || of_ports.size() <= 0) {
-                            logger.error("Could NOT Identify Tunnel port {} on {}", tunIntf.getName(), node);
-                            continue;
-                        }
-                        long tunnelOFPort = ((BigInteger)of_ports.toArray()[0]).longValue();
-
-                        if (tunnelOFPort == -1) {
-                            logger.error("Could NOT Identify Tunnel port {} -> OF ({}) on {}", tunIntf.getName(), tunnelOFPort, node);
-                            return;
-                        }
-                        logger.debug("Identified Tunnel port {} -> OF ({}) on {}", tunIntf.getName(), tunnelOFPort, node);
-
-                        if (!local) {
-                            programRemoteEgressTunnelBridgeRules(node, dpid, segmentationId, attachedMac, tunnelOFPort, localPort);
-                        }
-                        programLocalIngressTunnelBridgeRules(node, dpid, segmentationId, attachedMac, tunnelOFPort, localPort);
-                        return;
-                    }
-                }
-            }
-        } catch (Exception e) {
-            logger.error("", e);
-        }
-    }
-
-    @Override
-    public Status handleInterfaceUpdate(String tunnelType, String tunnelKey, Node srcNode, Interface intf) {
-        ISwitchManager switchManager = (ISwitchManager) ServiceHelper.getInstance(ISwitchManager.class, "default", this);
-        if (switchManager == null) {
-            logger.error("Unable to identify SwitchManager");
-        } else {
-            Long dpid = this.getIntegrationBridgeOFDPID(srcNode);
-            if (dpid == 0L) {
-                logger.debug("Openflow Datapath-ID not set for the integration bridge in {}", srcNode);
-                return new Status(StatusCode.NOTFOUND);
-            }
-            Set<Node> ofNodes = switchManager.getNodes();
-            boolean ofNodeFound = false;
-            if (ofNodes != null) {
-                for (Node ofNode : ofNodes) {
-                    if (ofNode.toString().contains(dpid+"")) {
-                        logger.debug("Identified the Openflow node via toString {}", ofNode);
-                        ofNodeFound = true;
-                        break;
-                    }
-                }
-            } else {
-                logger.error("Unable to find any Node from SwitchManager");
-            }
-            if (!ofNodeFound) {
-                logger.error("Unable to find OF Node for {} with update {} on node {}", dpid, intf, srcNode);
-                return new Status(StatusCode.NOTFOUND);
-            }
-        }
-
-        IConnectionServiceInternal connectionService = (IConnectionServiceInternal)ServiceHelper.getGlobalInstance(IConnectionServiceInternal.class, this);
-        List<Node> nodes = connectionService.getNodes();
-        nodes.remove(srcNode);
-        this.programLocalRules(tunnelType, tunnelKey, srcNode, intf);
-
-        for (Node dstNode : nodes) {
-            InetAddress src = AdminConfigManager.getManager().getTunnelEndPoint(srcNode);
-            InetAddress dst = AdminConfigManager.getManager().getTunnelEndPoint(dstNode);
-            Status status = addTunnelPort(srcNode, tunnelType, src, dst);
-            if (status.isSuccess()) {
-                this.programTunnelRules(tunnelType, tunnelKey, dst, srcNode, intf, true);
-            }
-            addTunnelPort(dstNode, tunnelType, dst, src);
-            if (status.isSuccess()) {
-                this.programTunnelRules(tunnelType, tunnelKey, src, dstNode, intf, false);
-            }
-        }
-
-        return new Status(StatusCode.SUCCESS);
-    }
-
-    private Status triggerInterfaceUpdates(Node node) {
-        try {
-            OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
-            Map<String, org.opendaylight.ovsdb.lib.table.Table<?>> intfs = ovsdbTable.getRows(node, Interface.NAME.getName());
-            if (intfs != null) {
-                for (org.opendaylight.ovsdb.lib.table.Table<?> row : intfs.values()) {
-                    Interface intf = (Interface)row;
-                    NeutronNetwork network = TenantNetworkManager.getManager().getTenantNetworkForInterface(intf);
-                    logger.debug("Trigger Interface update for {}", intf);
-                    if (network != null) {
-                        this.handleInterfaceUpdate(network.getProviderNetworkType(), network.getProviderSegmentationID(), node, intf);
-                    }
-                }
-            }
-        } catch (Exception e) {
-            logger.error("Error Triggering the lost interface updates for "+ node, e);
-            return new Status(StatusCode.INTERNALERROR, e.getLocalizedMessage());
-        }
-        return new Status(StatusCode.SUCCESS);
-    }
-    @Override
-    public Status handleInterfaceUpdate(String tunnelType, String tunnelKey) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public Status handleInterfaceDelete(String tunnelType, String tunnelKey, Node source, Interface intf,
-            boolean isLastInstanceOnNode) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public void initializeFlowRules(Node node) {
-        this.initializeFlowRules(node, AdminConfigManager.getManager().getIntegrationBridgeName());
-        this.triggerInterfaceUpdates(node);
-    }
-
-    /**
-     * @param node
-     * @param bridgeName
-     */
-    private void initializeFlowRules(Node node, String bridgeName) {
-        Long dpid = this.getIntegrationBridgeOFDPID(node);
-        if (dpid == 0L) {
-            logger.debug("Openflow Datapath-ID not set for the integration bridge in {}", node);
-            return;
-        }
-
-        /*
-         * Table(0) Rule #1
-         * ----------------
-         * Match: LLDP (0x88CCL)
-         * Action: Packet_In to Controller Reserved Port
-         */
-
-         writeLLDPRule(dpid);
-    }
-
-    /*
-    * Create an LLDP Flow Rule to encapsulate into
-    * a packet_in that is sent to the controller
-    * for topology handling.
-    * Match: Ethertype 0x88CCL
-    * Action: Punt to Controller in a Packet_In msg
-    */
-
-    private void writeLLDPRule(Long dpidLong) {
-
-        String nodeName = "openflow:" + dpidLong;
-        EtherType etherType = new EtherType(0x88CCL);
-
-        MatchBuilder matchBuilder = new MatchBuilder();
-        NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
-        FlowBuilder flowBuilder = new FlowBuilder();
-
-        // Create Match(es) and Set them in the FlowBuilder Object
-        flowBuilder.setMatch(createEtherTypeMatch(matchBuilder, etherType).build());
-
-        // Create the OF Actions and Instructions
-        InstructionBuilder ib = new InstructionBuilder();
-        InstructionsBuilder isb = new InstructionsBuilder();
-
-        // Instructions List Stores Individual Instructions
-        List<Instruction> instructions = new ArrayList<Instruction>();
-
-        // Call the InstructionBuilder Methods Containing Actions
-        createSendToControllerInstructions(ib);
-        ib.setOrder(0);
-        ib.setKey(new InstructionKey(0));
-        instructions.add(ib.build());
-
-        // Add InstructionBuilder to the Instruction(s)Builder List
-        isb.setInstruction(instructions);
-
-        // Add InstructionsBuilder to FlowBuilder
-        flowBuilder.setInstructions(isb.build());
-
-        String flowId = "LLDP";
-        flowBuilder.setId(new FlowId(flowId));
-        FlowKey key = new FlowKey(new FlowId(flowId));
-        flowBuilder.setBarrier(true);
-        flowBuilder.setTableId((short) 0);
-        flowBuilder.setKey(key);
-        flowBuilder.setFlowName(flowId);
-        flowBuilder.setHardTimeout(0);
-        flowBuilder.setIdleTimeout(0);
-        writeFlow(flowBuilder, nodeBuilder);
-    }
-
-    /*
-     * (Table:0) Ingress Tunnel Traffic
-     * Match: OpenFlow InPort and Tunnel ID
-     * Action: GOTO Local Table (10)
-     * table=0,tun_id=0x5,in_port=10, actions=goto_table:2
-     */
-
-    private void writeTunnelIn(Long dpidLong, Short writeTable, Short goToTableId, String segmentationId,  Long ofPort) {
-
-        String nodeName = "openflow:" + dpidLong;
-
-        BigInteger tunnelId = new BigInteger(segmentationId);
-        MatchBuilder matchBuilder = new MatchBuilder();
-        NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
-        FlowBuilder flowBuilder = new FlowBuilder();
-
-        // Create Match(es) and Set them in the FlowBuilder Object
-        flowBuilder.setMatch(createTunnelIDMatch(matchBuilder, tunnelId).build());
-        flowBuilder.setMatch(createInPortMatch(matchBuilder, dpidLong, ofPort).build());
-
-        // Create the OF Actions and Instructions
-        InstructionBuilder ib = new InstructionBuilder();
-        InstructionsBuilder isb = new InstructionsBuilder();
-
-        // Instructions List Stores Individual Instructions
-        List<Instruction> instructions = new ArrayList<Instruction>();
-
-        // Call the InstructionBuilder Methods Containing Actions
-        createGotoTableInstructions(ib, goToTableId);
-        ib.setOrder(0);
-        ib.setKey(new InstructionKey(0));
-        instructions.add(ib.build());
-
-        // Add InstructionBuilder to the Instruction(s)Builder List
-        isb.setInstruction(instructions);
-
-        // Add InstructionsBuilder to FlowBuilder
-        flowBuilder.setInstructions(isb.build());
-
-        String flowId = "TunnelIn_"+segmentationId+"_"+ofPort;
-        // Add Flow Attributes
-        flowBuilder.setId(new FlowId(flowId));
-        FlowKey key = new FlowKey(new FlowId(flowId));
-        flowBuilder.setStrict(true);
-        flowBuilder.setBarrier(false);
-        flowBuilder.setTableId(writeTable);
-        flowBuilder.setKey(key);
-        flowBuilder.setFlowName(flowId);
-        flowBuilder.setHardTimeout(0);
-        flowBuilder.setIdleTimeout(0);
-        writeFlow(flowBuilder, nodeBuilder);
-    }
-
-   /*
-    * (Table:0) Egress VM Traffic Towards TEP
-    * Match: Destination Ethernet Addr and OpenFlow InPort
-    * Instruction: Set TunnelID and GOTO Table Tunnel Table (n)
-    * table=0,in_port=2,dl_src=00:00:00:00:00:01 \
-    * actions=set_field:5->tun_id,goto_table=1"
-    */
-
-    private void writeLocalInPort(Long dpidLong, Short writeTable, Short goToTableId, String segmentationId, Long inPort, String attachedMac) {
-
-        String nodeName = "openflow:" + dpidLong;
-
-        MatchBuilder matchBuilder = new MatchBuilder();
-        NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
-        FlowBuilder flowBuilder = new FlowBuilder();
-
-        // Create the OF Match using MatchBuilder
-        flowBuilder.setMatch(createEthSrcMatch(matchBuilder, new MacAddress(attachedMac)).build());
-        // TODO Broken In_Port Match
-        flowBuilder.setMatch(createInPortMatch(matchBuilder, dpidLong, inPort).build());
-
-        String flowId = "LocalMac_"+segmentationId+"_"+inPort+"_"+attachedMac;
-        // Add Flow Attributes
-        flowBuilder.setId(new FlowId(flowId));
-        FlowKey key = new FlowKey(new FlowId(flowId));
-        flowBuilder.setStrict(true);
-        flowBuilder.setBarrier(false);
-        flowBuilder.setTableId(writeTable);
-        flowBuilder.setKey(key);
-        flowBuilder.setFlowName(flowId);
-        flowBuilder.setHardTimeout(0);
-        flowBuilder.setIdleTimeout(0);
-
-        // Instantiate the Builders for the OF Actions and Instructions
-        InstructionBuilder ib = new InstructionBuilder();
-        InstructionsBuilder isb = new InstructionsBuilder();
-
-        // Instructions List Stores Individual Instructions
-        List<Instruction> instructions = new ArrayList<Instruction>();
-
-        // GOTO Instuctions Need to be added first to the List
-        createGotoTableInstructions(ib, goToTableId);
-        ib.setOrder(0);
-        ib.setKey(new InstructionKey(0));
-        instructions.add(ib.build());
-        // TODO Broken SetTunID
-        createSetTunnelIdInstructions(ib, new BigInteger(segmentationId));
-        ib.setOrder(1);
-        ib.setKey(new InstructionKey(1));
-        instructions.add(ib.build());
-
-        // Add InstructionBuilder to the Instruction(s)Builder List
-        isb.setInstruction(instructions);
-
-        // Add InstructionsBuilder to FlowBuilder
-        flowBuilder.setInstructions(isb.build());
-
-        writeFlow(flowBuilder, nodeBuilder);
-    }
-
-    /*
-     * (Table:0) Drop frames sourced from a VM that do not
-     * match the associated MAC address of the local VM.
-     * Match: Low priority anything not matching the VM SMAC
-     * Instruction: Drop
-     * table=0,priority=16384,in_port=1 actions=drop"
-     */
-
-    private void writeDropSrcIface(Long dpidLong, Long inPort) {
-
-        String nodeName = "openflow:" + dpidLong;
-
-        MatchBuilder matchBuilder = new MatchBuilder();
-        NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
-        FlowBuilder flowBuilder = new FlowBuilder();
-
-        // Create the OF Match using MatchBuilder
-        flowBuilder.setMatch(createInPortMatch(matchBuilder, dpidLong, inPort).build());
-
-        // Instantiate the Builders for the OF Actions and Instructions
-        InstructionBuilder ib = new InstructionBuilder();
-        InstructionsBuilder isb = new InstructionsBuilder();
-
-        // Instructions List Stores Individual Instructions
-        List<Instruction> instructions = new ArrayList<Instruction>();
-
-        // Call the InstructionBuilder Methods Containing Actions
-        createDropInstructions(ib);
-        ib.setOrder(0);
-        ib.setKey(new InstructionKey(0));
-        instructions.add(ib.build());
-
-        // Add InstructionBuilder to the Instruction(s)Builder List
-        isb.setInstruction(instructions);
-
-        // Add InstructionsBuilder to FlowBuilder
-        flowBuilder.setInstructions(isb.build());
-
-        String flowId = "DropFilter_"+inPort;
-        // Add Flow Attributes
-        flowBuilder.setId(new FlowId(flowId));
-        FlowKey key = new FlowKey(new FlowId(flowId));
-        flowBuilder.setStrict(true);
-        flowBuilder.setBarrier(false);
-        flowBuilder.setTableId((short) 0);
-        flowBuilder.setKey(key);
-        flowBuilder.setFlowName(flowId);
-        flowBuilder.setPriority(8192);
-        flowBuilder.setHardTimeout(0);
-        flowBuilder.setIdleTimeout(0);
-        writeFlow(flowBuilder, nodeBuilder);
-    }
-
-   /*
-    * (Table:1) Egress Tunnel Traffic
-    * Match: Destination Ethernet Addr and Local InPort
-    * Instruction: Set TunnelID and GOTO Table Tunnel Table (n)
-    * table=1,tun_id=0x5,dl_dst=00:00:00:00:00:08 \
-    * actions=output:10,goto_table:2"
-    */
-
-    private void writeTunnelOut(Long dpidLong, Short writeTable, Short goToTableId, String segmentationId , Long OFPortOut, String attachedMac) {
-
-        String nodeName = "openflow:" + dpidLong;
-
-        MatchBuilder matchBuilder = new MatchBuilder();
-        NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
-        FlowBuilder flowBuilder = new FlowBuilder();
-
-        // Create the OF Match using MatchBuilder
-        flowBuilder.setMatch(createTunnelIDMatch(matchBuilder, new BigInteger(segmentationId)).build());
-        flowBuilder.setMatch(createDestEthMatch(matchBuilder, new MacAddress(attachedMac), null).build());
-
-        String flowId = "TunnelOut_"+segmentationId+"_"+OFPortOut+"_"+attachedMac;
-        // Add Flow Attributes
-        flowBuilder.setId(new FlowId(flowId));
-        FlowKey key = new FlowKey(new FlowId(flowId));
-        flowBuilder.setStrict(true);
-        flowBuilder.setBarrier(false);
-        flowBuilder.setTableId(writeTable);
-        flowBuilder.setKey(key);
-        flowBuilder.setFlowName(flowId);
-        flowBuilder.setHardTimeout(0);
-        flowBuilder.setIdleTimeout(0);
-        // Instantiate the Builders for the OF Actions and Instructions
-        InstructionBuilder ib = new InstructionBuilder();
-        InstructionsBuilder isb = new InstructionsBuilder();
-
-        // Instructions List Stores Individual Instructions
-        List<Instruction> instructions = new ArrayList<Instruction>();
-
-        // GOTO Instuctions
-        createGotoTableInstructions(ib, goToTableId);
-        ib.setOrder(0);
-        ib.setKey(new InstructionKey(0));
-        instructions.add(ib.build());
-        // Set the Output Port/Iface
-        createOutputPortInstructions(ib, dpidLong, OFPortOut);
-        ib.setOrder(1);
-        ib.setKey(new InstructionKey(1));
-        instructions.add(ib.build());
-
-        // Add InstructionBuilder to the Instruction(s)Builder List
-        isb.setInstruction(instructions);
-
-        // Add InstructionsBuilder to FlowBuilder
-        flowBuilder.setInstructions(isb.build());
-
-        writeFlow(flowBuilder, nodeBuilder);
-    }
-
-       /*
-    * (Table:1) Egress Tunnel Traffic
-    * Match: Destination Ethernet Addr and Local InPort
-    * Instruction: Set TunnelID and GOTO Table Tunnel Table (n)
-    * table=1,priority=16384,tun_id=0x5,dl_dst=ff:ff:ff:ff:ff:ff \
-    * actions=output:10,output:11,goto_table:2
-    */
-
-    private void writeTunnelFloodOut(Long dpidLong, Short writeTable, Short localTable, String segmentationId,  Long OFPortOut) {
-
-        String nodeName = "openflow:" + dpidLong;
-
-        MatchBuilder matchBuilder = new MatchBuilder();
-        NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
-        FlowBuilder flowBuilder = new FlowBuilder();
-
-        // Create the OF Match using MatchBuilder
-        // Match TunnelID
-        flowBuilder.setMatch(createTunnelIDMatch(matchBuilder, new BigInteger(segmentationId)).build());
-        // Match DMAC
-
-        flowBuilder.setMatch(createDestEthMatch(matchBuilder, new MacAddress("01:00:00:00:00:00"), new MacAddress("01:00:00:00:00:00")).build());
-
-        String flowId = "TunnelFloodOut_"+segmentationId;
-        // Add Flow Attributes
-        flowBuilder.setId(new FlowId(flowId));
-        FlowKey key = new FlowKey(new FlowId(flowId));
-        flowBuilder.setBarrier(true);
-        flowBuilder.setTableId(writeTable);
-        flowBuilder.setKey(key);
-        flowBuilder.setPriority(16384);
-        flowBuilder.setFlowName(flowId);
-        flowBuilder.setHardTimeout(0);
-        flowBuilder.setIdleTimeout(0);
-
-        Flow flow = this.getFlow(flowBuilder, nodeBuilder);
-        // Instantiate the Builders for the OF Actions and Instructions
-        InstructionBuilder ib = new InstructionBuilder();
-        InstructionsBuilder isb = new InstructionsBuilder();
-        List<Instruction> instructions = new ArrayList<Instruction>();
-        List<Instruction> existingInstructions = null;
-        if (flow != null) {
-            Instructions ins = flow.getInstructions();
-            if (ins != null) {
-                existingInstructions = ins.getInstruction();
-            }
-        }
-        // GOTO Instuction
-        createGotoTableInstructions(ib, localTable);
-        ib.setOrder(0);
-        ib.setKey(new InstructionKey(0));
-        instructions.add(ib.build());
-        // Set the Output Port/Iface
-        createOutputPortInstructions(ib, dpidLong, OFPortOut, existingInstructions);
-        ib.setOrder(1);
-        ib.setKey(new InstructionKey(1));
-        instructions.add(ib.build());
-
-        // Add InstructionBuilder to the Instruction(s)Builder List
-        isb.setInstruction(instructions);
-
-        // Add InstructionsBuilder to FlowBuilder
-        flowBuilder.setInstructions(isb.build());
-
-        writeFlow(flowBuilder, nodeBuilder);
-    }
-
-   /*
-    * (Table:1) Table Drain w/ Catch All
-    * Match: Tunnel ID
-    * Action: GOTO Local Table (10)
-    * table=2,priority=8192,tun_id=0x5 actions=drop
-    */
-
-    private void writeTunnelMiss(Long dpidLong, Short writeTable, Short goToTableId, String segmentationId) {
-
-        String nodeName = "openflow:" + dpidLong;
-
-        MatchBuilder matchBuilder = new MatchBuilder();
-        NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
-        FlowBuilder flowBuilder = new FlowBuilder();
-
-        // Create Match(es) and Set them in the FlowBuilder Object
-        flowBuilder.setMatch(createTunnelIDMatch(matchBuilder, new BigInteger(segmentationId)).build());
-
-        // Create the OF Actions and Instructions
-        InstructionBuilder ib = new InstructionBuilder();
-        InstructionsBuilder isb = new InstructionsBuilder();
-
-        // Instructions List Stores Individual Instructions
-        List<Instruction> instructions = new ArrayList<Instruction>();
-
-        // Call the InstructionBuilder Methods Containing Actions
-        createGotoTableInstructions(ib, goToTableId);
-        ib.setOrder(0);
-        ib.setKey(new InstructionKey(0));
-        instructions.add(ib.build());
-
-        // Add InstructionBuilder to the Instruction(s)Builder List
-        isb.setInstruction(instructions);
-
-        // Add InstructionsBuilder to FlowBuilder
-        flowBuilder.setInstructions(isb.build());
-
-        String flowId = "TunnelMiss_"+segmentationId;
-        // Add Flow Attributes
-        flowBuilder.setId(new FlowId(flowId));
-        FlowKey key = new FlowKey(new FlowId(flowId));
-        flowBuilder.setStrict(true);
-        flowBuilder.setBarrier(false);
-        flowBuilder.setTableId(writeTable);
-        flowBuilder.setKey(key);
-        flowBuilder.setPriority(8192);
-        flowBuilder.setFlowName(flowId);
-        flowBuilder.setHardTimeout(0);
-        flowBuilder.setIdleTimeout(0);
-        writeFlow(flowBuilder, nodeBuilder);
-    }
-
-    /*
-     * (Table:1) Local Broadcast Flood
-     * Match: Tunnel ID and dMAC
-     * Action: Output Port
-     * table=2,tun_id=0x5,dl_dst=00:00:00:00:00:01 actions=output:2
-     */
-
-    private void writeLocalUcastOut(Long dpidLong, Short writeTable, String segmentationId, Long localPort, String attachedMac) {
-
-        String nodeName = "openflow:" + dpidLong;
-
-        MatchBuilder matchBuilder = new MatchBuilder();
-        NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
-        FlowBuilder flowBuilder = new FlowBuilder();
-
-        // Create the OF Match using MatchBuilder
-        flowBuilder.setMatch(createTunnelIDMatch(matchBuilder, new BigInteger(segmentationId)).build());
-        flowBuilder.setMatch(createDestEthMatch(matchBuilder, new MacAddress(attachedMac), null).build());
-
-        String flowId = "UcastOut_"+segmentationId+"_"+localPort+"_"+attachedMac;
-        // Add Flow Attributes
-        flowBuilder.setId(new FlowId(flowId));
-        FlowKey key = new FlowKey(new FlowId(flowId));
-        flowBuilder.setStrict(true);
-        flowBuilder.setBarrier(false);
-        flowBuilder.setTableId(writeTable);
-        flowBuilder.setKey(key);
-        flowBuilder.setFlowName(flowId);
-        flowBuilder.setHardTimeout(0);
-        flowBuilder.setIdleTimeout(0);
-
-        // Instantiate the Builders for the OF Actions and Instructions
-        InstructionBuilder ib = new InstructionBuilder();
-        InstructionsBuilder isb = new InstructionsBuilder();
-
-        // Instructions List Stores Individual Instructions
-        List<Instruction> instructions = new ArrayList<Instruction>();
-
-        // Set the Output Port/Iface
-        createOutputPortInstructions(ib, dpidLong, localPort);
-        ib.setOrder(0);
-        ib.setKey(new InstructionKey(0));
-        instructions.add(ib.build());
-
-        // Add InstructionBuilder to the Instruction(s)Builder List
-        isb.setInstruction(instructions);
-
-        // Add InstructionsBuilder to FlowBuilder
-        flowBuilder.setInstructions(isb.build());
-        writeFlow(flowBuilder, nodeBuilder);
-    }
-
-    /*
-     * (Table:1) Local Broadcast Flood
-     * Match: Tunnel ID and dMAC (::::FF:FF)
-     * table=2,priority=16384,tun_id=0x5,dl_dst=ff:ff:ff:ff:ff:ff \
-     * actions=output:2,3,4,5
-     */
-
-    private void writeLocalBcastOut(Long dpidLong, Short writeTable, String segmentationId, Long localPort) {
-
-        String nodeName = "openflow:" + dpidLong;
-
-        MatchBuilder matchBuilder = new MatchBuilder();
-        NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
-        FlowBuilder flowBuilder = new FlowBuilder();
-
-        // Create the OF Match using MatchBuilder
-        flowBuilder.setMatch(createTunnelIDMatch(matchBuilder, new BigInteger(segmentationId)).build());
-        flowBuilder.setMatch(createDestEthMatch(matchBuilder, new MacAddress("01:00:00:00:00:00"), new MacAddress("01:00:00:00:00:00")).build());
-
-        String flowId = "BcastOut_"+segmentationId;
-        // Add Flow Attributes
-        flowBuilder.setId(new FlowId(flowId));
-        FlowKey key = new FlowKey(new FlowId(flowId));
-        flowBuilder.setStrict(true);
-        flowBuilder.setBarrier(false);
-        flowBuilder.setTableId(writeTable);
-        flowBuilder.setKey(key);
-        flowBuilder.setPriority(16384);
-        flowBuilder.setFlowName(flowId);
-        flowBuilder.setHardTimeout(0);
-        flowBuilder.setIdleTimeout(0);
-        Flow flow = this.getFlow(flowBuilder, nodeBuilder);
-        // Instantiate the Builders for the OF Actions and Instructions
-        InstructionBuilder ib = new InstructionBuilder();
-        InstructionsBuilder isb = new InstructionsBuilder();
-        List<Instruction> instructions = new ArrayList<Instruction>();
-        List<Instruction> existingInstructions = null;
-        if (flow != null) {
-            Instructions ins = flow.getInstructions();
-            if (ins != null) {
-                existingInstructions = ins.getInstruction();
-            }
-        }
-
-        // Broken OutPort TODO: localPort needs to be a list of Ports)
-        createOutputPortInstructions(ib, dpidLong, localPort, existingInstructions);
-        ib.setOrder(0);
-        ib.setKey(new InstructionKey(0));
-        instructions.add(ib.build());
-
-        // Add InstructionBuilder to the Instruction(s)Builder List
-        isb.setInstruction(instructions);
-
-        // Add InstructionsBuilder to FlowBuilder
-        flowBuilder.setInstructions(isb.build());
-
-        writeFlow(flowBuilder, nodeBuilder);
-    }
-
-    /*
-     * (Table:1) Local Table Miss
-     * Match: Any Remaining Flows w/a TunID
-     * Action: Drop w/ a low priority
-     * table=2,priority=8192,tun_id=0x5 actions=drop
-     */
-
-    private void writeLocalTableMiss(Long dpidLong, Short writeTable, String segmentationId) {
-
-        String nodeName = "openflow:" + dpidLong;
-
-        MatchBuilder matchBuilder = new MatchBuilder();
-        NodeBuilder nodeBuilder = createNodeBuilder(nodeName);
-        FlowBuilder flowBuilder = new FlowBuilder();
-
-        // Create Match(es) and Set them in the FlowBuilder Object
-        flowBuilder.setMatch(createTunnelIDMatch(matchBuilder, new BigInteger(segmentationId)).build());
-
-        // Create the OF Actions and Instructions
-        InstructionBuilder ib = new InstructionBuilder();
-        InstructionsBuilder isb = new InstructionsBuilder();
-
-        // Instructions List Stores Individual Instructions
-        List<Instruction> instructions = new ArrayList<Instruction>();
-
-        // Call the InstructionBuilder Methods Containing Actions
-        createDropInstructions(ib);
-        ib.setOrder(0);
-        ib.setKey(new InstructionKey(0));
-        instructions.add(ib.build());
-
-        // Add InstructionBuilder to the Instruction(s)Builder List
-        isb.setInstruction(instructions);
-
-        // Add InstructionsBuilder to FlowBuilder
-        flowBuilder.setInstructions(isb.build());
-
-        String flowId = "LocalTableMiss_"+segmentationId;
-        // Add Flow Attributes
-        flowBuilder.setId(new FlowId(flowId));
-        FlowKey key = new FlowKey(new FlowId(flowId));
-        flowBuilder.setStrict(true);
-        flowBuilder.setBarrier(false);
-        flowBuilder.setTableId(writeTable);
-        flowBuilder.setKey(key);
-        flowBuilder.setPriority(8192);
-        flowBuilder.setFlowName(flowId);
-        flowBuilder.setHardTimeout(0);
-        flowBuilder.setIdleTimeout(0);
-        writeFlow(flowBuilder, nodeBuilder);
-    }
-
-    private Flow getFlow(FlowBuilder flowBuilder, NodeBuilder nodeBuilder) {
-        IMDSALConsumer mdsalConsumer = (IMDSALConsumer) ServiceHelper.getInstance(IMDSALConsumer.class, "default", this);
-        if (mdsalConsumer == null) {
-            logger.error("ERROR finding MDSAL Service. Its possible that writeFlow is called too soon ?");
-            return null;
-        }
-
-        dataBrokerService = mdsalConsumer.getDataBrokerService();
-
-        if (dataBrokerService == null) {
-            logger.error("ERROR finding reference for DataBrokerService. Please check out the MD-SAL support on the Controller.");
-            return null;
-        }
-
-        InstanceIdentifier<Flow> path1 = InstanceIdentifier.builder(Nodes.class).child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory
-                .rev130819.nodes.Node.class, nodeBuilder.getKey()).augmentation(FlowCapableNode.class).child(Table.class,
-                new TableKey(flowBuilder.getTableId())).child(Flow.class, flowBuilder.getKey()).build();
-        return (Flow)dataBrokerService.readConfigurationData(path1);
-    }
-
-    private void writeFlow(FlowBuilder flowBuilder, NodeBuilder nodeBuilder) {
-        IMDSALConsumer mdsalConsumer = (IMDSALConsumer) ServiceHelper.getInstance(IMDSALConsumer.class, "default", this);
-        if (mdsalConsumer == null) {
-            logger.error("ERROR finding MDSAL Service. Its possible that writeFlow is called too soon ?");
-            return;
-        }
-
-        dataBrokerService = mdsalConsumer.getDataBrokerService();
-
-        if (dataBrokerService == null) {
-            logger.error("ERROR finding reference for DataBrokerService. Please check out the MD-SAL support on the Controller.");
-            return;
-        }
-        DataModification<InstanceIdentifier<?>, DataObject> modification = dataBrokerService.beginTransaction();
-        InstanceIdentifier<Flow> path1 = InstanceIdentifier.builder(Nodes.class).child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory
-                .rev130819.nodes.Node.class, nodeBuilder.getKey()).augmentation(FlowCapableNode.class).child(Table.class,
-                new TableKey(flowBuilder.getTableId())).child(Flow.class, flowBuilder.getKey()).build();
-        modification.putOperationalData(nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
-        modification.putOperationalData(path1, flowBuilder.build());
-        modification.putConfigurationData(nodeBuilderToInstanceId(nodeBuilder), nodeBuilder.build());
-        modification.putConfigurationData(path1, flowBuilder.build());
-        Future<RpcResult<TransactionStatus>> commitFuture = modification.commit();
-        try {
-            RpcResult<TransactionStatus> result = commitFuture.get();
-            TransactionStatus status = result.getResult();
-            logger.debug("Transaction Status "+status.toString()+" for Flow "+flowBuilder.getFlowName());
-        } catch (InterruptedException e) {
-            logger.error(e.getMessage(), e);
-        } catch (ExecutionException e) {
-            logger.error(e.getMessage(), e);
-        }
-    }
-
-    /**
-     * Create Ingress Port Match dpidLong, inPort
-     *
-     * @param matchBuilder  Map matchBuilder MatchBuilder Object without a match
-     * @param dpidLong      Long the datapath ID of a switch/node
-     * @param inPort        Long ingress port on a switch
-     * @return matchBuilder Map MatchBuilder Object with a match
-     */
-    protected static MatchBuilder createInPortMatch(MatchBuilder matchBuilder, Long dpidLong, Long inPort) {
-
-        NodeConnectorId ncid = new NodeConnectorId("openflow:" + dpidLong + ":" + inPort);
-        logger.debug("createInPortMatch() Node Connector ID is - Type=openflow: DPID={} inPort={} ", dpidLong, inPort);
-        matchBuilder.setInPort(NodeConnectorId.getDefaultInstance(ncid.getValue()));
-        matchBuilder.setInPort(ncid);
-
-        return matchBuilder;
-    }
-
-    /**
-     * Create EtherType Match
-     *
-     * @param matchBuilder  Map matchBuilder MatchBuilder Object without a match
-     * @param etherType     Long EtherType
-     * @return matchBuilder Map MatchBuilder Object with a match
-     */
-    protected static MatchBuilder createEtherTypeMatch(MatchBuilder matchBuilder, EtherType etherType) {
-
-        EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
-        EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
-        ethTypeBuilder.setType(new EtherType(etherType));
-        ethernetMatch.setEthernetType(ethTypeBuilder.build());
-        matchBuilder.setEthernetMatch(ethernetMatch.build());
-
-        return matchBuilder;
-    }
-
-    /**
-     * Create Ethernet Source Match
-     *
-     * @param matchBuilder  MatchBuilder Object without a match yet
-     * @param sMacAddr      String representing a source MAC
-     * @return matchBuilder Map MatchBuilder Object with a match
-     */
-    protected static MatchBuilder createEthSrcMatch(MatchBuilder matchBuilder, MacAddress sMacAddr) {
-
-        EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
-        EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder();
-        ethSourceBuilder.setAddress(new MacAddress(sMacAddr));
-        ethernetMatch.setEthernetSource(ethSourceBuilder.build());
-        matchBuilder.setEthernetMatch(ethernetMatch.build());
-
-        return matchBuilder;
-    }
-
-    /**
-     * Create Ethernet Destination Match
-     *
-     * @param matchBuilder MatchBuilder Object without a match yet
-     * @param vlanId       Integer representing a VLAN ID Integer representing a VLAN ID
-     * @return matchBuilder Map MatchBuilder Object with a match
-     */
-
-    protected static MatchBuilder createVlanIdMatch(MatchBuilder matchBuilder, VlanId vlanId) {
-
-        VlanMatchBuilder vlanMatchBuilder = new VlanMatchBuilder();
-        VlanIdBuilder vlanIdBuilder = new VlanIdBuilder();
-        vlanIdBuilder.setVlanId(new VlanId(vlanId));
-        vlanMatchBuilder.setVlanId(vlanIdBuilder.build());
-        matchBuilder.setVlanMatch(vlanMatchBuilder.build());
-
-        return matchBuilder;
-    }
-
-    /**
-     * Create Ethernet Destination Match
-     *
-     * @param matchBuilder  MatchBuilder Object without a match yet
-     * @param dMacAddr      String representing a destination MAC
-     * @return matchBuilder Map MatchBuilder Object with a match
-     */
-
-    protected static MatchBuilder createDestEthMatch(MatchBuilder matchBuilder, MacAddress dMacAddr, MacAddress mask) {
-
-        EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder();
-        EthernetDestinationBuilder ethDestinationBuilder = new EthernetDestinationBuilder();
-        ethDestinationBuilder.setAddress(new MacAddress(dMacAddr));
-        if (mask != null) {
-            ethDestinationBuilder.setMask(mask);
-        }
-        ethernetMatch.setEthernetDestination(ethDestinationBuilder.build());
-        matchBuilder.setEthernetMatch(ethernetMatch.build());
-
-        return matchBuilder;
-    }
-
-    /**
-     * Tunnel ID Match Builder
-     *
-     * @param matchBuilder  MatchBuilder Object without a match yet
-     * @param tunnelId      BigInteger representing a tunnel ID
-     * @return matchBuilder Map MatchBuilder Object with a match
-     */
-    protected static MatchBuilder createTunnelIDMatch(MatchBuilder matchBuilder, BigInteger tunnelId) {
-
-        TunnelBuilder tunnelBuilder = new TunnelBuilder();
-        tunnelBuilder.setTunnelId(tunnelId);
-        matchBuilder.setTunnel(tunnelBuilder.build());
-
-        return matchBuilder;
-    }
-
-    /**
-     * Match ICMP code and type
-     *
-     * @param matchBuilder  MatchBuilder Object without a match yet
-     * @param type          short representing an ICMP type
-     * @param code          short representing an ICMP code
-     * @return matchBuilder Map MatchBuilder Object with a match
-     */
-    protected static MatchBuilder createICMPv4Match(MatchBuilder matchBuilder, short type, short code) {
-
-        EthernetMatchBuilder eth = new EthernetMatchBuilder();
-        EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
-        ethTypeBuilder.setType(new EtherType(0x0800L));
-        eth.setEthernetType(ethTypeBuilder.build());
-        matchBuilder.setEthernetMatch(eth.build());
-
-        // Build the IPv4 Match requied per OVS Syntax
-        IpMatchBuilder ipmatch = new IpMatchBuilder();
-        ipmatch.setIpProtocol((short) 1);
-        matchBuilder.setIpMatch(ipmatch.build());
-
-        // Build the ICMPv4 Match
-        Icmpv4MatchBuilder icmpv4match = new Icmpv4MatchBuilder();
-        icmpv4match.setIcmpv4Type(type);
-        icmpv4match.setIcmpv4Code(code);
-        matchBuilder.setIcmpv4Match(icmpv4match.build());
-
-        return matchBuilder;
-    }
-
-    /**
-     * @param matchBuilder MatchBuilder Object without a match yet
-     * @param dstip        String containing an IPv4 prefix
-     * @return matchBuilder Map Object with a match
-     */
-    private static MatchBuilder createDstL3IPv4Match(MatchBuilder matchBuilder, Ipv4Prefix dstip) {
-
-        EthernetMatchBuilder eth = new EthernetMatchBuilder();
-        EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
-        ethTypeBuilder.setType(new EtherType(0x0800L));
-        eth.setEthernetType(ethTypeBuilder.build());
-        matchBuilder.setEthernetMatch(eth.build());
-
-        Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder();
-        ipv4match.setIpv4Destination(dstip);
-
-        matchBuilder.setLayer3Match(ipv4match.build());
-
-        return matchBuilder;
-
-    }
-
-    /**
-     * @param matchBuilder MatchBuilder Object without a match yet
-     * @param srcip        String containing an IPv4 prefix
-     * @return             matchBuilder Map Object with a match
-     */
-    private static MatchBuilder createSrcL3IPv4Match(MatchBuilder matchBuilder, Ipv4Prefix srcip) {
-
-        EthernetMatchBuilder eth = new EthernetMatchBuilder();
-        EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
-        ethTypeBuilder.setType(new EtherType(0x0800L));
-        eth.setEthernetType(ethTypeBuilder.build());
-        matchBuilder.setEthernetMatch(eth.build());
-
-        Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder();
-        Ipv4MatchBuilder ipv4match = new Ipv4MatchBuilder();
-        ipv4match.setIpv4Source(srcip);
-        matchBuilder.setLayer3Match(ipv4match.build());
-
-        return matchBuilder;
-
-    }
-
-    /**
-     * Create Source TCP Port Match
-     *
-     * @param matchBuilder @param matchbuilder MatchBuilder Object without a match yet
-     * @param tcpport      Integer representing a source TCP port
-     * @return             matchBuilder Map MatchBuilder Object with a match
-     */
-    protected static MatchBuilder createSetSrcTcpMatch(MatchBuilder matchBuilder, PortNumber tcpport) {
-
-        EthernetMatchBuilder ethType = new EthernetMatchBuilder();
-        EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
-        ethTypeBuilder.setType(new EtherType(0x0800L));
-        ethType.setEthernetType(ethTypeBuilder.build());
-        matchBuilder.setEthernetMatch(ethType.build());
-
-        IpMatchBuilder ipmatch = new IpMatchBuilder();
-        ipmatch.setIpProtocol((short) 6);
-        matchBuilder.setIpMatch(ipmatch.build());
-
-        TcpMatchBuilder tcpmatch = new TcpMatchBuilder();
-        tcpmatch.setTcpSourcePort(tcpport);
-        matchBuilder.setLayer4Match(tcpmatch.build());
-
-        return matchBuilder;
-
-    }
-
-    /**
-     * Create Destination TCP Port Match
-     *
-     * @param matchBuilder MatchBuilder Object without a match yet
-     * @param tcpport      Integer representing a destination TCP port
-     * @return             matchBuilder Map MatchBuilder Object with a match
-     */
-    protected static MatchBuilder createSetDstTcpMatch(MatchBuilder matchBuilder, PortNumber tcpport) {
-
-        EthernetMatchBuilder ethType = new EthernetMatchBuilder();
-        EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
-        ethTypeBuilder.setType(new EtherType(0x0800L));
-        ethType.setEthernetType(ethTypeBuilder.build());
-        matchBuilder.setEthernetMatch(ethType.build());
-
-        IpMatchBuilder ipmatch = new IpMatchBuilder();
-        ipmatch.setIpProtocol((short) 6);
-        matchBuilder.setIpMatch(ipmatch.build());
-
-        PortNumber dstport = new PortNumber(tcpport);
-        TcpMatchBuilder tcpmatch = new TcpMatchBuilder();
-
-        tcpmatch.setTcpDestinationPort(tcpport);
-        matchBuilder.setLayer4Match(tcpmatch.build());
-
-        return matchBuilder;
-    }
-
-    /**
-     * Create Send to Controller Reserved Port Instruction (packet_in)
-     *
-     * @param ib Map InstructionBuilder without any instructions
-     * @return ib Map InstructionBuilder with instructions
-     */
-
-    protected static InstructionBuilder createSendToControllerInstructions(InstructionBuilder ib) {
-
-        List<Action> actionList = new ArrayList<Action>();
-        ActionBuilder ab = new ActionBuilder();
-
-        OutputActionBuilder output = new OutputActionBuilder();
-        output.setMaxLength(56);
-        Uri value = new Uri("CONTROLLER");
-        output.setOutputNodeConnector(value);
-        ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
-        ab.setOrder(0);
-        ab.setKey(new ActionKey(0));
-        actionList.add(ab.build());
-
-        // Create an Apply Action
-        ApplyActionsBuilder aab = new ApplyActionsBuilder();
-        aab.setAction(actionList);
-
-        // Wrap our Apply Action in an Instruction
-        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
-
-        return ib;
-    }
-
-    /**
-     * Create Output Port Instruction
-     *
-     * @param ib       Map InstructionBuilder without any instructions
-     * @param dpidLong Long the datapath ID of a switch/node
-     * @param port     Long representing a port on a switch/node
-     * @return ib InstructionBuilder Map with instructions
-     */
-    protected static InstructionBuilder createOutputPortInstructions(InstructionBuilder ib, Long dpidLong, Long port) {
-
-        NodeConnectorId ncid = new NodeConnectorId("openflow:" + dpidLong + ":" + port);
-        logger.debug("createOutputPortInstructions() Node Connector ID is - Type=openflow: DPID={} inPort={} ", dpidLong, port);
-
-        List<Action> actionList = new ArrayList<Action>();
-        ActionBuilder ab = new ActionBuilder();
-        OutputActionBuilder oab = new OutputActionBuilder();
-        oab.setOutputNodeConnector(ncid);
-
-        ab.setAction(new OutputActionCaseBuilder().setOutputAction(oab.build()).build());
-        ab.setOrder(0);
-        ab.setKey(new ActionKey(0));
-        actionList.add(ab.build());
-
-        // Create an Apply Action
-        ApplyActionsBuilder aab = new ApplyActionsBuilder();
-        aab.setAction(actionList);
-        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
-
-        return ib;
-    }
-
-    /**
-     * Create Output Port Instruction
-     *
-     * @param ib       Map InstructionBuilder without any instructions
-     * @param dpidLong Long the datapath ID of a switch/node
-     * @param port     Long representing a port on a switch/node
-     * @return ib InstructionBuilder Map with instructions
-     */
-    protected static InstructionBuilder createOutputPortInstructions(InstructionBuilder ib, Long dpidLong, Long port , List<Instruction> instructions) {
-
-        NodeConnectorId ncid = new NodeConnectorId("openflow:" + dpidLong + ":" + port);
-        logger.debug("createOutputPortInstructions() Node Connector ID is - Type=openflow: DPID={} port={} existingInstructions={}", dpidLong, port, instructions);
-
-        List<Action> actionList = new ArrayList<Action>();
-        ActionBuilder ab = new ActionBuilder();
-
-        List<Action> existingActions = null;
-        if (instructions != null) {
-            for (Instruction in : instructions) {
-                if (in.getInstruction() instanceof ApplyActionsCase) {
-                    existingActions = (((ApplyActionsCase) in.getInstruction()).getApplyActions().getAction());
-                    actionList.addAll(existingActions);
-                }
-            }
-        }
-
-        OutputActionBuilder oab = new OutputActionBuilder();
-        oab.setOutputNodeConnector(ncid);
-        ab.setAction(new OutputActionCaseBuilder().setOutputAction(oab.build()).build());
-        ab.setOrder(0);
-        ab.setKey(new ActionKey(0));
-        Action newAction = ab.build();
-        boolean addNew = true;
-        for (Action action : actionList) {
-            if (action.getAction() instanceof OutputActionCase) {
-                OutputActionCase opAction = (OutputActionCase)action.getAction();
-                if (opAction.getOutputAction().getOutputNodeConnector().equals(new Uri(ncid))) {
-                    addNew = false;
-                    break;
-                }
-            }
-        }
-        if (addNew) actionList.add(newAction);
-
-        // Create an Apply Action
-        ApplyActionsBuilder aab = new ApplyActionsBuilder();
-        aab.setAction(actionList);
-        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
-
-        return ib;
-    }
-
-    /**
-     * Create Set Vlan ID Instruction
-     *
-     * @param ib     Map InstructionBuilder without any instructions
-     * @param vlanId Integer representing a VLAN ID Integer representing a VLAN ID
-     * @return ib Map InstructionBuilder with instructions
-     */
-    protected static InstructionBuilder createSetVlanInstructions(InstructionBuilder ib, VlanId vlanId) {
-
-        List<Action> actionList = new ArrayList<Action>();
-        ActionBuilder ab = new ActionBuilder();
-
-        SetVlanIdActionBuilder vl = new SetVlanIdActionBuilder();
-        vl.setVlanId(vlanId);
-        ab.setAction(new SetVlanIdActionCaseBuilder().setSetVlanIdAction(vl.build()).build());
-        actionList.add(ab.build());
-        // Create an Apply Action
-        ApplyActionsBuilder aab = new ApplyActionsBuilder();
-        aab.setAction(actionList);
-
-        // Wrap our Apply Action in an Instruction
-        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
-
-        return ib;
-    }
-
-    /**
-     * Create Set IPv4 Destination Instruction
-     *
-     * @param ib Map InstructionBuilder without any instructions
-     * @return ib Map InstructionBuilder with instructions
-     */
-    protected static InstructionBuilder createStripVlanInstructions(InstructionBuilder ib) {
-
-        StripVlanActionBuilder stripVlanActionBuilder = new StripVlanActionBuilder();
-        StripVlanAction vlanAction = stripVlanActionBuilder.build();
-        ActionBuilder ab = new ActionBuilder();
-        ab.setAction(new StripVlanActionCaseBuilder().setStripVlanAction(vlanAction).build());
-
-        // Add our drop action to a list
-        List<Action> actionList = new ArrayList<Action>();
-        actionList.add(ab.build());
-
-        // Create an Apply Action
-        ApplyActionsBuilder aab = new ApplyActionsBuilder();
-        aab.setAction(actionList);
-
-        // Wrap our Apply Action in an Instruction
-        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
-
-        return ib;
-    }
-
-    /**
-     * Create Set IPv4 Source Instruction
-     *
-     * @param ib        Map InstructionBuilder without any instructions
-     * @param prefixsrc String containing an IPv4 prefix
-     * @return ib Map InstructionBuilder with instructions
-     */
-    protected static InstructionBuilder createNwSrcInstructions(InstructionBuilder ib, Ipv4Prefix prefixsrc) {
-
-        List<Action> actionList = new ArrayList<Action>();
-        ActionBuilder ab = new ActionBuilder();
-
-        SetNwSrcActionBuilder setNwsrcActionBuilder = new SetNwSrcActionBuilder();
-        Ipv4Builder ipsrc = new Ipv4Builder();
-        ipsrc.setIpv4Address(prefixsrc);
-        setNwsrcActionBuilder.setAddress(ipsrc.build());
-        ab.setAction(new SetNwSrcActionCaseBuilder().setSetNwSrcAction(setNwsrcActionBuilder.build()).build());
-        actionList.add(ab.build());
-
-        // Create an Apply Action
-        ApplyActionsBuilder aab = new ApplyActionsBuilder();
-        aab.setAction(actionList);
-
-        // Wrap our Apply Action in an Instruction
-        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
-
-        return ib;
-    }
-
-    /**
-     * Create Set IPv4 Destination Instruction
-     *
-     * @param ib           Map InstructionBuilder without any instructions
-     * @param prefixdst    String containing an IPv4 prefix
-     * @return ib Map InstructionBuilder with instructions
-     */
-    protected static InstructionBuilder createNwDstInstructions(InstructionBuilder ib, Ipv4Prefix prefixdst) {
-
-        List<Action> actionList = new ArrayList<Action>();
-        ActionBuilder ab = new ActionBuilder();
-
-        SetNwDstActionBuilder setNwDstActionBuilder = new SetNwDstActionBuilder();
-        Ipv4Builder ipdst = new Ipv4Builder();
-        ipdst.setIpv4Address(prefixdst);
-        setNwDstActionBuilder.setAddress(ipdst.build());
-        ab.setAction(new SetNwDstActionCaseBuilder().setSetNwDstAction(setNwDstActionBuilder.build()).build());
-        actionList.add(ab.build());
-
-        // Create an Apply Action
-        ApplyActionsBuilder aab = new ApplyActionsBuilder();
-        aab.setAction(actionList);
-
-        // Wrap our Apply Action in an Instruction
-        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
-
-        return ib;
-    }
-
-    /**
-     * Create Drop Instruction
-     *
-     * @param ib Map InstructionBuilder without any instructions
-     * @return ib Map InstructionBuilder with instructions
-     */
-    protected static InstructionBuilder createDropInstructions(InstructionBuilder ib) {
-
-        DropActionBuilder dab = new DropActionBuilder();
-        DropAction dropAction = dab.build();
-        ActionBuilder ab = new ActionBuilder();
-        ab.setAction(new DropActionCaseBuilder().setDropAction(dropAction).build());
-
-        // Add our drop action to a list
-        List<Action> actionList = new ArrayList<Action>();
-        actionList.add(ab.build());
-
-        // Create an Apply Action
-        ApplyActionsBuilder aab = new ApplyActionsBuilder();
-        aab.setAction(actionList);
-
-        // Wrap our Apply Action in an Instruction
-        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
-
-        return ib;
-    }
-
-    /**
-     * Create GOTO Table Instruction Builder
-     *
-     * @param ib      Map InstructionBuilder without any instructions
-     * @param tableId short representing a flow table ID short representing a flow table ID
-     * @return ib Map InstructionBuilder with instructions
-     */
-    protected static InstructionBuilder createGotoTableInstructions(InstructionBuilder ib, short tableId) {
-
-        GoToTableBuilder gttb = new GoToTableBuilder();
-        gttb.setTableId(tableId);
-
-        // Wrap our Apply Action in an InstructionBuilder
-        ib.setInstruction(new GoToTableCaseBuilder().setGoToTable(gttb.build()).build());
-
-        return ib;
-    }
-
-    /**
-     * Create Set Tunnel ID Instruction Builder
-     *
-     * @param ib       Map InstructionBuilder without any instructions
-     * @param tunnelId BigInteger representing a tunnel ID
-     * @return ib Map InstructionBuilder with instructions
-     */
-    protected static InstructionBuilder createSetTunnelIdInstructions(InstructionBuilder ib, BigInteger tunnelId) {
-
-        List<Action> actionList = new ArrayList<Action>();
-        ActionBuilder ab = new ActionBuilder();
-        SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
-
-        // Build the Set Tunnel Field Action
-        TunnelBuilder tunnel = new TunnelBuilder();
-        tunnel.setTunnelId(tunnelId);
-        setFieldBuilder.setTunnel(tunnel.build());
-        ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
-        actionList.add(ab.build());
-
-        ApplyActionsBuilder aab = new ApplyActionsBuilder();
-        aab.setAction(actionList);
-
-        // Wrap the Apply Action in an InstructionBuilder and return
-        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
-
-        return ib;
-    }
-
-    /**
-     * Create Set Source TCP Port Instruction
-     *
-     * @param ib      Map InstructionBuilder without any instructions
-     * @param tcpport Integer representing a source TCP port
-     * @return ib Map InstructionBuilder with instructions
-     */
-    protected static InstructionBuilder createSetSrcTCPPort(InstructionBuilder ib, PortNumber tcpport) {
-
-        List<Action> actionList = new ArrayList<Action>();
-        ActionBuilder ab = new ActionBuilder();
-        SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
-
-        // Build the Destination TCP Port
-        PortNumber tcpsrcport = new PortNumber(tcpport);
-        TcpMatchBuilder tcpmatch = new TcpMatchBuilder();
-        tcpmatch.setTcpSourcePort(tcpsrcport);
-
-        setFieldBuilder.setLayer4Match(tcpmatch.build());
-        ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
-        ab.setKey(new ActionKey(1));
-        actionList.add(ab.build());
-
-        ApplyActionsBuilder aab = new ApplyActionsBuilder();
-        aab.setAction(actionList);
-        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
-
-        return ib;
-    }
-
-    /**
-     * Create Set Destination TCP Port Instruction
-     *
-     * @param ib      Map InstructionBuilder without any instructions
-     * @param tcpport Integer representing a source TCP port
-     * @return ib Map InstructionBuilder with instructions
-     */
-    protected static InstructionBuilder createSetDstTCPPort(InstructionBuilder ib, PortNumber tcpport) {
-
-        List<Action> actionList = new ArrayList<Action>();
-        ActionBuilder ab = new ActionBuilder();
-        SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
-
-        // Build the Destination TCP Port
-        PortNumber tcpdstport = new PortNumber(tcpport);
-        TcpMatchBuilder tcpmatch = new TcpMatchBuilder();
-        tcpmatch.setTcpDestinationPort(tcpdstport);
-
-        setFieldBuilder.setLayer4Match(tcpmatch.build());
-        ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
-        ab.setKey(new ActionKey(1));
-        actionList.add(ab.build());
-
-        ApplyActionsBuilder aab = new ApplyActionsBuilder();
-        aab.setAction(actionList);
-        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
-
-        return ib;
-    }
-
-    /**
-     * Create Set Source UDP Port Instruction
-     *
-     * @param ib      Map InstructionBuilder without any instructions
-     * @param udpport Integer representing a source UDP port
-     * @return ib Map InstructionBuilder with instructions
-     */
-    protected static InstructionBuilder createSetSrcUDPPort(InstructionBuilder ib, PortNumber udpport) {
-
-        List<Action> actionList = new ArrayList<Action>();
-        ActionBuilder ab = new ActionBuilder();
-        SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
-
-        // Build the Destination TCP Port
-        PortNumber udpsrcport = new PortNumber(udpport);
-        UdpMatchBuilder udpmatch = new UdpMatchBuilder();
-        udpmatch.setUdpSourcePort(udpsrcport);
-
-        setFieldBuilder.setLayer4Match(udpmatch.build());
-        ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
-        ab.setKey(new ActionKey(1));
-        actionList.add(ab.build());
-
-        ApplyActionsBuilder aab = new ApplyActionsBuilder();
-        aab.setAction(actionList);
-        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
-
-        return ib;
-    }
-
-    /**
-     * Create Set Destination UDP Port Instruction
-     *
-     * @param ib      Map InstructionBuilder without any instructions
-     * @param udpport Integer representing a destination UDP port
-     * @return ib Map InstructionBuilder with instructions
-     */
-    protected static InstructionBuilder createSetDstUDPPort(InstructionBuilder ib, PortNumber udpport) {
-
-        List<Action> actionList = new ArrayList<Action>();
-        ActionBuilder ab = new ActionBuilder();
-        SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
-
-        // Build the Destination TCP Port
-        PortNumber udpdstport = new PortNumber(udpport);
-        UdpMatchBuilder udpmatch = new UdpMatchBuilder();
-        udpmatch.setUdpDestinationPort(udpdstport);
-
-        setFieldBuilder.setLayer4Match(udpmatch.build());
-        ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
-        ab.setKey(new ActionKey(1));
-        actionList.add(ab.build());
-
-        ApplyActionsBuilder aab = new ApplyActionsBuilder();
-        aab.setAction(actionList);
-        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
-
-        return ib;
-    }
-
-    /**
-     * Create Set ICMP Code Instruction
-     *
-     * @param ib   Map InstructionBuilder without any instructions
-     * @param code short repesenting an ICMP code
-     * @return ib Map InstructionBuilder with instructions
-     */
-
-    private static InstructionBuilder createSetIcmpCodeInstruction(InstructionBuilder ib, short code) {
-
-        List<Action> actionList = new ArrayList<Action>();
-        ActionBuilder ab = new ActionBuilder();
-        SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
-        Icmpv4MatchBuilder icmpv4match = new Icmpv4MatchBuilder();
-
-        // Build the ICMPv4 Code Match
-        icmpv4match.setIcmpv4Code(code);
-        setFieldBuilder.setIcmpv4Match(icmpv4match.build());
-
-        ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
-        ab.setKey(new ActionKey(0));
-        actionList.add(ab.build());
-        ApplyActionsBuilder aab = new ApplyActionsBuilder();
-        aab.setAction(actionList);
-
-        // Wrap our Apply Action in an Instruction
-        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
-
-        return ib;
-    }
-
-    /**
-     * Create Set ICMP Code Instruction
-     *
-     * @param ib Map InstructionBuilder without any instructions
-     * @return ib Map InstructionBuilder with instructions
-     */
-    private static InstructionBuilder createSetIcmpTypeInstruction(InstructionBuilder ib, short type) {
-
-        List<Action> actionList = new ArrayList<Action>();
-        ActionBuilder ab = new ActionBuilder();
-        SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
-        Icmpv4MatchBuilder icmpv4match = new Icmpv4MatchBuilder();
-
-        // Build the ICMPv4 Code Match
-        icmpv4match.setIcmpv4Code(type);
-        setFieldBuilder.setIcmpv4Match(icmpv4match.build());
-
-        ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
-        ab.setKey(new ActionKey(1));
-        actionList.add(ab.build());
-        ApplyActionsBuilder aab = new ApplyActionsBuilder();
-        aab.setAction(actionList);
-
-        // Wrap our Apply Action in an Instruction
-        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
-
-        return ib;
-    }
-
-    /**
-     * Create Decrement TTL Instruction
-     *
-     * @param ib Map InstructionBuilder without any instructions
-     * @return ib Map InstructionBuilder with instructions
-     */
-    private static InstructionBuilder createDecNwTtlInstructions(InstructionBuilder ib) {
-        DecNwTtlBuilder decNwTtlBuilder = new DecNwTtlBuilder();
-        DecNwTtl decNwTtl = decNwTtlBuilder.build();
-        ActionBuilder ab = new ActionBuilder();
-        ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(decNwTtl).build());
-
-        // Add our drop action to a list
-        List<Action> actionList = new ArrayList<Action>();
-        actionList.add(ab.build());
-
-        // Create an Apply Action
-        ApplyActionsBuilder aab = new ApplyActionsBuilder();
-        aab.setAction(actionList);
-
-        // Wrap our Apply Action in an Instruction
-        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
-
-        return ib;
-    }
-
-    /**
-     * Set Src Arp MAC
-     */
-    private static InstructionBuilder createSrcArpMacInstructions(InstructionBuilder ib, MacAddress macsrc) {
-
-        List<Action> actionList = new ArrayList<Action>();
-        ActionBuilder ab = new ActionBuilder();
-
-        SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
-        ArpMatchBuilder arpmatch = new ArpMatchBuilder();
-        ArpSourceHardwareAddressBuilder arpsrc = new ArpSourceHardwareAddressBuilder();
-        arpsrc.setAddress(macsrc);
-        arpmatch.setArpSourceHardwareAddress(arpsrc.build());
-        setFieldBuilder.setLayer3Match(arpmatch.build());
-        ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
-        ab.setKey(new ActionKey(0));
-        actionList.add(ab.build());
-
-        ApplyActionsBuilder aab = new ApplyActionsBuilder();
-        aab.setAction(actionList);
-
-        return ib;
-    }
-
-    /**
-     * Set Dst Arp MAC
-     */
-    private static InstructionBuilder createDstArpMacInstructions(InstructionBuilder ib, MacAddress macdst) {
-
-        List<Action> actionList = new ArrayList<Action>();
-        ActionBuilder ab = new ActionBuilder();
-        SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
-
-        ArpMatchBuilder arpmatch = new ArpMatchBuilder();
-        ArpTargetHardwareAddressBuilder arpdst = new ArpTargetHardwareAddressBuilder();
-        arpdst.setAddress(macdst);
-        setFieldBuilder.setLayer3Match(arpmatch.build());
-        ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
-        ab.setKey(new ActionKey(0));
-        actionList.add(ab.build());
-
-        ApplyActionsBuilder aab = new ApplyActionsBuilder();
-        aab.setAction(actionList);
-
-        return ib;
-    }
-
-    /**
-     * Set Dst Arp IP
-     */
-    private static InstructionBuilder createDstArpIpInstructions(InstructionBuilder ib, Ipv4Prefix dstiparp) {
-
-        List<Action> actionList = new ArrayList<Action>();
-        ActionBuilder ab = new ActionBuilder();
-        SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
-
-        ArpMatchBuilder arpmatch = new ArpMatchBuilder();
-        arpmatch.setArpTargetTransportAddress(dstiparp);
-        setFieldBuilder.setLayer3Match(arpmatch.build());
-        ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
-        ab.setKey(new ActionKey(0));
-        actionList.add(ab.build());
-
-        ApplyActionsBuilder aab = new ApplyActionsBuilder();
-        aab.setAction(actionList);
-
-        return ib;
-    }
-
-    /**
-     * Set Src Arp IP
-     */
-    private static InstructionBuilder createSrcArpIpInstructions(InstructionBuilder ib, Ipv4Prefix srciparp) {
-
-        List<Action> actionList = new ArrayList<Action>();
-        ActionBuilder ab = new ActionBuilder();
-        SetFieldBuilder setFieldBuilder = new SetFieldBuilder();
-
-        ArpMatchBuilder arpmatch = new ArpMatchBuilder();
-        arpmatch.setArpSourceTransportAddress(srciparp);
-        setFieldBuilder.setLayer3Match(arpmatch.build());
-        ab.setAction(new SetFieldCaseBuilder().setSetField(setFieldBuilder.build()).build());
-        ab.setKey(new ActionKey(0));
-        actionList.add(ab.build());
-
-        ApplyActionsBuilder aab = new ApplyActionsBuilder();
-        aab.setAction(actionList);
-
-        return ib;
-    }
-
-    @Override
-    public void initializeOFFlowRules(Node openflowNode) {
-        IConnectionServiceInternal connectionService = (IConnectionServiceInternal)ServiceHelper.getGlobalInstance(IConnectionServiceInternal.class, this);
-        List<Node> ovsNodes = connectionService.getNodes();
-        if (ovsNodes == null) return;
-        for (Node ovsNode : ovsNodes) {
-            Long dpid = this.getIntegrationBridgeOFDPID(ovsNode);
-            logger.debug("Compare openflowNode to OVS br-int node {} vs {}", openflowNode.getID(), dpid);
-            String openflowID = ""+openflowNode.getID();
-            if (openflowID.contains(""+dpid)) {
-                this.initializeFlowRules(ovsNode, AdminConfigManager.getManager().getIntegrationBridgeName());
-                this.triggerInterfaceUpdates(ovsNode);
-            }
-        }
-    }
-
-    private NodeBuilder createNodeBuilder(String nodeId) {
-        NodeBuilder builder = new NodeBuilder();
-        builder.setId(new NodeId(nodeId));
-        builder.setKey(new NodeKey(builder.getId()));
-        return builder;
-    }
-
-    private InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node> nodeBuilderToInstanceId(NodeBuilder
-                                                                                                                                             node) {
-        return InstanceIdentifier.builder(Nodes.class).child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node.class,
-                node.getKey()).toInstance();
-    }
-}
index aea533813d886a172c006c8aab440dfc52d79ebf..b95eeb8c737a5a9ffca6161bfa8df391045e4f23 100644 (file)
@@ -5,74 +5,40 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  *
- * Authors : Madhu Venugopal, Brent Salisbury
+ * Authors : Madhu Venugopal, Brent Salisbury, Dave Tucker
  */
 package org.opendaylight.ovsdb.neutron.provider;
 
-import java.util.Map;
-
-import org.opendaylight.controller.sal.core.Node;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
-import org.opendaylight.controller.sal.utils.Status;
-import org.opendaylight.ovsdb.lib.table.Bridge;
-import org.opendaylight.ovsdb.lib.table.Interface;
-import org.opendaylight.ovsdb.lib.table.Table;
-import org.opendaylight.ovsdb.plugin.OVSDBConfigService;
+import org.opendaylight.ovsdb.neutron.IAdminConfigManager;
+import org.opendaylight.ovsdb.neutron.IInternalNetworkManager;
+import org.opendaylight.ovsdb.neutron.ITenantNetworkManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public abstract class ProviderNetworkManager {
+public class ProviderNetworkManager implements IProviderNetworkManager {
     static final Logger logger = LoggerFactory.getLogger(ProviderNetworkManager.class);
-    private static ProviderNetworkManager provider;
-    protected static final int LLDP_PRIORITY = 1000;
-    protected static final int NORMAL_PRIORITY = 0;
+    private NetworkProvider provider;
     protected static final String OPENFLOW_10 = "1.0";
     protected static final String OPENFLOW_13 = "1.3";
 
-    public static ProviderNetworkManager getManager() {
+    // The implementation for each of these services is resolved by the OSGi Service Manager
+    private volatile IAdminConfigManager adminConfigManager;
+    private volatile IInternalNetworkManager internalNetworkManager;
+    private volatile ITenantNetworkManager tenantNetworkManager;
+
+    public NetworkProvider getProvider() {
         if (provider != null) return provider;
         String ofVersion = System.getProperty("ovsdb.of.version", OPENFLOW_10);
         switch (ofVersion) {
             case OPENFLOW_13:
-                provider = new OF13ProviderManager();
+                provider = new OF13Provider(adminConfigManager, internalNetworkManager, tenantNetworkManager);
                 break;
             case OPENFLOW_10:
             default:
-                provider = new OF10ProviderManager();
+                provider = new OF10Provider(adminConfigManager, internalNetworkManager, tenantNetworkManager);
                 break;
         }
         return provider;
     }
 
-    protected String getInternalBridgeUUID (Node node, String bridgeName) {
-        try {
-            OVSDBConfigService ovsdbTable = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);
-            Map<String, Table<?>> bridgeTable = ovsdbTable.getRows(node, Bridge.NAME.getName());
-            if (bridgeTable == null) return null;
-            for (String key : bridgeTable.keySet()) {
-                Bridge bridge = (Bridge)bridgeTable.get(key);
-                if (bridge.getName().equals(bridgeName)) return key;
-            }
-        } catch (Exception e) {
-            logger.error("Error getting Bridge Identifier for {} / {}", node, bridgeName, e);
-        }
-        return null;
-    }
-
-    public abstract boolean hasPerTenantTunneling();
-    public abstract Status handleInterfaceUpdate(String tunnelType, String tunnelKey);
-    public abstract Status handleInterfaceUpdate(String tunnelType, String tunnelKey, Node source, Interface intf);
-    public abstract Status handleInterfaceDelete(String tunnelType, String tunnelKey, Node source, Interface intf, boolean isLastInstanceOnNode);
-    /*
-     * Initialize the Flow rules given the OVSDB node.
-     * This method provides a set of common functionalities to initialize the Flow rules of an OVSDB node
-     * that are Openflow Version specific. Hence we have this method in addition to the following
-     * Openflow Node specific initialization method.
-     */
-    public abstract void initializeFlowRules(Node node);
-
-    /*
-     * Initialize the Flow rules given the Openflow node
-     */
-    public abstract void initializeOFFlowRules(Node openflowNode);
 }
index 7ef27dec559a6e2055ff5ee11b60d4dd3934faf6..6e3f6774fd07e6bd1cfe27d63b19302790445be1 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
+ * Copyright (c) 2013 Hewlett-Packard Development Company, L.P. and others
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -7,11 +7,13 @@
  *
  * Contributors:
  *    Dave Tucker (HP) - Added unit tests for the AdminConfigManager class.
+ *    Sam Hague - Added unit tests for getPhysicalInterfaceName.
  *******************************************************************************/
 
 package org.opendaylight.ovsdb.neutron;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
 import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.anyObject;
 import static org.mockito.Matchers.anyString;
@@ -23,6 +25,7 @@ import java.net.InetAddress;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 
+import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.opendaylight.controller.sal.core.Node;
@@ -40,6 +43,38 @@ import org.powermock.modules.junit4.PowerMockRunner;
 @PrepareForTest(ServiceHelper.class)
 public class AdminConfigManagerTest {
 
+    AdminConfigManager adminConfigManager;
+    private OVSDBConfigService ovsdbConfig;
+    private Node node;
+    private Open_vSwitch ovsTable;
+    private ConcurrentMap<String, Table<?>> ovsMap;
+    private OvsDBMap map;
+
+    private static String OPENVSWITCH = "Open_vSwitch";
+    private static String PROVIDER_MAPPINGS = "provider_mappings";
+    private static String PHYSNET1 = "physnet1";
+    private static String ETH1 = "eth1";
+    private static String PHYSNET2 = "physnet2";
+    private static String ETH2 = "eth2";
+    private static String PHYSNET3 = "physnet3";
+    private static String ETH3 = "eth3";
+    private static String LOCAL_IP = "local_ip";
+    private static String IPADDR = "10.10.10.10";
+
+    @Before
+    public void setUp(){
+        adminConfigManager = new AdminConfigManager();
+
+        node = mock(Node.class);
+        ovsdbConfig = mock(ConfigurationService.class);
+        PowerMockito.mockStatic(ServiceHelper.class);
+        when(ServiceHelper.getGlobalInstance(eq(OVSDBConfigService.class), anyObject())).thenReturn(ovsdbConfig);
+
+        ovsTable = new Open_vSwitch();
+        ovsMap = new ConcurrentHashMap<>();
+        map = new OvsDBMap();
+    }
+
     @Test
     public void testGetTunnelEndpoint() throws Exception {
         InetAddress testAddress = InetAddress.getByName("10.10.10.10");
@@ -62,10 +97,10 @@ public class AdminConfigManagerTest {
         when(ServiceHelper.getGlobalInstance(eq(OVSDBConfigService.class), anyObject())).thenReturn(ovsdbConfig);
 
         // OVSDBConfigService is null
-        assertEquals(null, AdminConfigManager.getManager().getTunnelEndPoint(mockNode));
+        assertEquals(null, adminConfigManager.getTunnelEndPoint(mockNode));
 
         // Success...
-        assertEquals(testAddress, AdminConfigManager.getManager().getTunnelEndPoint(mockNode));
+        assertEquals(testAddress, adminConfigManager.getTunnelEndPoint(mockNode));
     }
 
     @Test
@@ -98,6 +133,74 @@ public class AdminConfigManagerTest {
         when(ServiceHelper.getGlobalInstance(eq(OVSDBConfigService.class), anyObject())).thenReturn(ovsdbConfig);
 
         // Success...
-        assertEquals(testAddress, AdminConfigManager.getManager().getTunnelEndPoint(mockNode));
+        assertEquals(testAddress, adminConfigManager.getTunnelEndPoint(mockNode));
+    }
+
+    // Add key:value pairs to the map.
+    // Calling again with the same key will overwrite the current pair.
+    private void initMap (String key, String value) {
+        map.put(key, value);
+        ovsTable.setOther_config(map);
+        ovsMap.put(OPENVSWITCH, ovsTable);
+    }
+
+    @Test
+    public void testGetPhysicalInterfaceName () throws Exception {
+        when(ovsdbConfig.getRows(any(Node.class), anyString())).thenReturn(ovsMap);
+
+        // Check if match can be found with a single pair
+        initMap(PROVIDER_MAPPINGS, PHYSNET1 + ":" + ETH1);
+        assertEquals("Failed to find " + ETH1 + " in " + map.toString(),
+                ETH1, adminConfigManager.getPhysicalInterfaceName(node, PHYSNET1));
+
+        // Check if match can be found with different pairs
+        initMap(PROVIDER_MAPPINGS, PHYSNET1 + ":" + ETH1 + "," + PHYSNET2 + ":" + ETH2);
+        assertEquals("Failed to find " + ETH2 + " in " + map.toString(),
+                ETH2, adminConfigManager.getPhysicalInterfaceName(node, PHYSNET2));
+
+        // Check if match can be found with duplicate pairs
+        initMap(PROVIDER_MAPPINGS, PHYSNET1 + ":" + ETH1 + "," + PHYSNET2 + ":" + ETH2 + "," + PHYSNET2 + ":" + ETH2);
+        assertEquals("Failed to find " + ETH2 + " in " + map.toString(),
+                ETH2, adminConfigManager.getPhysicalInterfaceName(node, PHYSNET2));
+
+        // Check if match can be found with multiple pairs and extra other_config
+        initMap(LOCAL_IP, IPADDR);
+        assertEquals("Failed to find " + ETH2 + " in " + map.toString(),
+                ETH2, adminConfigManager.getPhysicalInterfaceName(node, PHYSNET2));
+    }
+
+    @Test
+    public void testGetPhysicalInterfaceNameNegative () throws Exception {
+        when(ovsdbConfig.getRows(any(Node.class), anyString())).thenReturn(null)
+                .thenReturn(ovsMap);
+
+        // Add a null row, an empty row and a good row to the table
+        Open_vSwitch nullRow = new Open_vSwitch();
+        Open_vSwitch emptyRow = new Open_vSwitch();
+        OvsDBMap emptyProviderMap = new OvsDBMap();
+        emptyRow.setOther_config(emptyProviderMap);
+        ovsMap.put("0", nullRow);
+        ovsMap.put("1", emptyRow);
+        initMap(PROVIDER_MAPPINGS, PHYSNET1 + ":" + ETH1);
+
+        // Check if no rows/no table is handled
+        assertEquals("Failed to return null when ovsdb table is null",
+                null, adminConfigManager.getTunnelEndPoint(node));
+
+        // Check if the null and empty rows are ignored
+        System.out.println("map = " + map.toString());
+        System.out.println("ovsMap = " + ovsMap.toString());
+        assertEquals("Failed to find " + ETH1 + " in " + map.toString(),
+                ETH1, adminConfigManager.getPhysicalInterfaceName(node, PHYSNET1));
+
+        // Should not be able to find match
+        initMap(PROVIDER_MAPPINGS, PHYSNET1 + ":" + ETH1 + "," + PHYSNET2 + ":" + ETH2);
+        assertNull("Found " + ETH3 + " in " + map.toString(),
+                adminConfigManager.getPhysicalInterfaceName(node, PHYSNET3));
+
+        // Should not be able to find match with mal-formed values
+        initMap(PROVIDER_MAPPINGS, PHYSNET1 + "-" + ETH1);
+        assertNull("Found " + ETH1 + " in " + map.toString(),
+                adminConfigManager.getPhysicalInterfaceName(node, PHYSNET1));
     }
 }
index 48c70d0ec3bb3e0fe272e8fcfbdfae1db61f8736..e6cea7b496fa81651793a1b14a7bdf524e57c9b8 100644 (file)
@@ -19,12 +19,12 @@ import static org.mockito.Mockito.when;
 
 import java.net.HttpURLConnection;
 
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.opendaylight.controller.networkconfig.neutron.NeutronNetwork;
 import org.powermock.core.classloader.annotations.PrepareForTest;
 import org.powermock.modules.junit4.PowerMockRunner;
-import org.powermock.reflect.Whitebox;
 
 @RunWith(PowerMockRunner.class)
 @PrepareForTest(TenantNetworkManager.class)
@@ -61,6 +61,7 @@ public class NetworkHandlerTest {
         assertEquals(HttpURLConnection.HTTP_OK, testNetworkHandler.canDeleteNetwork(network));
     }
 
+    @Ignore
     @Test
     public void testNeutronNetworkDeleted() throws Exception {
         String netId = "6cfdb7";
@@ -70,9 +71,7 @@ public class NetworkHandlerTest {
         when(mockNet.getID()).thenReturn(netId);
 
         NetworkHandler spy = spy(testNetworkHandler);
-
         TenantNetworkManager tenantNetworkManager = mock(TenantNetworkManager.class);
-        Whitebox.setInternalState(TenantNetworkManager.class, "tenantHelper", tenantNetworkManager);
 
         when(spy.canDeleteNetwork(mockNet))
                 .thenReturn(HttpURLConnection.HTTP_BAD_REQUEST)
index 86567364aaa181e64c6c5bd1698585d377c01175..fc2624ec40b305a48613caeb22e41e3d53d31e95 100644 (file)
@@ -12,6 +12,7 @@ package org.opendaylight.ovsdb.northbound;
 import org.opendaylight.ovsdb.lib.table.Bridge;
 import org.opendaylight.ovsdb.lib.table.Capability;
 import org.opendaylight.ovsdb.lib.table.Controller;
+import org.opendaylight.ovsdb.lib.table.IPFIX;
 import org.opendaylight.ovsdb.lib.table.Interface;
 import org.opendaylight.ovsdb.lib.table.Manager;
 import org.opendaylight.ovsdb.lib.table.Mirror;
@@ -59,7 +60,8 @@ public class OVSDBRow {
         @JsonSubTypes.Type(value=Qos.class, name="QoS"),
         @JsonSubTypes.Type(value=Queue.class, name="Queue"),
         @JsonSubTypes.Type(value=SFlow.class, name="sFlow"),
-        @JsonSubTypes.Type(value=SSL.class, name="SSL")
+        @JsonSubTypes.Type(value=SSL.class, name="SSL"),
+        @JsonSubTypes.Type(value=IPFIX.class, name="IPFIX")
         })
     Table row;
 
diff --git a/paxexam/common.integrationtest/pom.xml b/paxexam/common.integrationtest/pom.xml
new file mode 100644 (file)
index 0000000..0546587
--- /dev/null
@@ -0,0 +1,145 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.opendaylight.ovsdb</groupId>
+    <artifactId>commons.ovsdb</artifactId>
+    <version>1.0.1-SNAPSHOT</version>
+    <relativePath>../../commons/parent</relativePath>
+  </parent>
+
+  <artifactId>common.integrationtest</artifactId>
+  <version>1.0.1-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <dependencies>
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-classic</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>org.apache.felix.gogo.command</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>org.apache.felix.gogo.runtime</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>org.apache.felix.gogo.shell</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>org.eclipse.equinox.console</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>org.eclipse.equinox.ds</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>org.eclipse.equinox.util</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>org.eclipse.osgi.services</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>log4j-over-slf4j</artifactId>
+    </dependency>
+    <!-- Add Pax Exam -->
+    <dependency>
+      <groupId>org.ops4j.pax.exam</groupId>
+      <artifactId>pax-exam-junit4</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.exam</groupId>
+      <artifactId>pax-exam-link-mvn</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.url</groupId>
+      <artifactId>pax-url-aether</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <version>${checkstyle.version}</version>
+        <configuration>
+          <failsOnError>true</failsOnError>
+          <configLocation>controller/checkstyle.xml</configLocation>
+        </configuration>
+        <dependencies>
+          <dependency>
+            <groupId>org.opendaylight.controller</groupId>
+            <artifactId>checkstyle</artifactId>
+            <version>0.0.3-SNAPSHOT</version>
+          </dependency>
+        </dependencies>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>${surefire.version}</version>
+        <configuration>
+          <skipTests>true</skipTests>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>properties-maven-plugin</artifactId>
+        <version>${propertymavenplugin.version}</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>set-system-properties</goal>
+            </goals>
+            <configuration>
+              <properties>
+                <property>
+                  <name>logback.configurationFile</name>
+                  <value>${project.parent.parent.basedir}/logback.xml</value>
+                </property>
+              </properties>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.ops4j.pax.exam</groupId>
+        <artifactId>maven-paxexam-plugin</artifactId>
+        <version>1.2.4</version>
+        <executions>
+          <execution>
+            <id>generate-config</id>
+            <goals>
+              <goal>generate-depends-file</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  <scm>
+    <connection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</connection>
+    <developerConnection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</developerConnection>
+    <tag>HEAD</tag>
+    <url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
+  </scm>
+</project>
diff --git a/paxexam/plugin.integrationtest/.gitignore b/paxexam/plugin.integrationtest/.gitignore
new file mode 100644 (file)
index 0000000..a48e45b
--- /dev/null
@@ -0,0 +1 @@
+/target-ide
diff --git a/paxexam/plugin.integrationtest/pom.xml b/paxexam/plugin.integrationtest/pom.xml
new file mode 100644 (file)
index 0000000..a2bdd04
--- /dev/null
@@ -0,0 +1,234 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.opendaylight.ovsdb</groupId>
+    <artifactId>common.integrationtest</artifactId>
+    <version>1.0.1-SNAPSHOT</version>
+    <relativePath>../common.integrationtest</relativePath>
+  </parent>
+
+  <artifactId>ovsdb.plugin.integrationtest</artifactId>
+  <version>0.4.2-SNAPSHOT</version>
+  <properties>
+    <sonar.jacoco.itReportPath>../implementation/target/jacoco-it.exec</sonar.jacoco.itReportPath>
+    <!-- Sonar jacoco plugin to get integration test coverage info -->
+    <sonar.jacoco.reportPath>../implementation/target/jacoco.exec</sonar.jacoco.reportPath>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-classic</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-annotations</artifactId>
+      <version>${jackson.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-core</artifactId>
+      <version>${jackson.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.fasterxml.jackson.core</groupId>
+      <artifactId>jackson-databind</artifactId>
+      <version>${jackson.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.google.code.gson</groupId>
+      <artifactId>gson</artifactId>
+      <version>2.1</version>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.google.guava</groupId>
+      <artifactId>guava</artifactId>
+      <version>${guava.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-codec</groupId>
+      <artifactId>commons-codec</artifactId>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>commons-codec</groupId>
+      <artifactId>commons-codec</artifactId>
+      <version>1.4</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-collections</groupId>
+      <artifactId>commons-collections</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-lang</groupId>
+      <artifactId>commons-lang</artifactId>
+      <version>2.3</version>
+    </dependency>
+    <dependency>
+      <groupId>eclipselink</groupId>
+      <artifactId>javax.resource</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>javax.servlet</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>equinoxSDK381</groupId>
+      <artifactId>org.eclipse.osgi</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>io.netty</groupId>
+      <artifactId>netty-buffer</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>io.netty</groupId>
+      <artifactId>netty-codec</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>io.netty</groupId>
+      <artifactId>netty-common</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>io.netty</groupId>
+      <artifactId>netty-handler</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>io.netty</groupId>
+      <artifactId>netty-transport</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>javax.portlet</groupId>
+      <artifactId>portlet-api</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.felix</groupId>
+      <artifactId>org.apache.felix.dependencymanager.shell</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.httpcomponents</groupId>
+      <artifactId>httpcore-nio</artifactId>
+      <version>4.2.1</version>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>clustering.services</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>clustering.services-implementation</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>containermanager</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>containermanager.it.implementation</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal.connection</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal.connection.implementation</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal.implementation</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal.networkconfiguration</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal.networkconfiguration.implementation</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.ovsdb</groupId>
+      <artifactId>ovsdb</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>log4j-over-slf4j</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.exam</groupId>
+      <artifactId>pax-exam-container-native</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.exam</groupId>
+      <artifactId>pax-exam-junit4</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.exam</groupId>
+      <artifactId>pax-exam-link-mvn</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.ops4j.pax.url</groupId>
+      <artifactId>pax-url-aether</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.jacoco</groupId>
+        <artifactId>jacoco-maven-plugin</artifactId>
+        <configuration>
+          <destFile>../implementation/target/jacoco-it.exec</destFile>
+          <includes>
+            <include>org.opendaylight.controller.*</include>
+            <include>org.opendaylight.ovsdb.*</include>
+          </includes>
+        </configuration>
+        <executions>
+          <execution>
+            <id>pre-test</id>
+            <goals>
+              <goal>prepare-agent</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>post-test</id>
+            <configuration>
+              <skip>true</skip>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  <scm>
+    <connection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</connection>
+    <developerConnection>scm:git:ssh://git.opendaylight.org:29418/ovsdb.git</developerConnection>
+    <tag>HEAD</tag>
+    <url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
+  </scm>
+</project>
diff --git a/paxexam/plugin.integrationtest/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbPluginIT.java b/paxexam/plugin.integrationtest/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbPluginIT.java
new file mode 100644 (file)
index 0000000..e97181d
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2014 Red Hat, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.plugin;\r
+\r
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.ops4j.pax.exam.CoreOptions.junitBundles;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.systemPackages;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+
+import java.io.IOException;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.utils.ServiceHelper;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.util.PathUtils;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+\r
+@RunWith(PaxExam.class)\r
+public class OvsdbPluginIT extends OvsdbTestBase {\r
+    private Logger log = LoggerFactory.getLogger(OvsdbPluginIT.class);\r
+    @Inject\r
+    private BundleContext bc;\r
+    private OVSDBConfigService ovsdbConfigService = null;
+    private Node node = null;\r
+\r
+    // Configure the OSGi container\r
+    @Configuration\r
+    public Option[] config() {\r
+        return options(\r
+            //\r
+            systemProperty("logback.configurationFile").value(\r
+                "file:" + PathUtils.getBaseDir()\r
+                + "/src/test/resources/logback.xml"),\r
+            // To start OSGi console for inspection remotely\r
+            systemProperty("osgi.console").value("2401"),\r
+            // Set the systemPackages (used by clustering)\r
+            systemPackages("sun.reflect", "sun.reflect.misc", "sun.misc"),\r
+            // List framework bundles\r
+            mavenBundle("equinoxSDK381",\r
+                        "org.eclipse.equinox.console").versionAsInProject(),\r
+            mavenBundle("equinoxSDK381",\r
+                        "org.eclipse.equinox.util").versionAsInProject(),\r
+            mavenBundle("equinoxSDK381",\r
+                        "org.eclipse.osgi.services").versionAsInProject(),\r
+            mavenBundle("equinoxSDK381",\r
+                        "org.eclipse.equinox.ds").versionAsInProject(),\r
+            mavenBundle("equinoxSDK381",\r
+                        "org.apache.felix.gogo.command").versionAsInProject(),\r
+            mavenBundle("equinoxSDK381",\r
+                        "org.apache.felix.gogo.runtime").versionAsInProject(),\r
+            mavenBundle("equinoxSDK381",\r
+                        "org.apache.felix.gogo.shell").versionAsInProject(),
+            mavenBundle("equinoxSDK381", "javax.servlet").versionAsInProject(),
+
+            mavenBundle("com.google.guava",
+                        "guava").versionAsInProject(),
+\r
+            // List logger bundles\r
+            mavenBundle("org.slf4j", "slf4j-api").versionAsInProject(),\r
+            mavenBundle("org.slf4j", "log4j-over-slf4j").versionAsInProject(),\r
+            mavenBundle("ch.qos.logback", "logback-core").versionAsInProject(),\r
+            mavenBundle("ch.qos.logback", "logback-classic").versionAsInProject(),\r
+            // List all the bundles on which the test case depends
+            mavenBundle("org.opendaylight.ovsdb", "ovsdb").versionAsInProject(),\r
+            mavenBundle("org.opendaylight.controller",\r
+                        "clustering.services").versionAsInProject(),\r
+            mavenBundle("org.opendaylight.controller",\r
+                        "clustering.services-implementation").versionAsInProject(),\r
+            mavenBundle("org.opendaylight.controller", "sal").versionAsInProject(),\r
+            mavenBundle("org.opendaylight.controller",\r
+                        "sal.implementation").versionAsInProject(),
+            mavenBundle("org.opendaylight.controller", "sal.connection").versionAsInProject(),
+            mavenBundle("org.opendaylight.controller",
+                        "sal.connection.implementation").versionAsInProject(),
+            mavenBundle("org.opendaylight.controller",
+                        "sal.networkconfiguration").versionAsInProject(),
+            mavenBundle("org.opendaylight.controller",
+                        "sal.networkconfiguration.implementation").versionAsInProject(),\r
+            mavenBundle("org.opendaylight.controller", "configuration").versionAsInProject(),\r
+            mavenBundle("org.opendaylight.controller", "containermanager").versionAsInProject(),\r
+            mavenBundle("org.opendaylight.controller",\r
+                        "containermanager.it.implementation").versionAsInProject(),
+            mavenBundle("com.fasterxml.jackson.core", "jackson-annotations").versionAsInProject(),
+            mavenBundle("com.fasterxml.jackson.core", "jackson-core").versionAsInProject(),
+            mavenBundle("com.fasterxml.jackson.core", "jackson-databind").versionAsInProject(),
+            mavenBundle("io.netty", "netty-buffer").versionAsInProject(),
+            mavenBundle("io.netty", "netty-common").versionAsInProject(),
+            mavenBundle("io.netty", "netty-codec").versionAsInProject(),
+            mavenBundle("io.netty", "netty-transport").versionAsInProject(),
+            mavenBundle("io.netty", "netty-handler").versionAsInProject(),
+
+            mavenBundle("org.apache.httpcomponents", "httpcore-nio").versionAsInProject(),
+            mavenBundle("com.google.code.gson", "gson").versionAsInProject(),\r
+            mavenBundle("org.jboss.spec.javax.transaction",\r
+                        "jboss-transaction-api_1.1_spec").versionAsInProject(),\r
+            mavenBundle("org.apache.commons", "commons-lang3").versionAsInProject(),\r
+            mavenBundle("org.apache.felix",\r
+                        "org.apache.felix.dependencymanager").versionAsInProject(),\r
+            mavenBundle("org.apache.felix",\r
+                        "org.apache.felix.dependencymanager.shell").versionAsInProject(),\r
+            mavenBundle("eclipselink", "javax.resource").versionAsInProject(),\r
+            junitBundles());\r
+    }\r
+\r
+    private String stateToString(int state) {\r
+        switch (state) {\r
+        case Bundle.ACTIVE:\r
+            return "ACTIVE";\r
+        case Bundle.INSTALLED:\r
+            return "INSTALLED";\r
+        case Bundle.RESOLVED:\r
+            return "RESOLVED";\r
+        case Bundle.UNINSTALLED:\r
+            return "UNINSTALLED";\r
+        default:\r
+            return "Not CONVERTED";\r
+        }\r
+    }\r
+\r
+    @Before\r
+    public void areWeReady() throws InterruptedException {\r
+        assertNotNull(bc);\r
+        boolean debugit = false;\r
+        Bundle b[] = bc.getBundles();\r
+        for (Bundle element : b) {\r
+            int state = element.getState();\r
+            if (state != Bundle.ACTIVE && state != Bundle.RESOLVED) {\r
+                log.info("Bundle:" + element.getSymbolicName() + " state:"\r
+                          + stateToString(state));\r
+                debugit = true;\r
+            }\r
+        }\r
+        if (debugit) {\r
+            log.debug("Do some debugging because some bundle is unresolved");
+        }\r
+\r
+        // Assert if true, if false we are good to go!\r
+        assertFalse(debugit);
+        try {
+            node = getTestConnection();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        this.ovsdbConfigService = (OVSDBConfigService)ServiceHelper.getGlobalInstance(OVSDBConfigService.class, this);\r
+    }\r
+\r
+    @Test\r
+    public void tableTest() throws Exception {
+        assertNotNull("Invalid Node. Check connection params", node);
+        Thread.sleep(3000); // Wait for a few seconds to get the Schema exchange done
+        List<String> tables = ovsdbConfigService.getTables(node);
+        System.out.println("Tables = "+tables);\r
+        assertNotNull(tables);
+    }\r
+}\r
diff --git a/paxexam/plugin.integrationtest/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestBase.java b/paxexam/plugin.integrationtest/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestBase.java
new file mode 100644 (file)
index 0000000..d510a3c
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2014 Red Hat, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Madhu Venugopal
+ */
+package org.opendaylight.ovsdb.plugin;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.opendaylight.controller.sal.connection.ConnectionConstants;
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.utils.ServiceHelper;
+
+public abstract class OvsdbTestBase {
+    private final static String identifier = "TEST";
+
+    public Node getTestConnection() throws IOException {
+        IConnectionServiceInternal connectionService = (IConnectionServiceInternal)ServiceHelper.getGlobalInstance(IConnectionServiceInternal.class,
+                this);
+        Map<ConnectionConstants, String> params = new HashMap<ConnectionConstants, String>();
+        Properties props = System.getProperties();
+        params.put(ConnectionConstants.ADDRESS,
+                props.getProperty("ovsdbserver.ipaddress"));
+        params.put(ConnectionConstants.PORT,
+                props.getProperty("ovsdbserver.port", "6640"));
+
+        Node node = connectionService.connect(identifier, params);
+        if (node == null) {
+            throw new IOException("Failed to connect to the ovsdb server");
+        }
+        return node;
+    }
+}
diff --git a/paxexam/plugin.integrationtest/src/test/resources/logback.xml b/paxexam/plugin.integrationtest/src/test/resources/logback.xml
new file mode 100644 (file)
index 0000000..6d9dfda
--- /dev/null
@@ -0,0 +1,12 @@
+<configuration scan="true">
+  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+    <encoder>
+      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+      </pattern>
+    </encoder>
+  </appender>
+
+  <root level="error">
+    <appender-ref ref="STDOUT" />
+  </root>
+</configuration>
index fdaed3af3624db3ab224bda317ee03028f455678..b9d9c7d8993b08ed26863d35cec39c36d0837ac0 100644 (file)
@@ -32,6 +32,12 @@ import org.opendaylight.controller.sal.utils.StatusCode;
 import org.opendaylight.ovsdb.lib.database.OVSInstance;
 import org.opendaylight.ovsdb.lib.database.OvsdbType;
 import org.opendaylight.ovsdb.lib.message.TransactBuilder;
+import org.opendaylight.ovsdb.lib.operations.DeleteOperation;
+import org.opendaylight.ovsdb.lib.operations.InsertOperation;
+import org.opendaylight.ovsdb.lib.operations.MutateOperation;
+import org.opendaylight.ovsdb.lib.operations.Operation;
+import org.opendaylight.ovsdb.lib.operations.OperationResult;
+import org.opendaylight.ovsdb.lib.operations.UpdateOperation;
 import org.opendaylight.ovsdb.lib.notation.Condition;
 import org.opendaylight.ovsdb.lib.notation.Function;
 import org.opendaylight.ovsdb.lib.notation.Mutation;
@@ -39,14 +45,9 @@ import org.opendaylight.ovsdb.lib.notation.Mutator;
 import org.opendaylight.ovsdb.lib.notation.OvsDBMap;
 import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
 import org.opendaylight.ovsdb.lib.notation.UUID;
-import org.opendaylight.ovsdb.lib.operations.DeleteOperation;
-import org.opendaylight.ovsdb.lib.operations.InsertOperation;
-import org.opendaylight.ovsdb.lib.operations.MutateOperation;
-import org.opendaylight.ovsdb.lib.operations.Operation;
-import org.opendaylight.ovsdb.lib.operations.OperationResult;
-import org.opendaylight.ovsdb.lib.operations.UpdateOperation;
 import org.opendaylight.ovsdb.lib.table.Bridge;
 import org.opendaylight.ovsdb.lib.table.Controller;
+import org.opendaylight.ovsdb.lib.table.IPFIX;
 import org.opendaylight.ovsdb.lib.table.Interface;
 import org.opendaylight.ovsdb.lib.table.Manager;
 import org.opendaylight.ovsdb.lib.table.Mirror;
@@ -266,7 +267,7 @@ public class ConfigurationService implements IPluginInBridgeDomainConfigService,
      * Create a Port Attached to a Bridge
      * Ex. ovs-vsctl add-port br0 vif0
      * @param node Node serving this configuration service
-     * @param bridgeDomainIdentifier String representation of a Bridge Domain
+     * @param bridgeIdentifier String representation of a Bridge Domain
      * @param portIdentifier String representation of a user defined Port Name
      */
     @Override
@@ -390,7 +391,7 @@ public class ConfigurationService implements IPluginInBridgeDomainConfigService,
      * Implements the OVS Connection for Managers
      *
      * @param node Node serving this configuration service
-     * @param managerip with IP and connection types
+     * @param managerip String Representing IP and connection types
      */
     @SuppressWarnings("unchecked")
     public boolean setManager(Node node, String managerip) {
@@ -728,6 +729,9 @@ public class ConfigurationService implements IPluginInBridgeDomainConfigService,
         else if (row.getTableName().getName().equalsIgnoreCase("sFlow")) {
             statusWithUUID = insertSflowRow(node, parent_uuid, (SFlow)row);
         }
+        else if (row.getTableName().getName().equalsIgnoreCase("IPFIX")) {
+            statusWithUUID = insertIpFixRow(node, parent_uuid, (IPFIX) row);
+        }
         else if (row.getTableName().getName().equalsIgnoreCase("SSL")) {
             statusWithUUID = insertSSLRow(node, parent_uuid, (SSL)row);
         }
@@ -831,6 +835,9 @@ public class ConfigurationService implements IPluginInBridgeDomainConfigService,
         else if (tableName.equalsIgnoreCase("sFlow")) {
             return deleteSflowRow(node, uuid);
         }
+        else if (tableName.equalsIgnoreCase("IPFIX")) {
+            return deleteIpFixRow(node, uuid);
+        }
         else if (tableName.equalsIgnoreCase("SSL")) {
             return deleteSSLRow(node, uuid);
         }
@@ -1147,6 +1154,48 @@ public class ConfigurationService implements IPluginInBridgeDomainConfigService,
         return new StatusWithUuid(StatusCode.INTERNALERROR);
     }
 
+        private StatusWithUuid insertIpFixRow(Node node, String parent_uuid, IPFIX row) {
+
+        String insertErrorMsg = "ipfix";
+        String rowName=row.NAME.getName();
+
+        try{
+            Map<String, Table<?>> brTable = inventoryServiceInternal.getTableCache(node, Bridge.NAME.getName());
+            if (brTable == null ||  brTable.get(parent_uuid) == null) {
+                return new StatusWithUuid(StatusCode.NOTFOUND, "Bridge with UUID "+parent_uuid+" Not found");
+            }
+
+            if (parent_uuid == null) {
+                return new StatusWithUuid(StatusCode.BADREQUEST, "Require parent Bridge UUID.");
+            }
+
+            UUID uuid = new UUID(parent_uuid);
+            String newIpFix = "new_ipfix";
+            Operation addBridgeRequest = null;
+            UUID ipfixUuid = new UUID(newIpFix);
+            Mutation ipfixMutation = new Mutation("ipfix", Mutator.INSERT, ipfixUuid);
+            List<Mutation> mutations = new ArrayList<Mutation>();
+            mutations.add(ipfixMutation);
+
+            Condition condition = new Condition("_uuid", Function.EQUALS, uuid);
+            List<Condition> where = new ArrayList<Condition>();
+            where.add(condition);
+            addBridgeRequest = new MutateOperation(Bridge.NAME.getName(), where, mutations);
+            InsertOperation addIpFixRequest = new InsertOperation(IPFIX.NAME.getName(), newIpFix, row);
+
+            TransactBuilder transaction = new TransactBuilder();
+            transaction.addOperations(
+                    new ArrayList<Operation>(Arrays.asList(addIpFixRequest,addBridgeRequest)));
+            int ipfixInsertIndex = transaction.getRequests().indexOf(addIpFixRequest);
+
+            return _insertTableRow(node,transaction,ipfixInsertIndex,insertErrorMsg,rowName);
+
+        } catch (Exception e) {
+            logger.error("Error in insertInterfaceRow(): ",e);
+        }
+        return new StatusWithUuid(StatusCode.INTERNALERROR);
+    }
+
     private StatusWithUuid insertSflowRow(Node node, String parent_uuid, SFlow row) {
 
         String insertErrorMsg = "sFlow";
@@ -1541,6 +1590,15 @@ public class ConfigurationService implements IPluginInBridgeDomainConfigService,
         return _deleteTableRow(node,uuid,parentTableName,childTableName,parentColumn);
     }
 
+    private Status deleteIpFixRow(Node node, String uuid) {
+        // Set up variables for generic _deleteTableRow()
+        String parentTableName=Bridge.NAME.getName();
+        String childTableName=IPFIX.NAME.getName();
+        String parentColumn = "ipfix";
+
+        return _deleteTableRow(node,uuid,parentTableName,childTableName,parentColumn);
+    }
+
     private Status deleteQueueRow(Node node, String uuid) {
         // Set up variables for _deleteRootTableRow()
         // This doesn't do a mutate on parent, but simply deletes row
index a18592a2f48137ed95e03e5ebabcd4935baff279..534a94605cdcb393544991a12c664a83fd019616 100644 (file)
@@ -310,7 +310,7 @@ public class ConnectionService implements IPluginInConnectionService, IConnectio
         inventoryServiceInternal.addNode(connection.getNode(), props);
 
         List<String> dbNames = Arrays.asList(Open_vSwitch.NAME.getName());
-        ListenableFuture<DatabaseSchema> dbSchemaF = null;//todo : fix it up to new structue : connection.getRpc().get_schema(dbNames);
+        ListenableFuture<DatabaseSchema> dbSchemaF = null;//TODO : fix it up to new structue : connection.getRpc().get_schema(dbNames);
         DatabaseSchema databaseSchema = dbSchemaF.get();
         inventoryServiceInternal.updateDatabaseSchema(connection.getNode(), databaseSchema);
 
@@ -323,7 +323,7 @@ public class ConnectionService implements IPluginInConnectionService, IConnectio
             }
         }
 
-        ListenableFuture<TableUpdates> monResponse = null; //ashwin(not sure if we need)connection.getRpc().monitor(monitorReq);
+        ListenableFuture<TableUpdates> monResponse = null; //TODO : ashwin(not sure if we need)connection.getRpc().monitor(monitorReq);
         TableUpdates updates = monResponse.get();
         if (updates.getError() != null) {
             logger.error("Error configuring monitor, error : {}, details : {}",
@@ -541,5 +541,4 @@ public class ConnectionService implements IPluginInConnectionService, IConnectio
     public void stolen(Object context, List<String> ids) {
         // TODO Auto-generated method stub
     }
-
 }
index b987efc111207d818b3245127dab4b680f6cc7c1..28ae17b68b4f4b4c3659f471e1dc45ed3cad5a4a 100644 (file)
@@ -199,7 +199,7 @@ public class InventoryService implements IPluginInInventoryService, InventorySer
                     }
                 } else if (oldRow != null) {
                     if (inventoryListener != null) {
-                        inventoryListener.rowRemoved(n, name.getName(), uuid, oldRow);
+                        inventoryListener.rowRemoved(n, name.getName(), uuid, oldRow, null);
                     }
                     db.removeRow(name.getName(), uuid);
                 }
index 822da35ba606a7519a6891625ce81f6939c50d34..87c6ead0466f236c025ce7dce22511bacd07a9f0 100644 (file)
@@ -17,5 +17,5 @@ public interface OVSDBInventoryListener {
     public void nodeRemoved(Node node);
     public void rowAdded(Node node, String tableName, String uuid, Table<?> row);
     public void rowUpdated(Node node, String tableName, String uuid, Table<?> old, Table<?> row);
-    public void rowRemoved(Node node, String tableName, String uuid, Table<?> row);
+    public void rowRemoved(Node node, String tableName, String uuid, Table<?> row, Object context);
 }
index f58b19b41df6d4c62546f24f29ea0d9441486123..53540804d766a195c82d9f54497b873dd892b984 100644 (file)
@@ -33,7 +33,7 @@ public class OvsdbTestAddBridgeIT extends OvsdbTestBase {
          */\r
         ConfigurationService configurationService = new ConfigurationService();\r
         configurationService.setConnectionServiceInternal(connectionService);\r
-        configurationService.createBridgeDomain(node, "JUNIT_BRIDGE_TEST", null);\r
+        configurationService.createBridgeDomain(node, BRIDGE_NAME, null);\r
     }\r
 \r
 }\r
index adafe4c5c9a452b0449cbc2a675b281aa601550d..c9f089946a63a430337d29633e6a315d93c69315 100644 (file)
@@ -43,6 +43,6 @@ public class OvsdbTestAddPortIT extends OvsdbTestBase {
          */
         ConfigurationService configurationService = new ConfigurationService();
         configurationService.setConnectionServiceInternal(connectionService);
-        configurationService.addPort(node, "JUNIT_BRIDGE_TEST", "Jvif0", null);
+        configurationService.addPort(node, BRIDGE_NAME, PORT_NAME, null);
     }
 }
\ No newline at end of file
index 0c38f31cc5c1d0d09bf59c9f71936afef194be58..32029ba8ad21c4ccd58b7805a4d0ba69a8f5ea4c 100644 (file)
@@ -41,7 +41,7 @@ public class OvsdbTestAddTunnelIT extends OvsdbTestBase {
 
         Encapsulation encap = Encapsulation.VXLAN;
         String tunencap = encap.toString();
-        String tunnelendpoint = "192.168.100.100";
+        String tunnelendpoint = FAKE_IP;
 
         /**
          * Create an Encapsulated Tunnel Interface and destination Tunnel Endpoint
@@ -62,7 +62,7 @@ public class OvsdbTestAddTunnelIT extends OvsdbTestBase {
         configs.put(ConfigConstants.TUNNEL_TYPE, tunencap);
         configs.put(ConfigConstants.DEST_IP, tunnelendpoint);
 
-        configurationService.addPort(node, "JUNIT_BRIDGE_TEST", "Jtunnel0", configs);
+        configurationService.addPort(node, BRIDGE_NAME, TUNNEL_PORT_NAME, configs);
 
     }
 }
\ No newline at end of file
index ee66acde9278b4e47661c51deec83acd7480468f..496a976796eb4aa19bfdf76dbf71feefa3ad8d62 100644 (file)
@@ -44,6 +44,6 @@ public class OvsdbTestAddVlanIT extends OvsdbTestBase {
         Map<ConfigConstants, Object> configs = new HashMap<ConfigConstants, Object>();
         configs.put(ConfigConstants.TYPE, "VLAN");
         configs.put(ConfigConstants.VLAN, vlanid+"");
-        configurationService.addPort(node, "JUNIT_BRIDGE_TEST", "Jtagvif0", configs);
+        configurationService.addPort(node, BRIDGE_NAME, TAGGED_PORT_NAME, configs);
     }
 }
\ No newline at end of file
index 18d929a6ce0941ae28a04fc7191e677e7730b4e8..e9644dbcd81683422c10408f2e1559be3dd31bca 100644 (file)
@@ -22,6 +22,11 @@ import org.opendaylight.controller.sal.core.NodeConnector;
 
 public abstract class OvsdbTestBase {
     private final static String identifier = "TEST";
+    protected final static String BRIDGE_NAME = "JUNIT_TEST_BRIDGE";
+    protected final static String PORT_NAME = "eth0";
+    protected final static String TAGGED_PORT_NAME = "eth1";
+    protected final static String TUNNEL_PORT_NAME = "vxlan0";
+    protected final static String FAKE_IP = "192.168.254.254";
     private final static String SERVER_IPADDRESS = "ovsdbserver.ipaddress";
     private final static String SERVER_PORT = "ovsdbserver.port";
     private final static String DEFAULT_SERVER_PORT = "6640";
@@ -33,10 +38,12 @@ public abstract class OvsdbTestBase {
 
     public class TestObjects {
         public final ConnectionService connectionService;
+        public final InventoryService inventoryService;
         public final Node node;
 
-        public TestObjects(ConnectionService connectionService, Node node) {
+        public TestObjects(ConnectionService connectionService, Node node, InventoryService inventoryService) {
             this.connectionService = connectionService;
+            this.inventoryService = inventoryService;
             this.node = node;
         }
     }
@@ -58,8 +65,9 @@ public abstract class OvsdbTestBase {
 
         ConnectionService connectionService = new ConnectionService();
         connectionService.init();
-
-        connectionService.setInventoryServiceInternal(inventoryService);
+        InventoryService inventory = new InventoryService();
+        inventory.init();
+        connectionService.setInventoryServiceInternal(inventory);
         Map<ConnectionConstants, String> params = new HashMap<ConnectionConstants, String>();
 
         params.put(ConnectionConstants.ADDRESS, address);
@@ -67,9 +75,9 @@ public abstract class OvsdbTestBase {
 
         Node node = connectionService.connect(identifier, params);
         if (node == null) {
-            throw new IOException("Failed to connecto to ovsdb server");
+            throw new IOException("Failed to connect to the ovsdb server");
         }
-        return new TestObjects(connectionService, node);
+        return new TestObjects(connectionService, node, inventory);
     }
 
 }
index bc0eb13603871d7bbb81de9f1eac673608393a1d..d8891f91e65307ff7b0354b2e68cc36f957bfbe1 100644 (file)
@@ -31,13 +31,13 @@ public class OvsdbTestBridgeConfigIT extends OvsdbTestBase {
         Map<ConfigConstants, Object> configs = new HashMap<ConfigConstants, Object>();
 
         Map<String, String> exterIDPairs = new HashMap<String, String>();
-        exterIDPairs.put("bridge-foo", "bri-bar");
+        exterIDPairs.put("br-foo", "br-bar");
         //Will accept multiple array pairs. Pairs must be arrays not maps.
         configs.put(ConfigConstants.CUSTOM, exterIDPairs);
 
         ConfigurationService configurationService = new ConfigurationService();
         configurationService.setConnectionServiceInternal(connectionService);
-        configurationService.addBridgeDomainConfig(node, "br0", configs);
+        configurationService.addBridgeDomainConfig(node, BRIDGE_NAME, configs);
     }
 
 }
\ No newline at end of file
index d83432b6fa254a8004faad2fc00c464af6ad9285..3fd246d3134e535f4a05d10d2c868499163ee569 100644 (file)
@@ -33,6 +33,6 @@ public class OvsdbTestDeletePortIT extends OvsdbTestBase {
          */
         ConfigurationService configurationService = new ConfigurationService();
         configurationService.setConnectionServiceInternal(connectionService);
-        configurationService.deletePort(node, "ovsbr0", "tap2");
+        configurationService.deletePort(node, BRIDGE_NAME, PORT_NAME);
     }
 }
index de1e370ff198d5ec25fd960f680fdf789ba62c5c..0d78f847bf88359877210d553a18184b9234a7d0 100644 (file)
@@ -9,8 +9,11 @@
  */
 package org.opendaylight.ovsdb.plugin;
 
+import java.io.IOException;
 import java.util.List;
+import java.util.Properties;
 
+import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.controller.sal.core.Node;
 import org.slf4j.Logger;
@@ -20,11 +23,19 @@ public class OvsdbTestGetBridgeDomainsIT extends OvsdbTestBase {
     private static final Logger logger = LoggerFactory
             .getLogger(OvsdbTestGetBridgeDomainsIT.class);
 
+    private Properties props;
+
+    @Before
+    public void loadProps() throws IOException {
+        props = loadProperties();
+    }
+
     @Test
     public void getBridgeDomains() throws Throwable{
 
         TestObjects testObjects = getTestConnection();
         ConnectionService connectionService = testObjects.connectionService;
+        InventoryService inventoryService = testObjects.inventoryService;
         Node node = testObjects.node;
 
         /**
@@ -35,7 +46,7 @@ public class OvsdbTestGetBridgeDomainsIT extends OvsdbTestBase {
          */
         ConfigurationService configurationService = new ConfigurationService();
         configurationService.setConnectionServiceInternal(connectionService);
+        configurationService.setInventoryServiceInternal(inventoryService);
         List<String> ls = configurationService.getBridgeDomains(node);
-        System.out.println(ls);
     }
 }
index cdff94ef81daeb41d253e0c85048b6197fb4fedd..4dba778569926ce76bb022db9e2584ceafc56765 100644 (file)
@@ -24,6 +24,13 @@ public class OvsdbTestSetManagerIT extends OvsdbTestBase {
         ConnectionService connectionService = testObjects.connectionService;\r
         Node node = testObjects.node;\r
 \r
+\r
+        String port = "6634";\r
+        String host = FAKE_IP;\r
+        String connectionType = "ptcp";\r
+\r
+        String manager = connectionType + ":" + host + ":" + port;\r
+\r
         /**\r
          * Implements the OVS Connection for Managers\r
          *\r
@@ -33,7 +40,7 @@ public class OvsdbTestSetManagerIT extends OvsdbTestBase {
          */\r
         ConfigurationService configurationService = new ConfigurationService();\r
         configurationService.setConnectionServiceInternal(connectionService);\r
-        configurationService.setManager(node, "ptcp:6634:172.16.58.128");\r
+        configurationService.setManager(node, manager);\r
     }\r
 \r
 }\r
index 763414d53c5a6683cb81a50f46a45d66c6c160bb..e7d9737cd8882637790091d2ea806e7c2362ba6c 100644 (file)
@@ -33,7 +33,7 @@ public class OvsdbTestSetOFControllerIT extends OvsdbTestBase {
         configs.put(ConfigConstants.CUSTOM, "6633");
         ConfigurationService configurationService = new ConfigurationService();
         configurationService.setConnectionServiceInternal(connectionService);
-        configurationService.setBridgeOFController(node, "br0");
+        configurationService.setBridgeOFController(node, BRIDGE_NAME);
 
     }
 }
diff --git a/resources/bin/README b/resources/bin/README
new file mode 100644 (file)
index 0000000..0ae8b61
--- /dev/null
@@ -0,0 +1,49 @@
+# README
+#
+# ovsdb-build
+# Author: Dave Tucker <dave.j.tucker@hp.com>
+#
+#
+
+The script in this commit simplifies the build process of the OVSDB
+project.
+usage: ovsdb-build [-h] [-r] [-b] [-of13] [-v] [-g CHANGE_ID] [-start]
+[-stop]
+                   [-d DIRECTORY] [-t]
+optional arguments:
+  -h, --help            show this help message and exit
+  -r, --reclone         Reclone the Controller/OVSDB repos
+  -b, --rebuild         Build the Controller Project
+  -of13, --openflow13   Enable OpenFlow 1.3 Support
+  -v, --verbose         Verbose output
+  -g CHANGE_ID, --gerrit CHANGE_ID
+                        Gerrit Change ID
+  -start, --start       Start the controller
+  -stop, --stop         Stop the controller
+  -d DIRECTORY, --directory DIRECTORY
+                        directory
+  -t, --tmux            Create tmux session
+
+On first run it is recommended to run the following:
+
+./ovsdb-build -r -b -start
+
+You can add the `-d` option to specify the directory you want to build
+in:
+
+./ovsdb-build -r -b -d /home/dave/dev/opendaylight -start
+
+This will clone the controller and ovsdb projects, build them, move the
+ovsdb artifacts in to the controller directory and start the controller.
+
+Gerrit Changes can be built and loaded to the controller with a single
+command:
+
+./ovsbd-build -g 5716 -start
+
+The controller is started in the background. To access the OSGi ole
+you can manually `telnet 127.0.0.1 2400` or you can add `-t` to let
+the build script create a tmux session for you.
+
+
+
diff --git a/resources/bin/ovsdb-build b/resources/bin/ovsdb-build
new file mode 100644 (file)
index 0000000..31620c6
--- /dev/null
@@ -0,0 +1,162 @@
+#!/usr/bin/env python
+# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Author: Dave Tucker
+
+import argparse
+import os
+from subprocess import call
+from sys import exit
+
+CTRL_GIT = "https://git.opendaylight.org/gerrit/p/controller.git"
+OVSDB_GIT = "https://git.opendaylight.org/gerrit/p/ovsdb.git"
+
+
+def main():
+    parser = argparse.ArgumentParser()
+    parser.add_argument('-r', '--reclone',
+                        help='Reclone the Controller/OVSDB repos',
+                        action='store_true')
+    parser.add_argument('-b', '--rebuild',
+                        help='Build the Controller Project',
+                        action='store_true')
+    parser.add_argument('-of13', '--openflow13',
+                        help='Enable OpenFlow 1.3 Support',
+                        action='store_true')
+    parser.add_argument('-v', '--verbose',
+                        help='Verbose output',
+                        action='store_true')
+    parser.add_argument('-g', '--gerrit',
+                        metavar='CHANGE_ID',
+                        help='Gerrit Change ID',
+                        type=int)
+    parser.add_argument('-start', '--start',
+                        help='Start the controller',
+                        default=True,
+                        action='store_true')
+    parser.add_argument('-stop', '--stop',
+                        help='Stop the controller',
+                        action='store_true')
+    parser.add_argument('-d', '--directory',
+                        help='directory',
+                        type=str)
+    parser.add_argument('-t', '--tmux',
+                        help='Create tmux session',
+                        action='store_true')
+    args = parser.parse_args()
+
+    builder = OvsdbBuilder(args.verbose, args.openflow13,
+                           args.directory)
+
+    if args.stop:
+        builder.stop_controller()
+        exit(0)
+
+    if args.reclone:
+        print("---> Recloning Controller")
+        builder.reclone(builder.ctrl_root, CTRL_GIT)
+        print("---> Recloning OVSDB")
+        builder.reclone(builder.ovsdb_root, OVSDB_GIT)
+
+    if args.rebuild:
+        print("---> Building Controller")
+        builder.build(builder.ctrl_build)
+
+    if args.gerrit:
+        print("---> Checking out patch from Gerrit")
+        builder.gerrit(args.gerrit)
+
+    print("---> Building OVSDB")
+    builder.build(builder.ovsdb_root, args.verbose)
+    print("---> Copying OVSDB JARs")
+    builder.copy_jars()
+
+    if args.start:
+        print("---> Running Controller")
+        builder.run_controller()
+
+    if args.tmux:
+        builder.tmux()
+        print("To attach to the session please run: \n\n"
+              "    tmux -2 attach-session -t odl\n\n")
+
+
+class OvsdbBuilder(object):
+
+    def __init__(self,
+                 verbose=False,
+                 of13=False,
+                 directory=os.path.expanduser('~')):
+        self.root_dir = directory
+        self.ctrl_root = self.root_dir + "/controller"
+        self.ctrl_build = (self.root_dir +
+                           "/opendaylight/distribution/opendaylight")
+        self.ctrl_exec = (self.ctrl_build +
+                          "/target/distribution.opendaylight-osgipackage" +
+                          "/opendaylight")
+        self.ctrl_plugin = self.ctrl_build + "/plugin"
+        self.ovsdb_root = self.root_dir + "/ovsdb"
+        self.verbose = verbose
+
+    def reclone(self, location, repo):
+        try:
+            os.chdir(location)
+            command = "git checkout master"
+            command = "git pull"
+            if not self.verbose:
+                command += " > /dev/null"
+            call(command, shell=True)
+        except OSError:
+            command = "git clone %s" % repo
+            if not self.verbose:
+                command += " > /dev/null"
+            call(command, shell=True)
+
+    def gerrit(self, patch):
+        os.chdir(self.ovsdb_root)
+        command = "git review -d %i" % patch
+        call(command, shell=True)
+
+    def build(self, location, verbose):
+        os.chdir(location)
+        command = "mvn clean install"
+        if not verbose:
+            command += " > /dev/null"
+        call(command, shell=True)
+
+    def copy_jars(self):
+        os.chdir(self.ovsdb_root)
+        command = ("find . -name ovsdb*.jar -exec cp {} %s \;"
+                   % self.ctrl_plugin)
+        call(command, shell=True)
+
+    def stop_controller(self):
+        os.chdir(self.root_dir)
+        command = "sh " + self.ctrl_exec + "/run.sh -stop"
+        call(command, shell=True)
+
+    def run_controller(self):
+        os.chdir(self.root_dir)
+        command = "sh " + self.ctrl_exec + "/run.sh -start -debug"
+        if (self.of13):
+            command += " -of13"
+        call(command, shell=True)
+
+    def tmux(self):
+        tmux = ["tmux new-session -d -s odl",
+                "tmux new-window -t odl:1 -n 'OSGi' 'telnet 127.0.0.1 2400'",
+                "tmux new-window -t odl:2 -n 'OVSDB Source' 'cd %s'"
+                % self.ovsdb_root,
+                "tmux new-window -t odl:3 -n 'Ctrl Source' 'cd %s'"
+                % self.ctrl_root,
+                "tmux select-window -t odl:1",
+                ]
+        call(" ; ".join(tmux), shell=True)
+
+if __name__ == "__main__":
+    main()
+
index d8de5e46d12245705caea220273d095aa8657802..8067a1544374d2b7d3f8ad8f303b2532b5e4d188 100644 (file)
@@ -1 +1 @@
-{"id":"434c1a79-a99d-2159-7559-95cb9dce794e","name":"Mininet Demo : OVSDB + OF","description":"This POSTMAN script was used for the Mininet demonstration : http://www.youtube.com/watch?v=8iWhMVlflwE","order":["60dc9930-7948-b34e-ecfe-7ab7130f6037","da8d3367-47f7-8217-57cf-bc921ebda497","9143419b-af64-4647-905c-831461ead25d","ed66771a-dc23-a958-440f-0bc3792ecf1c","462c7d0a-e885-8a21-7a0e-ea4f6086d621","f1f89972-61f9-e39c-f572-d6470d201b0e","61ae4830-c124-84f0-92f2-05b46809cfb1","bb05ca74-5c47-ca39-e058-9a5b900db749","3c4fd25b-6c2c-0dcf-695f-c27a0d78632b","6dec1ff1-4bae-0566-70ec-ed17ae3905f3","360de20d-5b76-2b34-e436-4199ccb3b0fb","e84507bc-e7f0-efce-02d1-74ea28fb32de","54ccad58-669b-9889-c6ed-af328c59c947","4a332eca-b7b7-6d7a-8029-33d7da714698"],"folders":[],"timestamp":1383819127794,"synced":false,"requests":[{"collectionId":"434c1a79-a99d-2159-7559-95cb9dce794e","id":"360de20d-5b76-2b34-e436-4199ccb3b0fb","name":"Delete s1-eth2","description":"","url":"http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/port/OVS/HOST1/s1/s1-eth2","method":"DELETE","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","data":"","dataMode":"raw","timestamp":0,"responses":[],"version":2,"synced":false},{"collectionId":"434c1a79-a99d-2159-7559-95cb9dce794e","id":"3c4fd25b-6c2c-0dcf-695f-c27a0d78632b","name":"Add a port - br2-veth1 (with patch to br1-veth1) to br2","description":"","url":"http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/port/OVS/HOST1/br2/br2-veth1","method":"POST","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","data":"{\"type\":\"patch\", \"CUSTOM\":{\"peer\":\"br1-veth1\"}}","dataMode":"raw","timestamp":0,"responses":[],"version":2,"synced":false},{"collectionId":"434c1a79-a99d-2159-7559-95cb9dce794e","id":"462c7d0a-e885-8a21-7a0e-ea4f6086d621","name":"Create a Bridge : br1","description":"","url":"http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/bridge/OVS/HOST1/br1","method":"POST","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","data":"{}","dataMode":"raw","timestamp":0,"responses":[],"version":2,"synced":false},{"collectionId":"434c1a79-a99d-2159-7559-95cb9dce794e","id":"4a332eca-b7b7-6d7a-8029-33d7da714698","name":"s2-eth3 -> br2-eth3","description":"","url":"http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/port/OVS/HOST1/s2/s2-veth3","method":"POST","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","data":"{\"type\":\"patch\", \"CUSTOM\":{\"peer\":\"br2-veth3\"}}","dataMode":"raw","timestamp":0,"responses":[],"version":2,"synced":false},{"collectionId":"434c1a79-a99d-2159-7559-95cb9dce794e","id":"54ccad58-669b-9889-c6ed-af328c59c947","name":"Delete s2-eth2","description":"","url":"http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/port/OVS/HOST1/s2/s2-eth2","method":"DELETE","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","data":"","dataMode":"raw","timestamp":0,"responses":[],"version":2,"synced":false},{"collectionId":"434c1a79-a99d-2159-7559-95cb9dce794e","id":"60dc9930-7948-b34e-ecfe-7ab7130f6037","name":"Delete Bridge br1","description":"Delete Bridge br1","url":"http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/bridge/OVS/HOST1/br1","method":"DELETE","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","data":"{}","dataMode":"raw","timestamp":0,"responses":[],"version":2,"synced":false},{"collectionId":"434c1a79-a99d-2159-7559-95cb9dce794e","id":"61ae4830-c124-84f0-92f2-05b46809cfb1","name":"Add a port - br1-veth1 (with patch to br2-veth1) to br1","description":"","url":"http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/port/OVS/HOST1/br1/br1-veth1","method":"POST","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","data":"{\"type\":\"patch\", \"CUSTOM\":{\"peer\":\"br2-veth1\"}}","dataMode":"raw","timestamp":0,"responses":[],"version":2,"synced":false},{"collectionId":"434c1a79-a99d-2159-7559-95cb9dce794e","id":"6dec1ff1-4bae-0566-70ec-ed17ae3905f3","name":"br2-eth3 -> s2-eth3","description":"","url":"http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/port/OVS/HOST1/br2/br2-veth3","method":"POST","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","data":"{\"type\":\"patch\", \"CUSTOM\":{\"peer\":\"s2-veth3\"}}","dataMode":"raw","timestamp":0,"responses":[],"version":2,"synced":false},{"collectionId":"434c1a79-a99d-2159-7559-95cb9dce794e","id":"9143419b-af64-4647-905c-831461ead25d","name":"Connect to the OVSDB-SERVER","description":"Connect to the OVSDB-SERVER","url":"http://localhost:8080/controller/nb/v2/connectionmanager/node/HOST1/address/192.168.56.101/port/6640/","method":"PUT","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\n","data":[],"dataMode":"params","timestamp":0,"responses":[],"version":2,"synced":false},{"collectionId":"434c1a79-a99d-2159-7559-95cb9dce794e","id":"bb05ca74-5c47-ca39-e058-9a5b900db749","name":"br1-eth3 -> s1-eth3","description":"","url":"http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/port/OVS/HOST1/br1/br1-veth3","method":"POST","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","data":"{\"type\":\"patch\", \"CUSTOM\":{\"peer\":\"s1-veth3\"}}","dataMode":"raw","timestamp":0,"responses":[],"version":2,"synced":false},{"collectionId":"434c1a79-a99d-2159-7559-95cb9dce794e","id":"da8d3367-47f7-8217-57cf-bc921ebda497","name":"Delete Bridge br2","description":"Delete Bridge br2","url":"http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/bridge/OVS/HOST1/br2","method":"DELETE","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","data":"{}","dataMode":"raw","timestamp":0,"responses":[],"version":2,"synced":false},{"collectionId":"434c1a79-a99d-2159-7559-95cb9dce794e","id":"e84507bc-e7f0-efce-02d1-74ea28fb32de","name":"s1-eth3 -> br1-eth3","description":"","url":"http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/port/OVS/HOST1/s1/s1-veth3","method":"POST","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","data":"{\"type\":\"patch\", \"CUSTOM\":{\"peer\":\"br1-veth3\"}}","dataMode":"raw","timestamp":0,"responses":[],"version":2,"synced":false},{"collectionId":"434c1a79-a99d-2159-7559-95cb9dce794e","id":"ed66771a-dc23-a958-440f-0bc3792ecf1c","name":"Get all existing connections","description":"","url":"http://localhost:8080/controller/nb/v2/connectionmanager/nodes","method":"GET","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","data":"{\"type\":\"patch\", \"CUSTOM\":{\"peer\":\"br1-veth1\"}}","dataMode":"raw","timestamp":0,"responses":[],"version":2,"synced":false},{"collectionId":"434c1a79-a99d-2159-7559-95cb9dce794e","id":"f1f89972-61f9-e39c-f572-d6470d201b0e","name":"Create another bridge : br2","description":"","url":"http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/bridge/OVS/HOST1/br2","method":"POST","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","data":"{}","dataMode":"raw","timestamp":0,"responses":[],"version":2,"synced":false}]}
\ No newline at end of file
+{"id":"434c1a79-a99d-2159-7559-95cb9dce794e","name":"Mininet Demo : OVSDB + OF","description":"This POSTMAN script was used for the Mininet demonstration : http://www.youtube.com/watch?v=8iWhMVlflwE","order":["60dc9930-7948-b34e-ecfe-7ab7130f6037","da8d3367-47f7-8217-57cf-bc921ebda497","9143419b-af64-4647-905c-831461ead25d","ed66771a-dc23-a958-440f-0bc3792ecf1c","462c7d0a-e885-8a21-7a0e-ea4f6086d621","f1f89972-61f9-e39c-f572-d6470d201b0e","61ae4830-c124-84f0-92f2-05b46809cfb1","bb05ca74-5c47-ca39-e058-9a5b900db749","3c4fd25b-6c2c-0dcf-695f-c27a0d78632b","6dec1ff1-4bae-0566-70ec-ed17ae3905f3","360de20d-5b76-2b34-e436-4199ccb3b0fb","e84507bc-e7f0-efce-02d1-74ea28fb32de","54ccad58-669b-9889-c6ed-af328c59c947","4a332eca-b7b7-6d7a-8029-33d7da714698"],"folders":[],"timestamp":1383819127794,"synced":false,"requests":[{"collectionId":"434c1a79-a99d-2159-7559-95cb9dce794e","id":"360de20d-5b76-2b34-e436-4199ccb3b0fb","name":"Delete s1-eth2","description":"","url":"http://{{controllerHost}}:{{controllerPort}}/controller/nb/v2/networkconfig/bridgedomain/port/OVS/HOST1/s1/s1-eth2","method":"DELETE","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","data":"","dataMode":"raw","timestamp":0,"responses":[],"version":2,"synced":false},{"collectionId":"434c1a79-a99d-2159-7559-95cb9dce794e","id":"3c4fd25b-6c2c-0dcf-695f-c27a0d78632b","name":"Add a port - br2-veth1 (with patch to br1-veth1) to br2","description":"","url":"http://{{controllerHost}}:{{controllerPort}}/controller/nb/v2/networkconfig/bridgedomain/port/OVS/HOST1/br2/br2-veth1","method":"POST","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","data":"{\"type\":\"patch\", \"CUSTOM\":{\"peer\":\"br1-veth1\"}}","dataMode":"raw","timestamp":0,"responses":[],"version":2,"synced":false},{"collectionId":"434c1a79-a99d-2159-7559-95cb9dce794e","id":"462c7d0a-e885-8a21-7a0e-ea4f6086d621","name":"Create a Bridge : br1","description":"","url":"http://{{controllerHost}}:{{controllerPort}}/controller/nb/v2/networkconfig/bridgedomain/bridge/OVS/HOST1/br1","method":"POST","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","data":"{}","dataMode":"raw","timestamp":0,"responses":[],"version":2,"synced":false},{"collectionId":"434c1a79-a99d-2159-7559-95cb9dce794e","id":"4a332eca-b7b7-6d7a-8029-33d7da714698","name":"s2-eth3 -> br2-eth3","description":"","url":"http://{{controllerHost}}:{{controllerPort}}/controller/nb/v2/networkconfig/bridgedomain/port/OVS/HOST1/s2/s2-veth3","method":"POST","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","data":"{\"type\":\"patch\", \"CUSTOM\":{\"peer\":\"br2-veth3\"}}","dataMode":"raw","timestamp":0,"responses":[],"version":2,"synced":false},{"collectionId":"434c1a79-a99d-2159-7559-95cb9dce794e","id":"54ccad58-669b-9889-c6ed-af328c59c947","name":"Delete s2-eth2","description":"","url":"http://{{controllerHost}}:{{controllerPort}}/controller/nb/v2/networkconfig/bridgedomain/port/OVS/HOST1/s2/s2-eth2","method":"DELETE","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","data":"","dataMode":"raw","timestamp":0,"responses":[],"version":2,"synced":false},{"collectionId":"434c1a79-a99d-2159-7559-95cb9dce794e","id":"60dc9930-7948-b34e-ecfe-7ab7130f6037","name":"Delete Bridge br1","description":"Delete Bridge br1","url":"http://{{controllerHost}}:{{controllerPort}}/controller/nb/v2/networkconfig/bridgedomain/bridge/OVS/HOST1/br1","method":"DELETE","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","data":"{}","dataMode":"raw","timestamp":0,"responses":[],"version":2,"synced":false},{"collectionId":"434c1a79-a99d-2159-7559-95cb9dce794e","id":"61ae4830-c124-84f0-92f2-05b46809cfb1","name":"Add a port - br1-veth1 (with patch to br2-veth1) to br1","description":"","url":"http://{{controllerHost}}:{{controllerPort}}/controller/nb/v2/networkconfig/bridgedomain/port/OVS/HOST1/br1/br1-veth1","method":"POST","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","data":"{\"type\":\"patch\", \"CUSTOM\":{\"peer\":\"br2-veth1\"}}","dataMode":"raw","timestamp":0,"responses":[],"version":2,"synced":false},{"collectionId":"434c1a79-a99d-2159-7559-95cb9dce794e","id":"6dec1ff1-4bae-0566-70ec-ed17ae3905f3","name":"br2-eth3 -> s2-eth3","description":"","url":"http://{{controllerHost}}:{{controllerPort}}/controller/nb/v2/networkconfig/bridgedomain/port/OVS/HOST1/br2/br2-veth3","method":"POST","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","data":"{\"type\":\"patch\", \"CUSTOM\":{\"peer\":\"s2-veth3\"}}","dataMode":"raw","timestamp":0,"responses":[],"version":2,"synced":false},{"collectionId":"434c1a79-a99d-2159-7559-95cb9dce794e","id":"9143419b-af64-4647-905c-831461ead25d","name":"Connect to the OVSDB-SERVER","description":"Connect to the OVSDB-SERVER","url":"http://{{controllerHost}}:{{controllerPort}}/controller/nb/v2/connectionmanager/node/HOST1/address/192.168.56.101/port/6640/","method":"PUT","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\n","data":[],"dataMode":"params","timestamp":0,"responses":[],"version":2,"synced":false},{"collectionId":"434c1a79-a99d-2159-7559-95cb9dce794e","id":"bb05ca74-5c47-ca39-e058-9a5b900db749","name":"br1-eth3 -> s1-eth3","description":"","url":"http://{{controllerHost}}:{{controllerPort}}/controller/nb/v2/networkconfig/bridgedomain/port/OVS/HOST1/br1/br1-veth3","method":"POST","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","data":"{\"type\":\"patch\", \"CUSTOM\":{\"peer\":\"s1-veth3\"}}","dataMode":"raw","timestamp":0,"responses":[],"version":2,"synced":false},{"collectionId":"434c1a79-a99d-2159-7559-95cb9dce794e","id":"da8d3367-47f7-8217-57cf-bc921ebda497","name":"Delete Bridge br2","description":"Delete Bridge br2","url":"http://{{controllerHost}}:{{controllerPort}}/controller/nb/v2/networkconfig/bridgedomain/bridge/OVS/HOST1/br2","method":"DELETE","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","data":"{}","dataMode":"raw","timestamp":0,"responses":[],"version":2,"synced":false},{"collectionId":"434c1a79-a99d-2159-7559-95cb9dce794e","id":"e84507bc-e7f0-efce-02d1-74ea28fb32de","name":"s1-eth3 -> br1-eth3","description":"","url":"http://{{controllerHost}}:{{controllerPort}}/controller/nb/v2/networkconfig/bridgedomain/port/OVS/HOST1/s1/s1-veth3","method":"POST","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","data":"{\"type\":\"patch\", \"CUSTOM\":{\"peer\":\"br1-veth3\"}}","dataMode":"raw","timestamp":0,"responses":[],"version":2,"synced":false},{"collectionId":"434c1a79-a99d-2159-7559-95cb9dce794e","id":"ed66771a-dc23-a958-440f-0bc3792ecf1c","name":"Get all existing connections","description":"","url":"http://{{controllerHost}}:{{controllerPort}}/controller/nb/v2/connectionmanager/nodes","method":"GET","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","data":"{\"type\":\"patch\", \"CUSTOM\":{\"peer\":\"br1-veth1\"}}","dataMode":"raw","timestamp":0,"responses":[],"version":2,"synced":false},{"collectionId":"434c1a79-a99d-2159-7559-95cb9dce794e","id":"f1f89972-61f9-e39c-f572-d6470d201b0e","name":"Create another bridge : br2","description":"","url":"http://{{controllerHost}}:{{controllerPort}}/controller/nb/v2/networkconfig/bridgedomain/bridge/OVS/HOST1/br2","method":"POST","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","data":"{}","dataMode":"raw","timestamp":0,"responses":[],"version":2,"synced":false}]}
\ No newline at end of file
index 99e48b511f34077eda7e6a85bda482200cfe7283..97a09e4390ce468e3a27eae46873e125a1d2cf16 100644 (file)
@@ -1 +1,792 @@
-{"id":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","name":"OVSDB Northbound APIs","description":"Northbound APIs exposed by ovsdb.northbound bundle","order":["98fc409e-3eb4-3178-53ab-2a4cb5370b92","4c50625e-689d-1016-3daa-f927b3d5b4cc","b8d189c1-ddea-6841-af5f-c879d83d582e"],"folders":[{"id":"dc6a7dfc-a41d-a794-1526-74bed794f7f2","name":"01 BRIDGE","description":"","order":["faeecd3b-d030-0acf-506b-6ba72d6906bc","03067c98-3677-dedb-a707-b16aad2483d2","3745c365-bb16-cbd6-9f31-83e2412e94ec","84761df7-188e-ac7f-57ab-a6bc90759673","ab3c818e-526c-1938-e5d4-64136c00aa64"],"collection_name":"OVSDB Northbound APIs","collection_id":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770"},{"id":"ec3305c5-9797-d2d4-89d8-2b2d0f561507","name":"02 PORT","description":"","order":["d1013fcb-7da8-0673-eadd-c63e9b71acba","2c4cebfe-4d47-d705-b489-706bbafae618","94173b9e-1541-3d46-4e3c-31d6400dadd3","bea94160-60b8-a9d1-25de-af6502d5c7dd"],"collection_name":"OVSDB Northbound APIs","collection_id":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770"},{"id":"93b55739-6b91-0cfa-ac46-daed36dd461d","name":"03 INTERFACE","description":"","order":["b8e56ff8-04d7-bf8f-fb3d-5cfe13b3834e","c3c36bc0-e6a5-5007-2049-854e89e0093a","ee02ff5b-f217-024f-e8bf-347b0af9b73c"],"collection_name":"OVSDB Northbound APIs","collection_id":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770"},{"id":"dc870c55-7106-40b7-9719-8bfd2d8df5b4","name":"04 CONTROLLER","description":"","order":["01b5cdf4-e418-a68c-b4d2-f317dd4965e8","8ba0d3a3-1a3f-1722-513b-02d4546011c9","ac6e529f-6f5a-39d9-ce35-849fe361500d"],"collection_name":"OVSDB Northbound APIs","collection_id":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770"},{"id":"e6d7ea89-519b-5b5e-2e25-d87f587576c9","name":"05 SSL","description":"","order":["f745d42a-715a-fc49-3c72-e391c7faa15b","d637a11a-f0e8-c571-864f-7853abc1605e","4ad4a7d7-3f94-8d95-7857-483891406392"],"collection_name":"OVSDB Northbound APIs","collection_id":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770"},{"id":"527586cb-fd16-c451-e358-bbb77161d743","name":"06 sFlow","description":"","order":["40bd9df2-6510-0680-dd27-2c26cf9d4c46","53f1924f-8547-391b-39bb-e4cc3c2e9fde","1dfe0e27-009b-0624-61aa-24d934c75e5e"],"collection_name":"OVSDB Northbound APIs","collection_id":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770"},{"id":"8502a41e-5050-6864-4a26-49f87ff6ea3f","name":"07 Qos","description":"","order":["e54bf72a-61c9-c569-b84c-db8b300fe976","f2312567-3c45-74d0-c39f-0a10f9b3f5e1","d1cf2cea-4f08-9d55-6d07-5662a3d93bb6","64ac8934-f2ee-2d11-145a-83216e08094f"],"collection_name":"OVSDB Northbound APIs","collection_id":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770"},{"id":"8108a7d0-5b0a-8124-ade2-467eb03f9efd","name":"08 Queue","description":"","order":["bc7a068f-dcd2-198d-f526-d836472399e3","3ec045e4-7d39-50c9-61c6-e4912d344f86","6e39c0b9-1339-4d56-93ba-cbd353024824","606993e2-7b60-1313-4861-d1b4df4154ce"],"collection_name":"OVSDB Northbound APIs","collection_id":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770"},{"id":"f653f0a6-0b23-6c12-6c8d-8bce3c6bbeb2","name":"09 NetFlow","description":"","order":["404038b8-f70a-da77-0599-e2ea6fc61f99","38d6c950-a37b-ccec-7b55-ee21ca12709e","f3421bad-6229-a5d1-6cbe-ec41de4900b5"],"collection_name":"OVSDB Northbound APIs","collection_id":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770"},{"id":"304dbfd5-2c7d-096a-2d6f-bb4ddfdbe5b3","name":"10 Manager","description":"","order":["38a839b9-af22-59fd-1730-7fd4eff25a7f","98fc409e-3eb4-3178-53ab-2a4cb5370b92","6d173b2a-5933-44e8-173f-f00742278b7a"],"collection_name":"OVSDB Northbound APIs","collection_id":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770"}],"timestamp":1384305639019,"synced":false,"requests":[{"id":"01b5cdf4-e418-a68c-b4d2-f317dd4965e8","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/controller/rows","data":[],"headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","dataMode":"params","method":"GET","version":2,"time":1384898533812,"name":"GET all controller rows","description":"","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","id":"03067c98-3677-dedb-a707-b16aad2483d2","name":"GET a bridge row given a UUID","description":"Please note that the UUID used here must be one of the existing UUID of a Row in Bridge Table","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/bridge/rows/45677cc9-bed2-4def-9986-b05a9b59f1f4","method":"GET","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","data":"","dataMode":"raw","timestamp":0,"version":2,"time":1384465185771,"synced":false},{"id":"1dfe0e27-009b-0624-61aa-24d934c75e5e","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/sflow/rows/","pathVariables":{},"method":"DELETE","data":"","dataMode":"raw","version":2,"time":1385832734561,"name":"DELETE an sFlow row given a UUID","description":"","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"id":"2c4cebfe-4d47-d705-b489-706bbafae618","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/port/rows","pathVariables":{},"method":"POST","data":"{\n  \"parent_uuid\":\"6b3072ba-a120-4db9-82f8-a8ce4eae6942\",\n    \"row\":{\n      \"Port\":{\n        \"name\":\"krb1\",\n        \"mac\":[\"00:00:00:00:00:01\"],\n        \"tag\":[200]\n      }\n    }\n}","dataMode":"raw","version":2,"time":1386198885371,"name":"Create a Port and add it to a Bridge","description":"Please note that the parent_uuid of this HTTP Data is the UUID of the Bridge that was created in the previous step.\n\nWatch out for the return value which is the UUID of the port that was just created. This UUID must be used as the parent_uuid for the interface addition. Also look out for the HTTP headers that is returned and it has a location field that can be used for both DELETE and UPDATE operations later.\n","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"id":"3745c365-bb16-cbd6-9f31-83e2412e94ec","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/bridge/rows","data":"{\n    \"row\":{\n      \"Bridge\":{\n        \"name\":\"br26-2\",\n        \"datapath_type\":\"OPENFLOW\"\n      }\n    }\n}","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","dataMode":"raw","method":"POST","version":2,"time":1385493765905,"name":"Create a Bridge","description":"Watch out for the return value which is the UUID of the bridge that was just created.\nThis UUID must be used as the parent_uuid for the port addition.\n\nAlso look out for the HTTP headers that is returned and it has a location field that can be used for both DELETE and UPDATE operations later.","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"id":"38a839b9-af22-59fd-1730-7fd4eff25a7f","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/manager/rows","data":[],"headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","dataMode":"params","method":"GET","version":2,"time":1384920805653,"name":"GET all manager rows","description":"","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"id":"38d6c950-a37b-ccec-7b55-ee21ca12709e","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/netflow/rows","pathVariables":{},"method":"POST","data":"{\n  \"parent_uuid\":\"6b3072ba-a120-4db9-82f8-a8ce4eae6942\",\n  \"row\" : {\n  \t\"NetFlow\":{\n      \"targets\" : [\"192.168.1.102:9998\"],\n      \"active_timeout\" : \"0\"\n    \t}\n\t}\t\n}","dataMode":"raw","version":2,"time":1386202743214,"name":"INSERT a NetFlow row","description":"","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"id":"3ec045e4-7d39-50c9-61c6-e4912d344f86","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/queue/rows","pathVariables":{},"method":"POST","data":"{\n  \"parent_uuid\" : \"ab2b6f2d-5cb4-4dcf-ac1b-c989ae3d76ce\",\n  \"row\" : { \"Queue\": { \"dscp\" : [\"25\"]     }}\n}\n","dataMode":"raw","version":2,"time":1386290517370,"name":"INSERT a Queue row","description":"","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"id":"404038b8-f70a-da77-0599-e2ea6fc61f99","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/netflow/rows","pathVariables":{},"method":"GET","data":[],"dataMode":"params","version":2,"time":1385853862100,"name":"GET all NetFlow rows","description":"","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"id":"40bd9df2-6510-0680-dd27-2c26cf9d4c46","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/sflow/rows","pathVariables":{},"method":"GET","data":[],"dataMode":"params","version":2,"time":1385832695823,"name":"GET all sFlow rows","description":"","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"id":"4ad4a7d7-3f94-8d95-7857-483891406392","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/SSL/rows/6c2a532c-96df-49ce-8f3f-f83c39e47122","pathVariables":{},"method":"DELETE","data":"","dataMode":"raw","version":2,"time":1385766788123,"name":"DELETE an SSL row given a UUID","description":"","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"id":"4c50625e-689d-1016-3daa-f927b3d5b4cc","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/open_vswitch/rows","data":[],"headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","dataMode":"params","method":"GET","version":2,"time":1384895597912,"name":"GET all open_vswitch rows","description":"","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"id":"53f1924f-8547-391b-39bb-e4cc3c2e9fde","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/sflow/rows","pathVariables":{},"method":"POST","data":"{\n  \"parent_uuid\":\"6b3072ba-a120-4db9-82f8-a8ce4eae6942\",\n  \"row\" : {\n  \t\"sFlow\":{\n      \"agent\": [\"agent_string\"],\n      \"targets\" : [\"targets_string\"]\n    \t}\n\t}\t\n}","dataMode":"raw","version":2,"time":1386294952966,"name":"INSERT an sFlow row","description":"","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"id":"606993e2-7b60-1313-4861-d1b4df4154ce","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/qos/rows/ab2b6f2d-5cb4-4dcf-ac1b-c989ae3d76ce","pathVariables":{},"method":"PUT","data":"{\n    \"row\":{\n      \"QoS\":{\n        \"queues\": {\n          \"1\" : { \"val\": \"0fbe6ced-16cf-4a39-8a79-e7c8c31f63a9\"}\n        }\n      }\n    }\n}","dataMode":"raw","version":2,"time":1386287453591,"name":"UPDATE a queue in QOS","description":"","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"id":"64ac8934-f2ee-2d11-145a-83216e08094f","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/qos/rows/ab2b6f2d-5cb4-4dcf-ac1b-c989ae3d76ce","pathVariables":{},"method":"PUT","data":"{\n    \"row\":{\n      \"QoS\":{\n        \"Queues\": {\n          \"queue_value\" : \"5afa70b6-7c74-4972-9d98-874e6307807d\"\n        }\n      }\n    }\n}","dataMode":"raw","version":2,"time":1386212074539,"name":"UPDATE a QoS row ","description":"","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"id":"6d173b2a-5933-44e8-173f-f00742278b7a","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/manager/rows/","pathVariables":{},"method":"DELETE","data":"","dataMode":"raw","version":2,"time":1385866190653,"name":"DELETE a Manager row given UUID","description":"","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"id":"6e39c0b9-1339-4d56-93ba-cbd353024824","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/queue/rows/cd1d39f2-0e8d-4164-a5ab-926329cd1c61","pathVariables":{},"method":"DELETE","data":"","dataMode":"raw","version":2,"time":1386291032110,"name":"DELETE a Queue row given a UUID (ROOT TABLE)","description":"","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","id":"84761df7-188e-ac7f-57ab-a6bc90759673","name":"DELETE a Bridge row given UUID","description":"Please note that the UUID used here must be one of the existing UUID of a Row in Bridge Table","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/bridge/rows/45677cc9-bed2-4def-9986-b05a9b59f1f4","method":"DELETE","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","data":"","dataMode":"raw","timestamp":0,"version":2,"time":1384465149749,"synced":false},{"id":"8ba0d3a3-1a3f-1722-513b-02d4546011c9","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/controller/rows/68e97a9a-9f2c-497a-b39b-7f1e37c30c6f","data":"","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","dataMode":"raw","method":"DELETE","version":2,"time":1385391658840,"name":"DELETE controller row given UUID","description":"package org.opendaylight.ovsdb.plugin\n\nclass ConfigurationService\n\nMethod: deleteControllerRow()","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"id":"94173b9e-1541-3d46-4e3c-31d6400dadd3","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/port/rows/2f93780e-ce56-4cce-9f7c-579be7996651","data":"","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","dataMode":"raw","method":"DELETE","version":2,"time":1385084358582,"name":"DELETE port row given UUID","description":"package org.opendaylight.ovsdb.plugin\n\nclass ConfigurationService\n\nMethod: deletePortRow()","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"id":"98fc409e-3eb4-3178-53ab-2a4cb5370b92","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/manager/rows","data":"{\n  \"parent_uuid\":\"8d3fb89b-5fac-4631-a990-f5a4e7f5383a\",\n    \"row\":{\n      \"Manager\":{\n        \"target\":\"a_string\",\n        \"is_connected\": true,\n        \"state\":\"active\"\n      }\n    }\n}","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","dataMode":"raw","method":"POST","version":2,"time":1384920841537,"name":"INSERT a Manager Row","description":"","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"id":"ab3c818e-526c-1938-e5d4-64136c00aa64","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/bridge/rows/66ad493c-23cf-45e7-b5a5-1901fb3165f4","pathVariables":{},"method":"PUT","data":"{\n    \"row\":{\n      \"Bridge\":{\n        \"netflow\": [\"55f5d382-17fd-4c42-850d-02c282a67c20\",\"60db8cde-26e6-4bf9-bb08-cd1da68d1fcc\"]\n                \n      }\n    }\n}","dataMode":"raw","version":2,"time":1386202840003,"name":"Update (PUT) Bridge table","description":"Please note that the UUID used here must be one of the existing UUID of a Row in Bridge Table.\n\nAlso the Update must be done ONLY on the fields that needs update. Should NOT send all the immutable fields again. Update will fail in that case.","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"id":"ac6e529f-6f5a-39d9-ce35-849fe361500d","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/controller/rows","data":"{\n  \"parent_uuid\":\"641b9f2c-a42c-4de9-a94b-5e3bbe1b3d46\",\n    \"row\":{\n      \"Controller\":{\n      }\n    }\n}","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","dataMode":"raw","method":"POST","version":2,"time":1385506596739,"name":"Add Controller to Bridge","description":"","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"id":"b8d189c1-ddea-6841-af5f-c879d83d582e","url":"http://localhost:8080/controller/nb/v2/connectionmanager/node/HOST1/address/192.168.1.102/port/6640/","data":[],"headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\n","dataMode":"params","method":"PUT","version":2,"time":1385493381229,"name":"Connect controller to OVSDB server","description":"","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"id":"b8e56ff8-04d7-bf8f-fb3d-5cfe13b3834e","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/interface/rows","data":[],"headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","dataMode":"params","method":"GET","version":2,"time":1384866802408,"name":"GET all interface rows","description":"","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"id":"bc7a068f-dcd2-198d-f526-d836472399e3","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/queue/rows","pathVariables":{},"method":"GET","data":[],"dataMode":"params","version":2,"time":1385846165644,"name":"GET all Queue rows","description":"","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"id":"bea94160-60b8-a9d1-25de-af6502d5c7dd","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/port/rows/97a82ec9-e85e-4a48-9b77-ca4a41128b90","pathVariables":{},"method":"PUT","data":"{\n    \"row\":{\n      \"Port\":{\n        \"qos\": [\n          \"ab2b6f2d-5cb4-4dcf-ac1b-c989ae3d76ce\"\n                ]\n      }\n    }\n}","dataMode":"raw","version":2,"time":1386208729980,"name":"Update Port Table","description":"","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"id":"c3c36bc0-e6a5-5007-2049-854e89e0093a","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/interface/rows","data":"{\n  \"parent_uuid\":\"ea70e5b1-8b21-4caf-a102-0b85b6c63119\",\n    \"row\":{\n      \"Interface\":{\n        \"name\":\"s1-1125-1\",\n        \"mac\":[\"00:00:bb:bb:00:01\"],\n        \"admin_state\":\"up\"\n      }\n    }\n}","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","dataMode":"raw","method":"POST","version":2,"time":1385389642924,"name":"Create row: Interface Table","description":"package org.opendaylight.ovsdb.plugin\npublic class ConfigurationService\n\nMethod: insertInterfaceRow\n","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"id":"d1013fcb-7da8-0673-eadd-c63e9b71acba","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/port/rows","data":[],"headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","dataMode":"params","method":"GET","version":2,"time":1384863858721,"name":"GET all port rows","description":"","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"id":"d1cf2cea-4f08-9d55-6d07-5662a3d93bb6","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/qos/rows/739f3929-3a3e-45b1-88ea-afc09df0ca5c","pathVariables":{},"method":"DELETE","data":"","dataMode":"raw","version":2,"time":1386292478840,"name":"DELETE a QoS row given a UUID (ROOT TABLE)","description":"","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"id":"d637a11a-f0e8-c571-864f-7853abc1605e","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/SSL/rows","pathVariables":{},"method":"POST","data":"{\n    \"row\":{\n      \"SSL\":{\n        \"name\":\"mySSL\",\n        \"ca_cert\" : \"ca_cert\",\n        \"bootstrap_ca_cert\" : true,\n        \"certificate\":\"pieceofpaper\",\n        \"private_key\" : \"private\"\n      }\n    }\n}\n","dataMode":"raw","version":2,"time":1385766215625,"name":"INSERT an SSL row","description":"","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"id":"e54bf72a-61c9-c569-b84c-db8b300fe976","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/qos/rows","pathVariables":{},"method":"GET","data":[],"dataMode":"params","version":2,"time":1385833787440,"name":"GET all QoS rows","description":"","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"id":"ee02ff5b-f217-024f-e8bf-347b0af9b73c","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/interface/rows/45bf1633-1411-4c92-87f8-b1492eed2ff6","data":"","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","dataMode":"raw","method":"DELETE","version":2,"time":1385442001088,"name":"DELETE interface row given UUID","description":"package org.opendaylight.ovsdb.plugin\n\nclass ConfigurationService\n\nMethod: deleteInterfaceRow()","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"id":"f2312567-3c45-74d0-c39f-0a10f9b3f5e1","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/qos/rows","pathVariables":{},"method":"POST","data":"{\n  \"parent_uuid\" : \"b109dbcf-47bb-4121-b244-e623b3421d6e\",\n  \"row\" : {\n  \t\"QoS\": {\n      \"type\": \"linux-htb\"\n    \t}\n\t}\t\n}","dataMode":"raw","version":2,"time":1386291627774,"name":"INSERT a QoS row","description":"","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"id":"f3421bad-6229-a5d1-6cbe-ec41de4900b5","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/netflow/rows/60db8cde-26e6-4bf9-bb08-cd1da68d1fcc","pathVariables":{},"method":"DELETE","data":"","dataMode":"raw","version":2,"time":1386202872294,"name":"DELETE a NetFlow row given UUID","description":"","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"id":"f745d42a-715a-fc49-3c72-e391c7faa15b","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/SSL/rows","pathVariables":{},"method":"GET","data":[],"dataMode":"params","version":2,"time":1385766024370,"name":"GET all SSL row","description":"","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false},{"id":"faeecd3b-d030-0acf-506b-6ba72d6906bc","url":"http://localhost:8080/ovsdb/nb/v2/node/OVS/HOST1/tables/bridge/rows","data":[],"headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n","dataMode":"params","method":"GET","version":2,"time":1384863804932,"name":"GET all bridge rows","description":"","collectionId":"6768e1b3-2d6e-b03b-9e2f-095ae8ec5770","responses":[],"synced":false}]}
\ No newline at end of file
+{
+       "id": "b4485302-3406-776b-fb0c-94d74c76dc36",
+       "name": "OVSDB Northbound APIs",
+       "description": "Northbound APIs exposed by ovsdb.northbound bundle",
+       "order": [
+               "1aaa544a-7d79-3159-84b5-89574ff7f3e2",
+               "190627e6-ef20-863f-998b-e019034874c4",
+               "d70a4755-d62a-dfcd-e363-dbe931af99a0"
+       ],
+       "folders": [
+               {
+                       "id": "f0bc8237-daf6-5584-4011-1549618623b5",
+                       "name": "01 BRIDGE",
+                       "description": "",
+                       "order": [
+                               "085fa6c6-1d5b-8afb-4e4a-56cafe5e8bd0",
+                               "aed6c263-4d42-ca35-669f-33a00c3d9c82",
+                               "6f5b8f9a-3e66-16b0-7a16-62a96313eab5",
+                               "7e41f2e4-6797-64f0-ebd2-b4b634b6a559",
+                               "2ced04cd-b934-9a0a-576d-8640b6a0b80e"
+                       ],
+                       "collection_name": "OVSDB Northbound APIs",
+                       "collection_id": "b4485302-3406-776b-fb0c-94d74c76dc36"
+               },
+               {
+                       "id": "d5c6f3fa-0354-d2db-a2e8-4cb29ade5580",
+                       "name": "02 PORT",
+                       "description": "",
+                       "order": [
+                               "2990bcf5-976b-413a-f732-9a21d26d2146",
+                               "618382e3-a833-04d1-f917-c40e70c176cb",
+                               "39cdc358-7c75-d1cc-34ff-081e74254748",
+                               "4945fedc-a9c9-5b38-478f-df9ea0d1248a"
+                       ],
+                       "collection_name": "OVSDB Northbound APIs",
+                       "collection_id": "b4485302-3406-776b-fb0c-94d74c76dc36"
+               },
+               {
+                       "id": "10aeabc5-bd4b-b64f-31b6-82cbe9c7e9de",
+                       "name": "03 INTERFACE",
+                       "description": "",
+                       "order": [
+                               "a37af20f-0e43-3fe1-9f3b-c42a264fa3a1",
+                               "4b21a8b1-1703-bc2c-8716-7dcdab57300a",
+                               "0753fa84-8a0e-7727-1d45-5b5eb8c74de0"
+                       ],
+                       "collection_name": "OVSDB Northbound APIs",
+                       "collection_id": "b4485302-3406-776b-fb0c-94d74c76dc36"
+               },
+               {
+                       "id": "704ce201-08b0-59b4-eba0-c0a22d14d64a",
+                       "name": "04 CONTROLLER",
+                       "description": "",
+                       "order": [
+                               "7fc7d8cd-244d-58a0-febf-9814729b9422",
+                               "646be7a5-a484-329a-1039-02b53e1b05fc",
+                               "d239a9ea-8247-3d47-0d3a-2a1063c0177a"
+                       ],
+                       "collection_name": "OVSDB Northbound APIs",
+                       "collection_id": "b4485302-3406-776b-fb0c-94d74c76dc36"
+               },
+               {
+                       "id": "c49bb77a-920b-9653-232b-6a35fae3229f",
+                       "name": "05 SSL",
+                       "description": "",
+                       "order": [
+                               "3c4a6bb9-30e8-fdf1-1cf3-a3e187537924",
+                               "6c1b9611-b195-c64c-684f-a639e7ae3946",
+                               "989d5e9c-47a9-206a-c225-dc0e796f096a"
+                       ],
+                       "collection_name": "OVSDB Northbound APIs",
+                       "collection_id": "b4485302-3406-776b-fb0c-94d74c76dc36"
+               },
+               {
+                       "id": "7d339efa-b5a2-ecb5-1639-7c99ab2beb08",
+                       "name": "06 sFlow",
+                       "description": "",
+                       "order": [
+                               "88f1ec23-5471-97a8-2633-c89c51c20071",
+                               "9b2eaefc-5cc0-958a-0926-2b18fea54b88",
+                               "5eab776e-dd13-2a7f-90c3-fabc4d98d481"
+                       ],
+                       "collection_name": "OVSDB Northbound APIs",
+                       "collection_id": "b4485302-3406-776b-fb0c-94d74c76dc36"
+               },
+               {
+                       "id": "75c166a9-e5de-c7bd-59b4-20e512c89ef4",
+                       "name": "07 Qos",
+                       "description": "",
+                       "order": [
+                               "5e1f52b7-3295-9485-377f-6988c401a8cd",
+                               "d565f3fb-4a9a-3e61-9e8e-87324427c979",
+                               "40323a39-f07f-695a-2428-e888dd9c7cf1",
+                               "c3c1dd3a-1f8e-947d-f729-2eef56795fef"
+                       ],
+                       "collection_name": "OVSDB Northbound APIs",
+                       "collection_id": "b4485302-3406-776b-fb0c-94d74c76dc36"
+               },
+               {
+                       "id": "ebb04a01-9318-78ba-7d7d-590688434f35",
+                       "name": "08 Queue",
+                       "description": "",
+                       "order": [
+                               "b1af09ee-f6b9-cddd-9087-6d8dc5b958a4",
+                               "d32420de-40fd-d407-59c5-e1c3b8ea359c",
+                               "2d670425-e1ae-c615-1fe1-b27c0ddf4c43",
+                               "9d887d97-a323-a847-a163-ca6e62ad96fe"
+                       ],
+                       "collection_name": "OVSDB Northbound APIs",
+                       "collection_id": "b4485302-3406-776b-fb0c-94d74c76dc36"
+               },
+               {
+                       "id": "dc13be48-4ea4-7d32-63df-d367c6df6e70",
+                       "name": "09 NetFlow",
+                       "description": "",
+                       "order": [
+                               "c7ab23bd-2d49-71a0-7a40-31ee0f44b2b0",
+                               "76c04544-3be0-e330-75e1-509919d781f0",
+                               "f8d9b165-7fa7-e0bd-b634-b45d550a3114"
+                       ],
+                       "collection_name": "OVSDB Northbound APIs",
+                       "collection_id": "b4485302-3406-776b-fb0c-94d74c76dc36"
+               },
+               {
+                       "id": "1fe328ce-a0f2-2512-36b2-21c854081873",
+                       "name": "10 Manager",
+                       "description": "",
+                       "order": [
+                               "3d34de25-8015-98e5-957b-eb3cef69175f",
+                               "1aaa544a-7d79-3159-84b5-89574ff7f3e2",
+                               "baab428a-b056-bd23-906d-290933aee25f"
+                       ],
+                       "collection_name": "OVSDB Northbound APIs",
+                       "collection_id": "b4485302-3406-776b-fb0c-94d74c76dc36"
+               },
+               {
+                       "id": "40018e32-d0ca-4a2f-5f06-bff5c95382f8",
+                       "name": "11 IPFIX",
+                       "description": "",
+                       "order": [
+                               "a01a045e-e642-8e39-f2cc-baf37ec5dfc5",
+                               "485249a8-94d2-b61b-a6b9-addfe8fb1495",
+                               "8f74bdb1-1f10-69f4-da1d-cd878df784e5"
+                       ],
+                       "collection_name": "OVSDB Northbound APIs",
+                       "collection_id": "b4485302-3406-776b-fb0c-94d74c76dc36"
+               }
+       ],
+       "timestamp": 1384305639019,
+       "synced": false,
+       "requests": [
+               {
+                       "id": "0753fa84-8a0e-7727-1d45-5b5eb8c74de0",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/interface/rows/45bf1633-1411-4c92-87f8-b1492eed2ff6",
+                       "data": "",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "dataMode": "raw",
+                       "method": "DELETE",
+                       "version": 2,
+                       "time": 1385442001088,
+                       "name": "DELETE interface row given UUID",
+                       "description": "package org.opendaylight.ovsdb.plugin\n\nclass ConfigurationService\n\nMethod: deleteInterfaceRow()",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "085fa6c6-1d5b-8afb-4e4a-56cafe5e8bd0",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/bridge/rows",
+                       "data": [],
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "dataMode": "params",
+                       "method": "GET",
+                       "version": 2,
+                       "time": 1384863804932,
+                       "name": "GET all bridge rows",
+                       "description": "",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "190627e6-ef20-863f-998b-e019034874c4",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/open_vswitch/rows",
+                       "data": [],
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "dataMode": "params",
+                       "method": "GET",
+                       "version": 2,
+                       "time": 1384895597912,
+                       "name": "GET all open_vswitch rows",
+                       "description": "",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "1aaa544a-7d79-3159-84b5-89574ff7f3e2",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/manager/rows",
+                       "data": "{\n  \"parent_uuid\":\"8d3fb89b-5fac-4631-a990-f5a4e7f5383a\",\n    \"row\":{\n      \"Manager\":{\n        \"target\":\"a_string\",\n        \"is_connected\": true,\n        \"state\":\"active\"\n      }\n    }\n}",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "dataMode": "raw",
+                       "method": "POST",
+                       "version": 2,
+                       "time": 1384920841537,
+                       "name": "INSERT a Manager Row",
+                       "description": "",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "2990bcf5-976b-413a-f732-9a21d26d2146",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/port/rows",
+                       "data": [],
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "dataMode": "params",
+                       "method": "GET",
+                       "version": 2,
+                       "time": 1384863858721,
+                       "name": "GET all port rows",
+                       "description": "",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "2ced04cd-b934-9a0a-576d-8640b6a0b80e",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/bridge/rows/66ad493c-23cf-45e7-b5a5-1901fb3165f4",
+                       "pathVariables": {},
+                       "method": "PUT",
+                       "data": "{\n    \"row\":{\n      \"Bridge\":{\n        \"netflow\": [\"55f5d382-17fd-4c42-850d-02c282a67c20\",\"60db8cde-26e6-4bf9-bb08-cd1da68d1fcc\"]\n                \n      }\n    }\n}",
+                       "dataMode": "raw",
+                       "version": 2,
+                       "time": 1386202840003,
+                       "name": "Update (PUT) Bridge table",
+                       "description": "Please note that the UUID used here must be one of the existing UUID of a Row in Bridge Table.\n\nAlso the Update must be done ONLY on the fields that needs update. Should NOT send all the immutable fields again. Update will fail in that case.",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "2d670425-e1ae-c615-1fe1-b27c0ddf4c43",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/queue/rows/cd1d39f2-0e8d-4164-a5ab-926329cd1c61",
+                       "pathVariables": {},
+                       "method": "DELETE",
+                       "data": "",
+                       "dataMode": "raw",
+                       "version": 2,
+                       "time": 1386291032110,
+                       "name": "DELETE a Queue row given a UUID (ROOT TABLE)",
+                       "description": "",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "39cdc358-7c75-d1cc-34ff-081e74254748",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/port/rows/2f93780e-ce56-4cce-9f7c-579be7996651",
+                       "data": "",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "dataMode": "raw",
+                       "method": "DELETE",
+                       "version": 2,
+                       "time": 1385084358582,
+                       "name": "DELETE port row given UUID",
+                       "description": "package org.opendaylight.ovsdb.plugin\n\nclass ConfigurationService\n\nMethod: deletePortRow()",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "3c4a6bb9-30e8-fdf1-1cf3-a3e187537924",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/SSL/rows",
+                       "pathVariables": {},
+                       "method": "GET",
+                       "data": [],
+                       "dataMode": "params",
+                       "version": 2,
+                       "time": 1385766024370,
+                       "name": "GET all SSL row",
+                       "description": "",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "3d34de25-8015-98e5-957b-eb3cef69175f",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/manager/rows",
+                       "data": [],
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "dataMode": "params",
+                       "method": "GET",
+                       "version": 2,
+                       "time": 1384920805653,
+                       "name": "GET all manager rows",
+                       "description": "",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "40323a39-f07f-695a-2428-e888dd9c7cf1",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/qos/rows/739f3929-3a3e-45b1-88ea-afc09df0ca5c",
+                       "pathVariables": {},
+                       "method": "DELETE",
+                       "data": "",
+                       "dataMode": "raw",
+                       "version": 2,
+                       "time": 1386292478840,
+                       "name": "DELETE a QoS row given a UUID (ROOT TABLE)",
+                       "description": "",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "485249a8-94d2-b61b-a6b9-addfe8fb1495",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/ipfix/rows",
+                       "pathVariables": {},
+                       "method": "POST",
+                       "data": "{\n  \"parent_uuid\":\"2e5c0418-e70c-406b-9ad9-58585ac10c19\",\n    \"row\":{\n      \"IPFIX\":{\n        \"targets\":[\n          \"set\", [\"192.168.56.1:5555\"]]\n      }\n    }\n}",
+                       "dataMode": "raw",
+                       "name": "Insert a IPFIX row",
+                       "description": "",
+                       "descriptionFormat": "html",
+                       "time": 1396821935199,
+                       "version": 2,
+                       "responses": [],
+                       "tests": "",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "synced": false
+               },
+               {
+                       "id": "4945fedc-a9c9-5b38-478f-df9ea0d1248a",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/port/rows/97a82ec9-e85e-4a48-9b77-ca4a41128b90",
+                       "pathVariables": {},
+                       "method": "PUT",
+                       "data": "{\n    \"row\":{\n      \"Port\":{\n        \"qos\": [\n          \"ab2b6f2d-5cb4-4dcf-ac1b-c989ae3d76ce\"\n                ]\n      }\n    }\n}",
+                       "dataMode": "raw",
+                       "version": 2,
+                       "time": 1386208729980,
+                       "name": "Update Port Table",
+                       "description": "",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "4b21a8b1-1703-bc2c-8716-7dcdab57300a",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/interface/rows",
+                       "pathVariables": {},
+                       "method": "POST",
+                       "data": "{\n  \"parent_uuid\":\"ea70e5b1-8b21-4caf-a102-0b85b6c63119\",\n    \"row\":{\n      \"Interface\":{\n        \"name\":\"s1-1125-1\",\n        \"mac\":[\"00:00:bb:bb:00:01\"],\n        \"admin_state\":\"up\"\n      }\n    }\n}",
+                       "dataMode": "raw",
+                       "version": 2,
+                       "tests": "",
+                       "time": 1396829465324,
+                       "name": "Create row: Interface Table",
+                       "description": "package org.opendaylight.ovsdb.plugin\npublic class ConfigurationService\n\nMethod: insertInterfaceRow\n",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "5e1f52b7-3295-9485-377f-6988c401a8cd",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/qos/rows",
+                       "pathVariables": {},
+                       "method": "GET",
+                       "data": [],
+                       "dataMode": "params",
+                       "version": 2,
+                       "time": 1385833787440,
+                       "name": "GET all QoS rows",
+                       "description": "",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "5eab776e-dd13-2a7f-90c3-fabc4d98d481",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/sflow/rows/",
+                       "pathVariables": {},
+                       "method": "DELETE",
+                       "data": "",
+                       "dataMode": "raw",
+                       "version": 2,
+                       "time": 1385832734561,
+                       "name": "DELETE an sFlow row given a UUID",
+                       "description": "",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "618382e3-a833-04d1-f917-c40e70c176cb",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/port/rows",
+                       "pathVariables": {},
+                       "method": "POST",
+                       "data": "{\n  \"parent_uuid\":\"6b3072ba-a120-4db9-82f8-a8ce4eae6942\",\n    \"row\":{\n      \"Port\":{\n        \"name\":\"krb1\",\n        \"mac\":[\"00:00:00:00:00:01\"],\n        \"tag\":[200]\n      }\n    }\n}",
+                       "dataMode": "raw",
+                       "version": 2,
+                       "tests": "",
+                       "time": 1396829482311,
+                       "name": "Create a Port and add it to a Bridge",
+                       "description": "Please note that the parent_uuid of this HTTP Data is the UUID of the Bridge that was created in the previous step.\n\nWatch out for the return value which is the UUID of the port that was just created. This UUID must be used as the parent_uuid for the interface addition. Also look out for the HTTP headers that is returned and it has a location field that can be used for both DELETE and UPDATE operations later.\n",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "646be7a5-a484-329a-1039-02b53e1b05fc",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/controller/rows/68e97a9a-9f2c-497a-b39b-7f1e37c30c6f",
+                       "data": "",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "dataMode": "raw",
+                       "method": "DELETE",
+                       "version": 2,
+                       "time": 1385391658840,
+                       "name": "DELETE controller row given UUID",
+                       "description": "package org.opendaylight.ovsdb.plugin\n\nclass ConfigurationService\n\nMethod: deleteControllerRow()",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "6c1b9611-b195-c64c-684f-a639e7ae3946",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/SSL/rows",
+                       "pathVariables": {},
+                       "method": "POST",
+                       "data": "{\n    \"row\":{\n      \"SSL\":{\n        \"name\":\"mySSL\",\n        \"ca_cert\" : \"ca_cert\",\n        \"bootstrap_ca_cert\" : true,\n        \"certificate\":\"pieceofpaper\",\n        \"private_key\" : \"private\"\n      }\n    }\n}\n",
+                       "dataMode": "raw",
+                       "version": 2,
+                       "time": 1385766215625,
+                       "name": "INSERT an SSL row",
+                       "description": "",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "6f5b8f9a-3e66-16b0-7a16-62a96313eab5",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/bridge/rows",
+                       "pathVariables": {},
+                       "method": "POST",
+                       "data": "{\n    \"row\":{\n      \"Bridge\":{\n        \"name\":\"br25\",\n        \"datapath_type\":\"OPENFLOW\"\n      }\n    }\n}",
+                       "dataMode": "raw",
+                       "version": 2,
+                       "tests": "",
+                       "time": 1396829500172,
+                       "name": "Create a Bridge",
+                       "description": "Watch out for the return value which is the UUID of the bridge that was just created.\nThis UUID must be used as the parent_uuid for the port addition.\n\nAlso look out for the HTTP headers that is returned and it has a location field that can be used for both DELETE and UPDATE operations later.",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "76c04544-3be0-e330-75e1-509919d781f0",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/netflow/rows",
+                       "pathVariables": {},
+                       "method": "POST",
+                       "data": "{\n  \"parent_uuid\":\"817d2e33-448d-4f2e-b183-7f835e93922f\",\n  \"row\" : {\n    \"NetFlow\":{\n      \"targets\" : [\n        \"set\", [\"192.168.1.102:9998\"]],\n      \"active_timeout\" : \"0\"\n      }\n  } \n}",
+                       "dataMode": "raw",
+                       "version": 2,
+                       "tests": "",
+                       "time": 1396822912058,
+                       "name": "INSERT a NetFlow row",
+                       "description": "",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "id": "7e41f2e4-6797-64f0-ebd2-b4b634b6a559",
+                       "name": "DELETE a Bridge row given UUID",
+                       "description": "Please note that the UUID used here must be one of the existing UUID of a Row in Bridge Table",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/bridge/rows/45677cc9-bed2-4def-9986-b05a9b59f1f4",
+                       "method": "DELETE",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "data": "",
+                       "dataMode": "raw",
+                       "timestamp": 0,
+                       "version": 2,
+                       "time": 1384465149749,
+                       "synced": false
+               },
+               {
+                       "id": "7fc7d8cd-244d-58a0-febf-9814729b9422",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/controller/rows",
+                       "data": [],
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "dataMode": "params",
+                       "method": "GET",
+                       "version": 2,
+                       "time": 1384898533812,
+                       "name": "GET all controller rows",
+                       "description": "",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "88f1ec23-5471-97a8-2633-c89c51c20071",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/sflow/rows",
+                       "pathVariables": {},
+                       "method": "GET",
+                       "data": [],
+                       "dataMode": "params",
+                       "version": 2,
+                       "time": 1385832695823,
+                       "name": "GET all sFlow rows",
+                       "description": "",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "8f74bdb1-1f10-69f4-da1d-cd878df784e5",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/ipfix/rows/715fb52c-63bb-495a-8dca-f3f824fbf8fb",
+                       "pathVariables": {},
+                       "method": "DELETE",
+                       "data": "",
+                       "dataMode": "raw",
+                       "version": 2,
+                       "tests": "",
+                       "time": 1396823075244,
+                       "name": "DELETE a IPFIX row given a UUID",
+                       "description": "",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "989d5e9c-47a9-206a-c225-dc0e796f096a",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/SSL/rows/6c2a532c-96df-49ce-8f3f-f83c39e47122",
+                       "pathVariables": {},
+                       "method": "DELETE",
+                       "data": "",
+                       "dataMode": "raw",
+                       "version": 2,
+                       "time": 1385766788123,
+                       "name": "DELETE an SSL row given a UUID",
+                       "description": "",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "9b2eaefc-5cc0-958a-0926-2b18fea54b88",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/sflow/rows",
+                       "pathVariables": {},
+                       "method": "POST",
+                       "data": "{\n  \"parent_uuid\": \"a8c88ae9-fc08-498b-8ec8-2fd86627055d\",\n  \"row\": {\n    \"sFlow\": {\n      \"targets\": [\n        \"set\",\n        [\n          \"targets_string\"\n        ]\n      ]\n    }\n  }\n}",
+                       "dataMode": "raw",
+                       "version": 2,
+                       "tests": "",
+                       "time": 1396827237234,
+                       "name": "INSERT an sFlow row",
+                       "description": "",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "9d887d97-a323-a847-a163-ca6e62ad96fe",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/qos/rows/ab2b6f2d-5cb4-4dcf-ac1b-c989ae3d76ce",
+                       "pathVariables": {},
+                       "method": "PUT",
+                       "data": "{\n    \"row\":{\n      \"QoS\":{\n        \"queues\": {\n          \"1\" : { \"val\": \"0fbe6ced-16cf-4a39-8a79-e7c8c31f63a9\"}\n        }\n      }\n    }\n}",
+                       "dataMode": "raw",
+                       "version": 2,
+                       "time": 1386287453591,
+                       "name": "UPDATE a queue in QOS",
+                       "description": "",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "a01a045e-e642-8e39-f2cc-baf37ec5dfc5",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/ipfix/rows",
+                       "pathVariables": {},
+                       "method": "GET",
+                       "data": [],
+                       "dataMode": "params",
+                       "name": "GET all IPFIX rows",
+                       "description": "",
+                       "descriptionFormat": "html",
+                       "time": 1396821857102,
+                       "version": 2,
+                       "responses": [],
+                       "tests": "",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "synced": false
+               },
+               {
+                       "id": "a37af20f-0e43-3fe1-9f3b-c42a264fa3a1",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/interface/rows",
+                       "data": [],
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "dataMode": "params",
+                       "method": "GET",
+                       "version": 2,
+                       "time": 1384866802408,
+                       "name": "GET all interface rows",
+                       "description": "",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "id": "aed6c263-4d42-ca35-669f-33a00c3d9c82",
+                       "name": "GET a bridge row given a UUID",
+                       "description": "Please note that the UUID used here must be one of the existing UUID of a Row in Bridge Table",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/bridge/rows/45677cc9-bed2-4def-9986-b05a9b59f1f4",
+                       "method": "GET",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "data": "",
+                       "dataMode": "raw",
+                       "timestamp": 0,
+                       "version": 2,
+                       "time": 1384465185771,
+                       "synced": false
+               },
+               {
+                       "id": "b1af09ee-f6b9-cddd-9087-6d8dc5b958a4",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/queue/rows",
+                       "pathVariables": {},
+                       "method": "GET",
+                       "data": [],
+                       "dataMode": "params",
+                       "version": 2,
+                       "time": 1385846165644,
+                       "name": "GET all Queue rows",
+                       "description": "",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "baab428a-b056-bd23-906d-290933aee25f",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/manager/rows/",
+                       "pathVariables": {},
+                       "method": "DELETE",
+                       "data": "",
+                       "dataMode": "raw",
+                       "version": 2,
+                       "time": 1385866190653,
+                       "name": "DELETE a Manager row given UUID",
+                       "description": "",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "c3c1dd3a-1f8e-947d-f729-2eef56795fef",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/qos/rows/ab2b6f2d-5cb4-4dcf-ac1b-c989ae3d76ce",
+                       "pathVariables": {},
+                       "method": "PUT",
+                       "data": "{\n    \"row\":{\n      \"QoS\":{\n        \"Queues\": {\n          \"queue_value\" : \"5afa70b6-7c74-4972-9d98-874e6307807d\"\n        }\n      }\n    }\n}",
+                       "dataMode": "raw",
+                       "version": 2,
+                       "time": 1386212074539,
+                       "name": "UPDATE a QoS row ",
+                       "description": "",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "c7ab23bd-2d49-71a0-7a40-31ee0f44b2b0",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/netflow/rows",
+                       "pathVariables": {},
+                       "method": "GET",
+                       "data": [],
+                       "dataMode": "params",
+                       "version": 2,
+                       "time": 1385853862100,
+                       "name": "GET all NetFlow rows",
+                       "description": "",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "d239a9ea-8247-3d47-0d3a-2a1063c0177a",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/controller/rows",
+                       "pathVariables": {},
+                       "method": "POST",
+                       "data": "{\n  \"parent_uuid\" : \"a8c88ae9-fc08-498b-8ec8-2fd86627055d\",\n  \"row\" : {\n  \t\"Controller\": {\n      \"target\": \"1.1.1.1\"\n    \t}\n\t}\t\n}",
+                       "dataMode": "raw",
+                       "version": 2,
+                       "tests": "",
+                       "time": 1396828737787,
+                       "name": "Add Controller to Bridge",
+                       "description": "",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "d32420de-40fd-d407-59c5-e1c3b8ea359c",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/queue/rows",
+                       "pathVariables": {},
+                       "method": "POST",
+                       "data": "{\n  \"parent_uuid\": \"c5f7ce39-847c-4a69-bf8a-2a0181898581\",\n  \"row\": {\n    \"Queue\": {\n      \"dscp\" : [\n      \"set\",\n      [\n          25\n        ]\n      ]\n    }\n  }\n}",
+                       "dataMode": "raw",
+                       "version": 2,
+                       "tests": "",
+                       "time": 1396828046762,
+                       "name": "INSERT a Queue row",
+                       "description": "",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "d565f3fb-4a9a-3e61-9e8e-87324427c979",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/qos/rows",
+                       "pathVariables": {},
+                       "method": "POST",
+                       "data": "{\n  \"parent_uuid\" : \"b109dbcf-47bb-4121-b244-e623b3421d6e\",\n  \"row\" : {\n  \t\"QoS\": {\n      \"type\": \"linux-htb\"\n    \t}\n\t}\t\n}",
+                       "dataMode": "raw",
+                       "version": 2,
+                       "time": 1386291627774,
+                       "name": "INSERT a QoS row",
+                       "description": "",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "d70a4755-d62a-dfcd-e363-dbe931af99a0",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/controller/nb/v2/connectionmanager/node/HOST1/address/192.168.1.102/port/6640/",
+                       "data": [],
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\n",
+                       "dataMode": "params",
+                       "method": "PUT",
+                       "version": 2,
+                       "time": 1385493381229,
+                       "name": "Connect controller to OVSDB server",
+                       "description": "",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               },
+               {
+                       "id": "f8d9b165-7fa7-e0bd-b634-b45d550a3114",
+                       "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+                       "url": "http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v2/node/OVS/HOST1/tables/netflow/rows/60db8cde-26e6-4bf9-bb08-cd1da68d1fcc",
+                       "pathVariables": {},
+                       "method": "DELETE",
+                       "data": "",
+                       "dataMode": "raw",
+                       "version": 2,
+                       "time": 1386202872294,
+                       "name": "DELETE a NetFlow row given UUID",
+                       "description": "",
+                       "collectionId": "b4485302-3406-776b-fb0c-94d74c76dc36",
+                       "responses": [],
+                       "synced": false
+               }
+       ]
+}
\ No newline at end of file
index a8392070bc591b8da35d4c7bc7e3bf933e04617b..97538229ed3cc1690276c61b3a7fd877071b9d83 100644 (file)
@@ -5,6 +5,8 @@ administrators working on ovsdb project in general.
 Contents 
 --------
 
-1. Mininet_Demo_OVSDB_OF.json.postman_collection : Collection of REST-APIs used in the Mininet demo (http://www.youtube.com/watch?v=8iWhMVlflwE)
+1. localhost.json.postman_environment : Environment that associates address and port to localhost:8080 in templates for the collections below.
 
-2. OVSDB_Northbound_APIs.json.postman_collection : Collection of REST-APIs detailing on all the ovsdb.northbound APIs.
+2. Mininet_Demo_OVSDB_OF.json.postman_collection : Collection of REST-APIs used in the Mininet demo (http://www.youtube.com/watch?v=8iWhMVlflwE)
+
+3. OVSDB_Northbound_APIs.json.postman_collection : Collection of REST-APIs detailing on all the ovsdb.northbound APIs.
diff --git a/resources/commons/localhost.json.postman_environment b/resources/commons/localhost.json.postman_environment
new file mode 100644 (file)
index 0000000..ce1c4f7
--- /dev/null
@@ -0,0 +1,17 @@
+{
+    "id": "855f06f8-9128-1a19-faf2-3af865f04061", 
+    "name": "localhost", 
+    "timestamp": 1396964904677, 
+    "values": [
+        {
+            "key": "controllerHost", 
+            "type": "text", 
+            "value": "localhost"
+        }, 
+        {
+            "key": "controllerPort", 
+            "type": "text", 
+            "value": "8080"
+        }
+    ]
+}
index 81e2e1e92e1d6942520c0a9fe7b75381416e59d4..47918f84ad846ed1f7b6ead575c5ca25f92a7997 100644 (file)
@@ -1 +1 @@
-{"id":"8ced994a-307c-ff92-8fff-b6ab521e1aec","name":"DevStack","description":"Scripts used in devstack testing","order":["534300ea-fca8-4c8a-769c-227b3129d3a0","d1a99582-dff6-26ae-6416-89bd3788dd47"],"folders":[],"timestamp":1385264376897,"synced":false,"requests":[{"collectionId":"8ced994a-307c-ff92-8fff-b6ab521e1aec","id":"534300ea-fca8-4c8a-769c-227b3129d3a0","name":"Connect to ovsdb-server running in Devstack Controller","description":"","url":"http://localhost:8080/controller/nb/v2/connectionmanager/node/STACK1/address/192.168.56.101/port/6640/","method":"PUT","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\n","data":[],"dataMode":"params","timestamp":0,"responses":[],"version":2,"synced":false},{"collectionId":"8ced994a-307c-ff92-8fff-b6ab521e1aec","id":"d1a99582-dff6-26ae-6416-89bd3788dd47","name":"Connect to ovsdb-server running in Devstack compute","description":"","url":"http://localhost:8080/controller/nb/v2/connectionmanager/node/STACK2/address/192.168.56.102/port/6640/","method":"PUT","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\n","data":[],"dataMode":"params","timestamp":0,"responses":[],"version":2,"synced":false}]}
\ No newline at end of file
+{"id":"8ced994a-307c-ff92-8fff-b6ab521e1aec","name":"DevStack","description":"Scripts used in devstack testing","order":["534300ea-fca8-4c8a-769c-227b3129d3a0","d1a99582-dff6-26ae-6416-89bd3788dd47"],"folders":[],"timestamp":1385264376897,"synced":false,"requests":[{"collectionId":"8ced994a-307c-ff92-8fff-b6ab521e1aec","id":"534300ea-fca8-4c8a-769c-227b3129d3a0","name":"Connect to ovsdb-server running in Devstack Controller","description":"","url":"http://{{controllerHost}}:{{controllerPort}}/controller/nb/v2/connectionmanager/node/STACK1/address/192.168.56.101/port/6640/","method":"PUT","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\n","data":[],"dataMode":"params","timestamp":0,"responses":[],"version":2,"synced":false},{"collectionId":"8ced994a-307c-ff92-8fff-b6ab521e1aec","id":"d1a99582-dff6-26ae-6416-89bd3788dd47","name":"Connect to ovsdb-server running in Devstack compute","description":"","url":"http://{{controllerHost}}:{{controllerPort}}/controller/nb/v2/connectionmanager/node/STACK2/address/192.168.56.102/port/6640/","method":"PUT","headers":"Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\n","data":[],"dataMode":"params","timestamp":0,"responses":[],"version":2,"synced":false}]}
\ No newline at end of file
diff --git a/resources/openstack/Neutron-v2.0-API-Examples.json.postman_collection b/resources/openstack/Neutron-v2.0-API-Examples.json.postman_collection
new file mode 100644 (file)
index 0000000..065d7f6
--- /dev/null
@@ -0,0 +1,301 @@
+{
+    "id": "bd9b142f-e3ad-452d-f088-eed1b741b937",
+    "name": "Neutron-v2.0-API-Examples",
+    "description": "A collection of OpenStack Neutron v2.0 REST API calls for Postman. Import these into Postman and use to validate the OpenDaylight Neutron NB-API interfaces.\n\nResources:\n- Postman http://www.getpostman.com\n- Neutron v2.0 https://wiki.openstack.org/wiki/Neutron/APIv2-specification",
+    "order": [
+        "55aab7d7-6159-c4fb-5b3f-42cbb55c4e7b",
+        "1215e515-a4ff-7d7e-acbf-905c6706db86",
+        "f9de4b7d-8b08-fb14-d557-3cf81d7465f4",
+        "9fe0d840-dcd3-6d3e-d410-e88538858e3a",
+        "c9cc2212-1f16-ead6-5dc0-073aed1e2c61",
+        "1387de10-9981-2ecb-32b8-4cc4806894cf",
+        "56d38607-d1dc-adba-a3fd-7e4d63e6c75d",
+        "4f72cdab-70f1-dba9-3986-3305c7ef18c8",
+        "f01b7f99-0aeb-739f-eb4a-cd467320b85c",
+        "747f9a54-e64f-57f6-ce6d-8ad358817696",
+        "7ef5413c-7f22-ac12-5444-f9be6a7c029e",
+        "ed8face9-6585-8a9b-9e09-870e3a5e5546",
+        "09bcfbe4-b01a-3615-820f-7fc3a2261e05",
+        "a1efd833-3d79-1621-9aa5-61b0fecec94a",
+        "a183a8b3-bddb-dc04-ae73-3beb11af4d04",
+        "ef3c7339-ba4d-124d-7e1f-67d9ab638277"
+    ],
+    "folders": [],
+    "timestamp": 1394529177458,
+    "synced": false,
+    "requests": [
+        {
+            "id": "09bcfbe4-b01a-3615-820f-7fc3a2261e05",
+            "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+            "url": "http://127.0.0.1:8080/controller/nb/v2/neutron/fw/firewalls_rules",
+            "pathVariables": {},
+            "method": "GET",
+            "data": [],
+            "dataMode": "params",
+            "version": 2,
+            "tests": "",
+            "time": 1401139182979,
+            "name": "Get Neutron FWaaS Rules",
+            "description": "Return a list of Neutron v2.0 API FWaaS rules.",
+            "collectionId": "bd9b142f-e3ad-452d-f088-eed1b741b937",
+            "responses": [],
+            "synced": false
+        },
+        {
+            "id": "1215e515-a4ff-7d7e-acbf-905c6706db86",
+            "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+            "url": "http://127.0.0.1:8080/controller/nb/v2/neutron/networks/",
+            "pathVariables": {},
+            "method": "GET",
+            "data": [],
+            "dataMode": "params",
+            "version": 2,
+            "tests": "",
+            "time": 1401139794797,
+            "name": "Get Neutron Networks",
+            "description": "Return a list of Neutron v2.0 Networks",
+            "collectionId": "bd9b142f-e3ad-452d-f088-eed1b741b937",
+            "responses": [],
+            "synced": false
+        },
+        {
+            "id": "1387de10-9981-2ecb-32b8-4cc4806894cf",
+            "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+            "url": "http://127.0.0.1:8080/controller/nb/v2/neutron/security-groups/",
+            "pathVariables": {},
+            "method": "POST",
+            "data": "{\n   \"security_group\":{\n      \"name\":\"TCP Port Range\",\n      \"description\":\"Example TCP port range security group\",\n     \"tenant_id\":\"3B82FF05-72A2-413E-B051-222222222222\",\n     \"id\":\"C9F5924D-4D08-4819-BFC4-444444444444\"\n   }\n}",
+            "dataMode": "raw",
+            "version": 2,
+            "tests": "",
+            "time": 1401137715163,
+            "name": "Post Add Security Group Port Range",
+            "description": "Example Neutron v2.0  Add Security Group with a TCP Port Range",
+            "collectionId": "bd9b142f-e3ad-452d-f088-eed1b741b937",
+            "responses": [],
+            "synced": false
+        },
+        {
+            "id": "4f72cdab-70f1-dba9-3986-3305c7ef18c8",
+            "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+            "url": "http://127.0.0.1:8080/controller/nb/v2/neutron/security-groups/",
+            "pathVariables": {},
+            "method": "GET",
+            "data": [],
+            "dataMode": "params",
+            "version": 2,
+            "tests": "",
+            "time": 1401139154340,
+            "name": "Get Neutron Security Groups",
+            "description": "Return a list of Neutron v2.0 API security groups.",
+            "collectionId": "bd9b142f-e3ad-452d-f088-eed1b741b937",
+            "responses": [],
+            "synced": false
+        },
+        {
+            "id": "55aab7d7-6159-c4fb-5b3f-42cbb55c4e7b",
+            "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+            "url": "http://127.0.0.1:8080/controller/nb/v2/neutron/networks/",
+            "pathVariables": {},
+            "method": "POST",
+            "data": "{\n   \"networks\":[\n      {\n         \"status\":\"ACTIVE\",\n         \"subnets\":[\n         ],\n         \"name\":\"sample_network_89\",\n         \"provider:physical_network\":null,\n   \"admin_state_up\":false,\n   \"tenant_id\":\"60cd4f6dbc5f499982a284e7b83b5be3\",\n   \"provider:network_type\":\"local\",\n   \"router:external\":false,\n   \"shared\":false,\n   \"id\":\"e9330b1f-a2ef-4160-a991-169e56ab17f5\",\n   \"provider:segmentation_id\":89\n}\n  ]\n}",
+            "dataMode": "raw",
+            "version": 2,
+            "tests": "",
+            "time": 1401139810802,
+            "name": "Post Add Neutron Network",
+            "description": "Post a list of Neutron v2.0 Networks",
+            "collectionId": "bd9b142f-e3ad-452d-f088-eed1b741b937",
+            "responses": [],
+            "synced": false
+        },
+        {
+            "id": "56d38607-d1dc-adba-a3fd-7e4d63e6c75d",
+            "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+            "url": "http://127.0.0.1:8080/controller/nb/v2/neutron/security-group-rules/",
+            "pathVariables": {},
+            "method": "POST",
+            "data": "{\n   \"security_group_rule\":{\n      \"id\":\"A9F6424D-4D08-4819-BFC4-333333333333\",\n      \"direction\":\"ingress\",\n      \"port_range_min\":\"5000\",\n      \"ethertype\":\"IPv4\",\n      \"port_range_max\":\"6000\",\n      \"protocol\":\"tcp\",\n      \"remote_ip_prefix\":\"172.16.10.0/24\",\n      \"remote_group_id\":\"85cc3048-abc3-43cc-89b3-377341426ac5\",\n      \"security_group_id\":\"C9F5924D-4D08-4819-BFC4-444444444444\",\n      \"tenant_id\":\"3B82FF05-72A2-413E-B051-222222222222\"\n   }\n}\n",
+            "dataMode": "raw",
+            "name": "Post Add Security Rule Port Range",
+            "description": "Neutron v2.0 Add a Neutron Security Rule with a TCP Port Range.",
+            "descriptionFormat": "html",
+            "time": 1401138106104,
+            "version": 2,
+            "responses": [],
+            "tests": "",
+            "collectionId": "bd9b142f-e3ad-452d-f088-eed1b741b937",
+            "synced": false
+        },
+        {
+            "id": "747f9a54-e64f-57f6-ce6d-8ad358817696",
+            "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+            "url": "http://127.0.0.1:8080/controller/nb/v2/neutron/fw/firewalls",
+            "pathVariables": {},
+            "method": "POST",
+            "data": "{\n  \"firewall\": {\n    \"admin_state_up\": true,\n    \"description\": \"Example Neutron v2.0 Firewall Creation\",\n    \"firewall_policy_id\": \"c69933c1-b472-44f9-8226-30dc4ffd454c\",\n    \"id\": \"3b0ef8f4-82c7-44d4-a4fb-6177f9a21977\",\n    \"name\": \"Example FWaaS Firewall\",\n    \"status\": \"PENDING_CREATE\",\n    \"tenant_id\": \"45977fa2dbd7482098dd68d0d8970117\"\n  }\n}",
+            "dataMode": "raw",
+            "version": 2,
+            "tests": "",
+            "time": 1401140100321,
+            "name": "Post Add Neutron FWaaS Firewall",
+            "description": "Example posting of a Neutron v2.0 Neutron FWaaS firewall.",
+            "collectionId": "bd9b142f-e3ad-452d-f088-eed1b741b937",
+            "responses": [],
+            "synced": false
+        },
+        {
+            "id": "7ef5413c-7f22-ac12-5444-f9be6a7c029e",
+            "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+            "url": "http://127.0.0.1:8080/controller/nb/v2/neutron/fw/firewalls",
+            "pathVariables": {},
+            "method": "GET",
+            "data": [],
+            "dataMode": "params",
+            "version": 2,
+            "tests": "",
+            "time": 1401139224214,
+            "name": "Get Neutron FWaaS Firewalls",
+            "description": "Return a list of Neutron FWaaS v2.0 API FWaaS firewalls.",
+            "collectionId": "bd9b142f-e3ad-452d-f088-eed1b741b937",
+            "responses": [],
+            "synced": false
+        },
+        {
+            "id": "9fe0d840-dcd3-6d3e-d410-e88538858e3a",
+            "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+            "url": "http://127.0.0.1:8080/controller/nb/v2/neutron/security-group-rules/",
+            "pathVariables": {},
+            "method": "POST",
+            "data": "{\n   \"security_group_rule\":{\n      \"id\":\"A9F6424D-4D08-4819-BFC4-444444444444\",\n      \"direction\":\"ingress\",\n      \"port_range_min\":\"80\",\n      \"ethertype\":\"IPv4\",\n      \"port_range_max\":\"80\",\n      \"protocol\":\"tcp\",\n      \"remote_ip_prefix\":\"172.0.0.0/24\",\n      \"remote_group_id\":\"85cc3048-abc3-43cc-89b3-377341426ac5\",\n      \"security_group_id\":\"C9F5924D-4D08-4819-BFC4-111111111111\",\n      \"tenant_id\":\"3B82FF05-72A2-413E-B051-222222222222\"\n   }\n}\n",
+            "dataMode": "raw",
+            "version": 2,
+            "tests": "",
+            "time": 1401137905549,
+            "name": "Post Add Security Rules Frontend Tier",
+            "description": "Example Neutron v2.0 security rule for a front web tier.",
+            "collectionId": "bd9b142f-e3ad-452d-f088-eed1b741b937",
+            "responses": [],
+            "synced": false
+        },
+        {
+            "id": "a183a8b3-bddb-dc04-ae73-3beb11af4d04",
+            "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+            "url": "http://127.0.0.1:8080/controller/nb/v2/neutron/fw/firewalls_policies",
+            "pathVariables": {},
+            "method": "GET",
+            "data": [],
+            "dataMode": "params",
+            "version": 2,
+            "tests": "",
+            "time": 1397457663853,
+            "name": "Get Neutron FWaaS Policies",
+            "description": "Return a list of Neutron v2.0 Neutron FWaaS Firewall policies.",
+            "collectionId": "bd9b142f-e3ad-452d-f088-eed1b741b937",
+            "responses": [],
+            "synced": false
+        },
+        {
+            "id": "a1efd833-3d79-1621-9aa5-61b0fecec94a",
+            "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+            "url": "http://127.0.0.1:8080/controller/nb/v2/neutron/fw/firewalls_policies",
+            "pathVariables": {},
+            "method": "POST",
+            "data": "{\n  \"firewall_policies\": [\n    {\n      \"audited\": false,\n      \"description\": \"\",\n      \"firewall_rules\": [\n        \"8722e0e0-9cc9-4490-9660-8c9a5732fbb0\"\n      ],\n      \"id\": \"c69933c1-b472-44f9-8226-30dc4ffd454c\",\n      \"name\": \"Example FWaaS Policy\",\n      \"shared\": false,\n      \"tenant_id\": \"45977fa2dbd7482098dd68d0d8970117\"\n    }\n  ]\n}",
+            "dataMode": "raw",
+            "version": 2,
+            "tests": "",
+            "time": 1401139374457,
+            "name": "Post Add Neutron FWaaS Policy",
+            "description": "Example posting of a Neutron v2.0 FWaaS policy.",
+            "collectionId": "bd9b142f-e3ad-452d-f088-eed1b741b937",
+            "responses": [],
+            "synced": false
+        },
+        {
+            "id": "c9cc2212-1f16-ead6-5dc0-073aed1e2c61",
+            "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+            "url": "http://127.0.0.1:8080/controller/nb/v2/neutron/security-group-rules/",
+            "pathVariables": {},
+            "method": "POST",
+            "data": "{\n   \"security_group_rule\":{\n      \"id\":\"A9F6424D-4D08-4819-BFC4-333333333333\",\n      \"direction\":\"ingress\",\n      \"port_range_min\":\"3306\",\n      \"ethertype\":\"IPv4\",\n      \"port_range_max\":\"3306\",\n      \"protocol\":\"tcp\",\n      \"remote_ip_prefix\":\"10.0.0.0/24\",\n      \"remote_group_id\":\"85cc3048-abc3-43cc-89b3-377341426ac5\",\n      \"security_group_id\":\"C9F5924D-4D08-4819-BFC4-111111111111\",\n      \"tenant_id\":\"3B82FF05-72A2-413E-B051-222222222222\"\n   }\n}\n",
+            "dataMode": "raw",
+            "version": 2,
+            "tests": "",
+            "time": 1401137493078,
+            "name": "Post Add Security Rule Backend Tier",
+            "description": "Neutron v2.0 Add a Neutron Security Rule for a backend database tier example",
+            "collectionId": "bd9b142f-e3ad-452d-f088-eed1b741b937",
+            "responses": [],
+            "synced": false
+        },
+        {
+            "id": "ed8face9-6585-8a9b-9e09-870e3a5e5546",
+            "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+            "url": "http://127.0.0.1:8080/controller/nb/v2/neutron/fw/firewalls_rules",
+            "pathVariables": {},
+            "method": "POST",
+            "data": "{\n  \"firewall_rules\": [\n    {\n      \"action\": \"allow\",\n      \"description\": \"Example FWaaS Rule\",\n      \"destination_ip_address\": null,\n      \"destination_port\": \"22\",\n      \"enabled\": true,\n      \"firewall_policy_id\": \"c69933c1-b472-44f9-8226-30dc4ffd454c\",\n      \"id\": \"8722e0e0-9cc9-4490-9660-8c9a5732fbb0\",\n      \"ip_version\": 4,\n      \"name\": \"ALLOW_SSH\",\n      \"position\": 1,\n      \"protocol\": \"tcp\",\n      \"shared\": false,\n      \"source_ip_address\": null,\n      \"source_port\": null,\n      \"tenant_id\": \"45977fa2dbd7482098dd68d0d8970117\"\n    }\n  ]\n}",
+            "dataMode": "raw",
+            "version": 2,
+            "tests": "",
+            "time": 1401139588833,
+            "name": "Post Add Neutron FWaaS Rule",
+            "description": "Example posting of a Neutron v2.0 Neutron FWaaS firewall rule.",
+            "collectionId": "bd9b142f-e3ad-452d-f088-eed1b741b937",
+            "responses": [],
+            "synced": false
+        },
+        {
+            "id": "ef3c7339-ba4d-124d-7e1f-67d9ab638277",
+            "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+            "url": "http://127.0.0.1:8080/controller/nb/v2/neutron/ports/",
+            "pathVariables": {},
+            "method": "GET",
+            "data": [],
+            "dataMode": "params",
+            "version": 2,
+            "tests": "",
+            "time": 1401139136358,
+            "name": "Get Neutron Ports",
+            "description": "Return a list of Neutron v2.0 API ports.",
+            "collectionId": "bd9b142f-e3ad-452d-f088-eed1b741b937",
+            "responses": [],
+            "synced": false
+        },
+        {
+            "id": "f01b7f99-0aeb-739f-eb4a-cd467320b85c",
+            "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+            "url": "http://127.0.0.1:8080/controller/nb/v2/neutron/security-group-rules/",
+            "pathVariables": {},
+            "method": "GET",
+            "data": [],
+            "dataMode": "params",
+            "version": 2,
+            "tests": "",
+            "time": 1401139648839,
+            "name": "Get Neutron Security Rules",
+            "description": "Return a list of Neutron v2.0 security rules.",
+            "collectionId": "bd9b142f-e3ad-452d-f088-eed1b741b937",
+            "responses": [],
+            "synced": false
+        },
+        {
+            "id": "f9de4b7d-8b08-fb14-d557-3cf81d7465f4",
+            "headers": "Authorization: Basic YWRtaW46YWRtaW4=\nAccept: application/json\nContent-Type: application/json\n",
+            "url": "http://127.0.0.1:8080/controller/nb/v2/neutron/security-groups/",
+            "pathVariables": {},
+            "method": "POST",
+            "data": "{\n   \"security_group\":{\n      \"name\":\"backend_databases\",\n      \"description\":\"Example security group for backend_databases\",\n     \"tenant_id\":\"3B82FF05-72A2-413E-B051-222222222222\",\n     \"id\":\"C9F5924D-4D08-4819-BFC4-111111111111\"\n   }\n}",
+            "dataMode": "raw",
+            "version": 2,
+            "tests": "",
+            "time": 1401136080941,
+            "name": "Post Add Security Group Web Tiers",
+            "description": "Neutron v2.0 Add a web tier security group",
+            "collectionId": "bd9b142f-e3ad-452d-f088-eed1b741b937",
+            "responses": [],
+            "synced": false
+        }
+    ]
+}
\ No newline at end of file
index 10c0f3e529117aba4ae3fc18e8b4d83019206616..d2fa6ceecba2e287ea173ff46bb26d9140740877 100644 (file)
@@ -16,3 +16,13 @@ Contents
 3. local.conf.compute : A sample development local.conf used on the devstack Compute node with Neutron ML2 mechanism driver for OpenDaylight.  
 
 4. DevStack.json.postman_collection : Relevant POSTMAN OpenDaylight REST-APIs that can be used for testing Openstack / Devstack deployments.
+
+5. dsconf.sh : Menu-driven script to create a local.conf, based on DevStack node configuration/need
+
+6. sethostname.sh : script to set the hostname (/etc/hosts, /etc/hostname, and "hostname" command)
+
+7. bootvm.sh : script to boot a VM from DevStack controller (requires . ./openrc admin admin)
+
+8. pingvm.sh : script to ping a VM from DevStack controller (requires . ./openrc admin admin)
+
+9. make-vxlan-net.sh : script to create a Neutron network and subnet using VXLAN tunnels (requires . ./openrc admin admin)
diff --git a/resources/openstack/bootvm.sh b/resources/openstack/bootvm.sh
new file mode 100755 (executable)
index 0000000..526ee8a
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/sh
+#
+# Copyright (C) 2013 Cisco Systems, Inc.
+#
+# This program and the accompanying materials are made available under the
+# terms of the Eclipse Public License v1.0 which accompanies this distribution,
+# and is available at http://www.eclipse.org/legal/epl-v10.html
+#
+# Authors : Thomas Bachman
+
+#
+# Script for booting VMs onto networks
+#
+
+#defaults
+vm=`hostname`
+net=private
+image=cirros-0.3.1-x86_64-uec
+
+nova hypervisor-list
+echo -n "Enter the hypervisor name to use for new instance [$vm]: "
+read -a entry
+if [ "$entry" != "" ]; then
+    vm=$entry
+fi
+
+neutron net-list
+echo -n "Enter the name of the network to use for the VM [$net]: "
+read -a entry
+if [ "$entry" != "" ]; then
+    net=$entry
+fi
+
+nova image-list
+echo -n "Enter the name of the image to use for the VM [$image]: "
+read -a entry
+if [ "$entry" != "" ]; then
+    image=$entry
+fi
+
+nova boot --flavor m1.tiny --image $(nova image-list | grep "$image\s" | awk '{print $2}') --nic net-id=$(neutron net-list | grep $net | awk '{print $2}') admin-private --availability_zone=nova:$vm
diff --git a/resources/openstack/dsconf.sh b/resources/openstack/dsconf.sh
new file mode 100755 (executable)
index 0000000..b85bab1
--- /dev/null
@@ -0,0 +1,368 @@
+#!/bin/sh
+#
+# Copyright (C) 2013 Cisco Systems, Inc.
+#
+# This program and the accompanying materials are made available under the
+# terms of the Eclipse Public License v1.0 which accompanies this distribution,
+# and is available at http://www.eclipse.org/legal/epl-v10.html
+#
+# Authors : Thomas Bachman
+
+#
+# Generate the local.conf, based on this machine's settings,
+# and user input
+#
+
+odl_ip=""
+odl_in_ds="y"
+vm_personality="ODC"
+active_ifs=""
+service_host=""
+service_host_name=""
+odl_mgr_ip=""
+host_ip=""
+host_name=`hostname`
+host_list=""
+
+# Minimum memory requirements, in kB
+od_mem=50000000
+oc_mem=3000000
+o_mem=2000000
+odoc_mem=5000000
+oco_mem=3000000
+
+
+
+#
+# personality-dependent services
+#
+ds_common_services="qpid neutron odl-compute n-cpu"
+ds_compute_services="nova n-novnc"
+ds_controller_services="n-cond q-svc q-dhcp q-l3 q-meta tempest"
+
+#
+# everyone gets these services
+#
+services=$ds_common_services
+
+#
+# services that are disabled
+#
+disabled_services="rabbit n-net"
+
+header='''
+LOGFILE=stack.sh.log\n
+#SCREEN_LOGDIR=/opt/stack/data/log\n
+#LOG_COLOR=False\n
+OFFLINE=True\n
+#RECLONE=yes\n
+\n
+'''
+
+#
+# single quoted to prevent variable substitutions
+#
+# add host info
+
+footer='''
+Q_HOST=$SERVICE_HOST\n
+Q_PLUGIN=ml2\n
+Q_ML2_PLUGIN_MECHANISM_DRIVERS=opendaylight,logger\n
+ENABLE_TENANT_TUNNELS=True\n
+ODL_BOOT_WAIT=70\n
+\n
+VNCSERVER_PROXYCLIENT_ADDRESS=${HOST_IP}\n
+VNCSERVER_LISTEN=0.0.0.0\n
+\n
+#FLOATING_RANGE=192.168.210.0/24\n
+#PUBLIC_NETWORK_GATEWAY=192.168.75.254\n
+MYSQL_HOST=$SERVICE_HOST\n
+RABBIT_HOST=$SERVICE_HOST\n
+GLANCE_HOSTPORT=$SERVICE_HOST:9292\n
+KEYSTONE_AUTH_HOST=$SERVICE_HOST\n
+KEYSTONE_SERVICE_HOST=$SERVICE_HOST\n
+\n
+MYSQL_PASSWORD=mysql\n
+RABBIT_PASSWORD=rabbit\n
+QPID_PASSWORD=rabbit\n
+SERVICE_TOKEN=service\n
+SERVICE_PASSWORD=admin\n
+ADMIN_PASSWORD=admin\n
+\n
+[[post-config|/etc/neutron/plugins/ml2/ml2_conf.ini]]\n
+[agent]\n
+minimize_polling=True\n
+'''
+
+#
+# Create a list of active network interfaces
+#
+get_active_ifs()
+{
+   all_ifs=`egrep 'ONBOOT' /etc/sysconfig/network-scripts/ifcfg-*`
+   for interface in $all_ifs
+   do
+       active=`echo $interface | awk 'BEGIN {FS="="} {print $2}'`
+       if [ "$active" == "yes" ]; then
+           file=`echo $interface | awk 'BEGIN {FS=":"} {print $1}'`
+           intf=`basename $file | awk 'BEGIN {FS="-"} {print $2}'`
+           active_ifs=`echo "$active_ifs $intf"`
+       fi
+   done
+}
+
+#
+# Have the user select the IP address to use
+#
+select_host_ip()
+{
+    get_active_ifs
+    echo "Your system has the following IP addresses: "
+    count=0
+    if_index="0"
+    for interface in $active_ifs
+    do
+        if [ "$interface" == "lo" ]; then
+            continue;
+        fi
+        exists=`ifconfig | grep $interface`
+        if [ "$exists" == "" ]; then
+            continue;
+        fi
+        ip=`ifconfig $interface | grep 'inet ' | awk 'BEGIN {FS=" "} {print $2}'`
+        echo "    [$count] $interface: $ip"
+        let "count+=1";
+    done
+
+    entry=$if_index
+    if [ $count == 0 ]; then
+        echo "No active interfaces: please reconfigure /etc/sysconfig/network-scripts/ifcfg-<interface> and re-run"
+        exit
+    elif [ $count > 1 ]; then
+        echo -n "Select which interface to use [$entry]: "
+        read -a entry
+        if [ "$entry" > "$count" ]; then
+            let "maxcnt=count-1"
+            echo "Invalid entry, must be less than $maxcnt"
+            exit
+        elif [ "$entry" == "" ]; then
+            entry=$if_index
+        else
+            $if_index=$entry
+        fi
+    fi
+
+    count=0
+    for interface in $active_ifs
+    do
+        if [ $count == $if_index ]; then
+            #echo "foo"
+            host_ip=`ifconfig $interface | grep 'inet ' | awk 'BEGIN {FS=" "} {print $2}'`
+            break;
+        fi
+        let "count+=1"
+    done
+}
+
+#
+#  Verify the memory is sufficient for the configuration
+#
+check_mem()
+{
+    memory=`cat /proc/meminfo  | grep MemTotal | awk 'BEGIN {FS=" "} {print $2}'`
+    if [ "$vm_personality" == "O" ]; then
+        mem_needed=$od_mem
+    elif [ "$vm_personality" == "DC" ]; then
+        mem_needed=$oc_mem
+    elif [ "$vm_personality" == "D" ]; then
+        mem_needed=$o_mem
+    elif [ "$vm_personality" == "ODC" ]; then
+        mem_needed=$odoc_mem
+    elif [ "$vm_personality" == "DCD" ]; then
+        mem_needed=$oco_mem
+    fi
+    if [ "$memory" -lt "$mem_needed" ]; then
+        echo """
+             $vm_personality configurations require at least $mem_needed (have $memory).
+             Please shutdown the VM and reconfigure its memory
+             """
+        exit
+    fi
+}
+
+echo """
+   This script configures the local.conf for the
+   VM, based on the desired configuration.  The
+   VM can take on any of the following roles:
+
+       O:    OpenDaylight Controller.
+               In this role, the VM is only responsible
+               for running the OpenDaylight Controller
+
+       DC:   DevStack Controller.
+               In this role, the VM is only responsible
+               for running the DevStack controller.
+
+       D:    DevStack Compute. In this role,
+               the VM is only responsible for
+               running the DevStack compute.
+
+       ODC:  OpenDaylight Controller with DevStack Controller.
+               In this role, the VM runs both the OpenDaylight
+               controller and the DevStack controller. The
+               OpenDaylight controller is launched by DevStack.
+
+       DCD:  DevStack Controller with DevStack Compute.
+               In this role, the VM acts as both an DevStack
+               controller and compute node.
+"""
+
+echo -n "Enter VM's personality [$vm_personality]: "
+read -a entry
+if [ "$entry" == "" ]; then
+    entry=$vm_personality
+else
+    vm_personality=$entry
+fi
+if [ "$vm_personality" != "O" ] &&
+   [ "$vm_personality" != "DC" ] &&
+   [ "$vm_personality" != "D" ]  &&
+   [ "$vm_personality" != "ODC" ]  &&
+   [ "$vm_personality" != "DCD" ]; then
+    echo "$vm_personality is invalid"
+    exit;
+fi
+
+# For all nodes, run the memory check to make
+# sure they've allocated enough memory to
+# run the system.
+check_mem
+
+# Get the right IP
+select_host_ip
+
+service_host=$host_ip
+service_host_name=$host_name
+
+# For a combined ODL/DS coontroller, we still need
+# to add in the services
+if [ "$vm_personality" == "ODC" ]; then
+   services="$services $ds_controller_services odl-server"
+fi
+
+# For all pure DS nodes (no ODL -- DS controller, compute, or both),
+# we need to point it to the ODL Controller
+if [ "$vm_personality" == "D" ] ||
+   [ "$vm_personality" == "DC" ] ||
+   [ "$vm_personality" == "DCD" ]; then
+   if [ "$vm_personality" == "D" ]; then
+      services="$services $ds_compute_services"
+   else
+      services="$services $ds_controller_services"
+   fi
+   service_host=$host_ip
+   service_host_name=$host_name
+   echo """
+           DevStack nodes need to point to the OpenDaylight Controller.
+           Please provide the IP address of the OpenDaylight Controller.
+        """
+   echo -n "OpenDaylight Controller IP: "
+   read -a odl_ip
+fi
+
+
+#
+# For DS Compute Only, we need to point it to
+# the DS Controller and update the DS services
+if [ "$vm_personality" == "D" ]; then
+   services="$services $ds_compute_services"
+   echo """
+           DevStack Compute nodes need to point to the DevStack
+           Controller. Please provide the IP address and hostname
+           of the DevStack Controller
+        """
+   echo -n "DevStack Controller IP: "
+   read -a service_host
+   echo -n "DevStack Controller hostname: "
+   read -a service_host_name
+   if [ "$service_host_name" == "$host_name" ]; then
+       echo """
+               Note: You have configured the DevStack controller's
+                     with the same name as this host. If this host
+                     requires a name change, run the set_hostname.sh
+                     script before running this one.
+            """
+   fi
+   echo """
+           DevStack Compute nodes also need to point to the
+           OpenDaylight Controller. Please provide the IP address
+           of the OpenDaylight Controller
+        """
+
+   # for DS compute, keep track of service host
+   host_list=$service_host_name
+fi
+
+######
+# Generate local.conf, using parameters
+######
+echo "[[local|localrc]]" > local.conf
+
+#
+#  Header
+#
+echo -e $header | while read -r line
+do
+    echo -e $line >> local.conf
+done
+
+#
+# Services
+#
+# disable all services for compute only nodes
+if [ "$vm_personality" == "D" ]; then
+   echo "disable_all_services" >> local.conf
+fi
+
+for line in $disabled_services
+do
+   echo "disable_service $line" >> local.conf
+done
+
+for line in $services
+do
+   echo -e "enable_service $line" >> local.conf
+done
+echo -e "\n" >> local.conf
+
+
+
+#
+# Add in VM-specific parameters
+#
+echo "HOST_IP=$host_ip" >> local.conf
+echo "HOST_NAME=$host_name" >> local.conf
+echo "SERVICE_HOST=$service_host" >> local.conf
+echo "SERVICE_HOST_NAME=$service_host_name" >> local.conf
+if [ "$vm_personality" != "O" ] &&
+   [ "$vm_personality" != "ODC" ]; then
+    echo "ODL_MGR_IP=$odl_ip" >> local.conf
+fi
+
+
+#
+# Footer
+#
+echo -e $footer | while read -r line
+do
+    echo -e $line >> local.conf
+done
+
+
+if [ "$host_list" != "" ]; then
+    echo "*********************************************************"
+    echo "===========>>>> Be sure to add $host_list to /etc/hosts!"
+    echo "*********************************************************"
+fi
+
+
diff --git a/resources/openstack/make-vxlan-net.sh b/resources/openstack/make-vxlan-net.sh
new file mode 100755 (executable)
index 0000000..f4cdc6f
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+#
+# Copyright (C) 2013 Cisco Systems, Inc.
+#
+# This program and the accompanying materials are made available under the
+# terms of the Eclipse Public License v1.0 which accompanies this distribution,
+# and is available at http://www.eclipse.org/legal/epl-v10.html
+#
+# Authors : Thomas Bachman
+
+#
+# Create a neutron network and subnet for VXLAN (hard-coded)
+#
+
+neutron net-create vxlan-net --tenant_id  $(keystone tenant-list | grep '\sadmin' | awk '{print $2}') --provider:network_type vxlan --provider:segmentation_id 1300
+neutron  subnet-create vxlan-net 10.100.1.0/24 --name vxlan-net
diff --git a/resources/openstack/pingvm.sh b/resources/openstack/pingvm.sh
new file mode 100755 (executable)
index 0000000..c9fdacd
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+#
+# Copyright (C) 2013 Cisco Systems, Inc.
+#
+# This program and the accompanying materials are made available under the
+# terms of the Eclipse Public License v1.0 which accompanies this distribution,
+# and is available at http://www.eclipse.org/legal/epl-v10.html
+#
+# Authors : Thomas Bachman
+
+
+#
+# Ping an instance created by DevStack
+#
+
+# get the prefix
+ip=$1
+uuid=`neutron net-list | grep $(echo $ip | awk 'BEGIN {FS="."} {print $1 "." $2 "." $3}') | awk '{print $2}'`
+dhcp_server="qdhcp-$uuid"
+foo="ip netns exec $dhcp_server ping $ip"
+sudo $foo
diff --git a/resources/openstack/sethostname.sh b/resources/openstack/sethostname.sh
new file mode 100755 (executable)
index 0000000..db1c54c
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/bash
+#
+# Copyright (C) 2013 Cisco Systems, Inc.
+#
+# This program and the accompanying materials are made available under the
+# terms of the Eclipse Public License v1.0 which accompanies this distribution,
+# and is available at http://www.eclipse.org/legal/epl-v10.html
+#
+# Authors : Thomas Bachman
+
+#
+#  Set the hostname
+#
+currname=`cat /etc/hostname`
+echo "Current hostname: $currname"
+
+echo -n "Enter new hostname: "
+read -a newname
+
+#
+# Update /etc/hosts & /etc/hostname with new hostname
+#
+if [ "$newname" != "$currname" ]; then
+    res=`sed -i "s/$currname/$newname/g" /etc/hosts`
+    if [ $? -ne 0 ]; then
+        echo "failed to update /etc/hosts"
+    fi
+    res=`sed -i "s/$currname/$newname/g" /etc/hostname`
+    if [ $? -ne 0 ]; then
+        echo "failed to update /etc/hostname"
+    fi
+    res=`hostname $newname`
+    if [ $? -ne 0 ]; then
+        echo "failed to update hostname"
+    else
+        echo "Your new hostname is $newname"
+    fi
+else
+    echo "hostname already set to $newname"
+fi
diff --git a/resources/puppet/hiera.yaml b/resources/puppet/hiera.yaml
new file mode 100644 (file)
index 0000000..8e2f646
--- /dev/null
@@ -0,0 +1,10 @@
+---
+:backends:
+  - yaml
+  - json
+:yaml:
+  :datadir: /vagrant/resources/puppet/hieradata
+:json:
+  :datadir: /vagrant/resources/puppet/hieradata
+:hierarchy:
+  - hosts
diff --git a/resources/puppet/hieradata/hosts.json b/resources/puppet/hieradata/hosts.json
new file mode 100644 (file)
index 0000000..74ef641
--- /dev/null
@@ -0,0 +1,20 @@
+{
+  "hosts": {
+    "opendaylight": {
+      "name": "opendaylight",
+      "ipaddress": "192.168.50.1"
+    },
+    "mininet": {
+      "name": "mininet",
+      "ipaddress": "192.168.50.15"
+    },
+    "devstack-control": {
+      "name": "devstack-control",
+      "ipaddress": "192.168.50.20"
+    },
+    "devstack-compute": {
+      "name": "devstack-compute",
+      "ipaddress": "192.168.50.21"
+    }
+  }
+}
diff --git a/resources/puppet/manifests/base.pp b/resources/puppet/manifests/base.pp
new file mode 100644 (file)
index 0000000..3f095f2
--- /dev/null
@@ -0,0 +1,12 @@
+package {"git":
+    ensure => "installed"
+}
+
+$hosts = hiera('hosts')
+
+file { "/etc/hosts":
+    ensure => file,
+    owner => "root",
+    group => "root",
+    content => template('/vagrant/resources/puppet/templates/hosts.erb')
+}
diff --git a/resources/puppet/manifests/devstack-compute.pp b/resources/puppet/manifests/devstack-compute.pp
new file mode 100644 (file)
index 0000000..96cb1c2
--- /dev/null
@@ -0,0 +1,16 @@
+vcsrepo { "/home/vagrant/devstack":
+    provider => git,
+    ensure => present,
+    user => "vagrant",
+    source => "https://github.com/openstack-dev/devstack.git",
+    before => File['/home/vagrant/devstack/local.conf']
+}
+
+$hosts = hiera('hosts')
+
+file { "/home/vagrant/devstack/local.conf":
+    ensure => present,
+    owner => "vagrant",
+    group => "vagrant",
+    content => template('/vagrant/resources/puppet/templates/compute.local.conf.erb')
+}
diff --git a/resources/puppet/manifests/devstack-control.pp b/resources/puppet/manifests/devstack-control.pp
new file mode 100644 (file)
index 0000000..0c35e4f
--- /dev/null
@@ -0,0 +1,16 @@
+vcsrepo { "/home/vagrant/devstack":
+    provider => git,
+    ensure => present,
+    user => "vagrant",
+    source => "https://github.com/openstack-dev/devstack.git",
+    before => File['/home/vagrant/devstack/local.conf']
+}
+
+$hosts = hiera('hosts')
+
+file { "/home/vagrant/devstack/local.conf":
+    ensure => present,
+    owner => "vagrant",
+    group => "vagrant",
+    content => template('/vagrant/resources/puppet/templates/control.local.conf.erb')
+}
diff --git a/resources/puppet/manifests/mininet.pp b/resources/puppet/manifests/mininet.pp
new file mode 100644 (file)
index 0000000..98ae327
--- /dev/null
@@ -0,0 +1,15 @@
+vcsrepo { "/home/vagrant/mininet":
+    provider => git,
+    ensure => present,
+    user => "vagrant",
+    source => "git://github.com/mininet/mininet",
+    revision => '2.1.0p1',
+    before => Exec['Install Mininet']
+}
+
+exec { "Install Mininet":
+    command => "/bin/bash mininet/util/install.sh -nfv > /dev/null",
+    cwd => '/home/vagrant',
+    user => 'vagrant',
+    timeout => 0
+}
diff --git a/resources/puppet/scripts/bootstrap.sh b/resources/puppet/scripts/bootstrap.sh
new file mode 100644 (file)
index 0000000..6895b7d
--- /dev/null
@@ -0,0 +1,56 @@
+#!/usr/bin/env bash
+#
+# This bootstraps Puppet on Ubuntu 12.04 LTS.
+#
+set -e
+
+# Load up the release information
+. /etc/lsb-release
+
+REPO_DEB_URL="http://apt.puppetlabs.com/puppetlabs-release-${DISTRIB_CODENAME}.deb"
+
+#--------------------------------------------------------------------
+# NO TUNABLES BELOW THIS POINT
+#--------------------------------------------------------------------
+if [ "$(id -u)" != "0" ]; then
+      echo "This script must be run as root." >&2
+        exit 1
+    fi
+
+    if which puppet > /dev/null 2>&1; then
+          echo "Puppet is already installed."
+            exit 0
+    fi
+
+    # Do the initial apt-get update
+    echo "Initial apt-get update..."
+    apt-get update >/dev/null
+
+    # Install wget if we have to (some older Ubuntu versions)
+    echo "Installing wget..."
+    apt-get install -y wget >/dev/null
+
+    # Install the PuppetLabs repo
+    echo "Configuring PuppetLabs repo..."
+    repo_deb_path=$(mktemp)
+    wget --output-document="${repo_deb_path}" "${REPO_DEB_URL}" 2>/dev/null
+    dpkg -i "${repo_deb_path}" >/dev/null
+    apt-get update >/dev/null
+
+    # Install Puppet
+    echo "Installing Puppet..."
+    apt-get install -y puppet >/dev/null
+
+    echo "Puppet installed!"
+
+    # Install RubyGems for the provider
+    echo "Installing RubyGems..."
+    apt-get install -y rubygems >/dev/null
+    gem install --no-ri --no-rdoc rubygems-update
+    update_rubygems >/dev/null
+
+    # Installing Puppet Modules
+    puppet module install puppetlabs/vcsrepo
+    puppet module install puppetlabs/stdlib
+
+
diff --git a/resources/puppet/templates/compute.local.conf.erb b/resources/puppet/templates/compute.local.conf.erb
new file mode 100644 (file)
index 0000000..0619f2c
--- /dev/null
@@ -0,0 +1,55 @@
+[[local|localrc]]
+SCREEN_LOGDIR=/opt/stack/log
+LOGFILE=stack.sh.log
+LOG_COLOR=False
+#OFFLINE=True
+#RECLONE=yes
+
+HOST_IP=<%= @hosts['devstack-compute']['ipaddress'] %>
+HOST_NAME=<%= @hosts['devstack-compute']['name'] %>
+SERVICE_HOST=<%= @hosts['devstack-control']['name'] %>
+SERVICE_HOST_NAME=<%= @hosts['devstack-control']['name'] %>
+
+Q_HOST=$SERVICE_HOST
+MYSQL_HOST=$SERVICE_HOST
+RABBIT_HOST=$SERVICE_HOST
+GLANCE_HOSTPORT=$SERVICE_HOST:9292
+KEYSTONE_AUTH_HOST=$SERVICE_HOST
+KEYSTONE_SERVICE_HOST=$SERVICE_HOST
+
+MYSQL_PASSWORD=mysql
+RABBIT_PASSWORD=rabbit
+QPID_PASSWORD=rabbit
+SERVICE_TOKEN=service
+SERVICE_PASSWORD=admin
+ADMIN_PASSWORD=admin
+
+VNCSERVER_PROXYCLIENT_ADDRESS=$HOST_IP
+VNCSERVER_LISTEN=0.0.0.0
+
+disable_all_services
+enable_service neutron quantum nova n-cpu n-novnc rabbit odl-compute
+
+# ODL WITH ML2
+Q_PLUGIN=ml2
+Q_ML2_PLUGIN_MECHANISM_DRIVERS=opendaylight,logger
+ODL_MGR_IP=<%= @hosts['opendaylight']['ipaddress'] %>
+
+ENABLE_TENANT_TUNNELS=True
+# Q_ML2_TENANT_NETWORK_TYPE=vlan
+# ENABLE_TENANT_VLANS=True
+Q_ML2_TENANT_NETWORK_TYPE=vxlan
+#Q_AGENT_EXTRA_AGENT_OPTS=(tunnel_types=vxlan)
+
+#FLOATING_RANGE=192.168.254.64/26
+
+EXTRA_OPTS=(scheduler_default_filters=AllHostsFilter)
+
+[[post-config|/etc/neutron/plugins/ml2/ml2_conf.ini]]
+[agent]
+minimize_polling=True
+
+[ml2_odl]
+url=http://<%= @hosts['opendaylight']['ipaddress'] %>:8080/controller/nb/v2/neutron
+username=admin
+password=admin
diff --git a/resources/puppet/templates/control.local.conf.erb b/resources/puppet/templates/control.local.conf.erb
new file mode 100644 (file)
index 0000000..563d5a9
--- /dev/null
@@ -0,0 +1,64 @@
+[[local|localrc]]
+SCREEN_LOGDIR=/opt/stack/log
+LOGFILE=stack.sh.log
+LOG_COLOR=False
+#OFFLINE=True
+RECLONE=yes
+
+HOST_IP=<%= @hosts['devstack-control']['ipaddress'] %>
+HOST_NAME=<%= @hosts['devstack-control']['name'] %>
+SERVICE_HOST=$HOST_IP
+SERVICE_HOST_NAME=$HOST_NAME
+
+Q_HOST=$SERVICE_HOST
+MYSQL_HOST=$SERVICE_HOST
+RABBIT_HOST=$SERVICE_HOST
+GLANCE_HOSTPORT=$SERVICE_HOST:9292
+KEYSTONE_AUTH_HOST=$SERVICE_HOST
+KEYSTONE_SERVICE_HOST=$SERVICE_HOST
+
+MYSQL_PASSWORD=mysql
+RABBIT_PASSWORD=rabbit
+QPID_PASSWORD=rabbit
+SERVICE_TOKEN=service
+SERVICE_PASSWORD=admin
+ADMIN_PASSWORD=admin
+
+enable_service rabbit
+disable_service qpid
+
+enable_service n-cond
+enable_service n-cpu
+enable_service n-novnc
+disable_service n-net
+enable_service q-svc
+# enable_service q-agt
+enable_service q-dhcp
+enable_service q-l3
+enable_service q-meta
+enable_service quantum
+enable_service odl-compute
+
+# ODL WITH ML2
+Q_PLUGIN=ml2
+Q_ML2_PLUGIN_MECHANISM_DRIVERS=opendaylight,logger
+ODL_MGR_IP=<%= @hosts['opendaylight']['ipaddress'] %>
+
+ENABLE_TENANT_TUNNELS=True
+# ENABLE_TENANT_VLANS=True
+# TENANT_VLAN_RANGE=500:510
+
+Q_ML2_TENANT_NETWORK_TYPE=vxlan
+# Q_AGENT_EXTRA_AGENT_OPTS=(tunnel_types=vxlan)
+
+#FLOATING_RANGE=192.168.254.64/26
+#PUBLIC_NETWORK_GATEWAY=192.168.75.254
+
+[[post-config|/etc/neutron/plugins/ml2/ml2_conf.ini]]
+[agent]
+minimize_polling=True
+
+[ml2_odl]
+url=http://<%= @hosts['opendaylight']['ipaddress'] %>:8080/controller/nb/v2/neutron
+username=admin
+password=admin
diff --git a/resources/puppet/templates/hosts.erb b/resources/puppet/templates/hosts.erb
new file mode 100644 (file)
index 0000000..c23f40f
--- /dev/null
@@ -0,0 +1,8 @@
+## Do Not Edit. Created by Puppet ##
+127.0.0.1   localhost
+255.255.255.255 broadcasthost
+::1             localhost
+fe80::1%lo0 localhost
+<% @hosts.values.each do |h| %>
+<%= h["ipaddress"] %>  <%= h["name"] %>
+<% end %>