Add netvirt integration tests 27/20427/1
authorSam Hague <shague@redhat.com>
Thu, 14 May 2015 19:23:29 +0000 (15:23 -0400)
committerSam Hague <shague@redhat.com>
Thu, 14 May 2015 19:23:29 +0000 (15:23 -0400)
Change-Id: I3fb27e0bbfb41251859a8eda3ee90aff1cb27645
Signed-off-by: Sam Hague <shague@redhat.com>
openstack/net-virt-it/pom.xml [moved from openstack/netvirt-it/pom.xml with 73% similarity]
openstack/net-virt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/AbstractConfigTestBase.java [moved from openstack/netvirt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/AbstractConfigTestBase.java with 86% similarity]
openstack/net-virt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/AbstractMdsalTestBase.java [moved from openstack/netvirt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/AbstractMdsalTestBase.java with 93% similarity]
openstack/net-virt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/MdsalUtils.java [moved from openstack/netvirt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/MdsalUtils.java with 98% similarity]
openstack/net-virt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/NetvirtIT.java [new file with mode: 0644]
openstack/net-virt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/NetvirtITConstants.java [moved from openstack/netvirt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/SouthboundITConstants.java with 87% similarity]
openstack/net-virt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/SouthboundConstants.java [new file with mode: 0755]
openstack/net-virt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/SouthboundMapper.java [new file with mode: 0644]
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/MdsalUtils.java
openstack/netvirt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/SouthboundIT.java [deleted file]
openstack/pom.xml

similarity index 73%
rename from openstack/netvirt-it/pom.xml
rename to openstack/net-virt-it/pom.xml
index 5b1c49eac61d372ab2926efcda14369e11692a05..bd678fce79b7f0a1e21d2212397ad32061c1e026 100644 (file)
@@ -16,18 +16,35 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <groupId>org.opendaylight.ovsdb</groupId>
-  <artifactId>netvirt-it</artifactId>
+  <artifactId>openstack.net-virt-it</artifactId>
   <version>1.1.0-SNAPSHOT</version>
   <packaging>jar</packaging>
+  <description>The OVSDB Plugin integration project is a project for OpenDaylight that will implement the Open vSwitch Database RFC 7047 management protocol allowing the Southbound configuration of vSwitches and a network virtualization implementation.</description>
+  <url>https://wiki.opendaylight.org/view/OVSDB_Integration:Main</url>
+  <licenses>
+    <license>
+      <name>Eclipse Public License v1.0</name>
+      <url>http://www.eclipse.org/legal/epl-v10.html</url>
+    </license>
+  </licenses>
+  <developers>
+    <developer>
+      <name>Sam Hague</name>
+      <email>shague@gmail.com</email>
+      <url>https://github.com/shague</url>
+    </developer>
+  </developers>
+  <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>
+  <properties>
+    <skip.integrationtest>true</skip.integrationtest>
+  </properties>
   <dependencyManagement>
     <dependencies>
-      <dependency>
-        <groupId>${project.groupId}</groupId>
-        <artifactId>openstack.net-virt</artifactId>
-        <version>${project.version}</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>config-artifacts</artifactId>
@@ -53,13 +70,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal-common-api</artifactId>
     </dependency>
-    <dependency>
-      <groupId>${project.groupId}</groupId>
-      <artifactId>features-ovsdb</artifactId>
-      <version>1.1.0-SNAPSHOT</version>
-      <classifier>features</classifier>
-      <type>xml</type>
-    </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>config-util</artifactId>
@@ -108,13 +118,15 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
       <scope>compile</scope>
     </dependency>
     <dependency>
-      <groupId>org.apache.karaf.tooling</groupId>
-      <artifactId>karaf-maven-plugin</artifactId>
-      <version>${karaf.version}</version>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-simple</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>${project.groupId}</groupId>
+      <groupId>org.opendaylight.ovsdb</groupId>
       <artifactId>openstack.net-virt</artifactId>
+      <version>1.1.0-SNAPSHOT</version>
+      <scope>test</scope>
     </dependency>
   </dependencies>
   <build>
@@ -128,6 +140,10 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
               <goal>integration-test</goal>
               <goal>verify</goal>
             </goals>
+            <configuration>
+              <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
+              <skipTests>${skip.integrationtest}</skipTests>
+            </configuration>
           </execution>
         </executions>
       </plugin>
@@ -145,7 +161,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
           </execution>
         </executions>
       </plugin>
-      <plugin>
+      <!--<plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-checkstyle-plugin</artifactId>
         <configuration>
@@ -157,11 +173,22 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
           <includes>**/*.java,**/*.xml,**/*.ini,**/*.sh,**/*.bat</includes>
           <excludes>**/yang/</excludes>
         </configuration>
-      </plugin>
+      </plugin>-->
       <plugin>
         <groupId>org.jacoco</groupId>
         <artifactId>jacoco-maven-plugin</artifactId>
       </plugin>
     </plugins>
   </build>
+  <profiles>
+    <profile>
+      <id>integrationtest</id>
+      <activation>
+        <activeByDefault>false</activeByDefault>
+      </activation>
+      <properties>
+        <skip.integrationtest>false</skip.integrationtest>
+      </properties>
+    </profile>
+  </profiles>
 </project>
similarity index 86%
rename from openstack/netvirt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/AbstractConfigTestBase.java
rename to openstack/net-virt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/AbstractConfigTestBase.java
index 69a23ea4a16fdbfc6edf340d9a1fc0b2f9522372..7de8780fbd9ba58975ccfbab70b019a282866e23 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (C) 2015 Red Hat, Inc. and others
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -9,18 +9,14 @@ package org.opendaylight.ovsdb.openstack.netvirt.it;
 
 import static org.ops4j.pax.exam.CoreOptions.maven;
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.karafDistributionConfiguration;
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.keepRuntimeFolder;
 
 import com.google.common.collect.ObjectArrays;
-
 import java.io.File;
 import java.lang.management.ManagementFactory;
 import java.util.Calendar;
-
 import javax.management.InstanceNotFoundException;
-
 import org.junit.Rule;
 import org.junit.internal.AssumptionViolatedException;
 import org.junit.rules.TestRule;
@@ -36,6 +32,11 @@ import org.ops4j.pax.exam.options.MavenUrlReference;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+//import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
+
+/**
+ * @author Sam Hague (shague@redhat.com)
+ */
 public abstract class AbstractConfigTestBase {
     private static final Logger LOG = LoggerFactory.getLogger(AbstractConfigTestBase.class);
 
@@ -43,6 +44,7 @@ public abstract class AbstractConfigTestBase {
      * Wait up to 10s for our configured module to come up
      */
     private static final int MODULE_TIMEOUT = 10000;
+    private static int configTimes = 0;
 
     public abstract String getModuleName();
 
@@ -52,11 +54,9 @@ public abstract class AbstractConfigTestBase {
 
     public abstract String getFeatureName();
 
-    public void setExtras() {}
-
     public Option[] getLoggingOptions() {
         Option[] options = new Option[] {
-                editConfigurationFilePut(SouthboundITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
+                editConfigurationFilePut(NetvirtITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
                         logConfiguration(AbstractConfigTestBase.class),
                         LogLevel.INFO.name())
         };
@@ -76,14 +76,9 @@ public abstract class AbstractConfigTestBase {
     }
 
     public MavenArtifactUrlReference getKarafDistro() {
-        /*MavenArtifactUrlReference karafUrl = maven()
-                .groupId("org.opendaylight.controller")
-                .artifactId("opendaylight-karaf-empty")
-                .version("1.5.0-SNAPSHOT")
-                .type("zip");*/
-        MavenArtifactUrlReference karafUrl = maven()
+        MavenArtifactUrlReference karafUrl;
+        karafUrl = maven()
                 .groupId("org.opendaylight.ovsdb")
-                //.artifactId("southbound-karaf")
                 .artifactId("karaf")
                 .version("1.1.0-SNAPSHOT")
                 .type("zip");
@@ -92,9 +87,10 @@ public abstract class AbstractConfigTestBase {
 
     @Configuration
     public Option[] config() {
-        setExtras();
+        LOG.info("Calling config, configTimes: {}", configTimes);
+        configTimes++;
         Option[] options = new Option[] {
-                // KarafDistributionOption.debugConfiguration("5005", true),
+                //KarafDistributionOption.debugConfiguration("5005", true),
                 karafDistributionConfiguration()
                         .frameworkUrl(getKarafDistro())
                         .unpackDirectory(new File("target/exam"))
@@ -102,10 +98,9 @@ public abstract class AbstractConfigTestBase {
                 keepRuntimeFolder(),
                 //features(getFeatureRepo() , getFeatureName())
         };
-        //options = ObjectArrays.concat(options, getFeaturesOptions(), Option.class);
+        options = ObjectArrays.concat(options, getFeaturesOptions(), Option.class);
         options = ObjectArrays.concat(options, getLoggingOptions(), Option.class);
         options = ObjectArrays.concat(options, getPropertiesOptions(), Option.class);
-        LOG.info("options: {}", options);
         return options;
     }
 
similarity index 93%
rename from openstack/netvirt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/AbstractMdsalTestBase.java
rename to openstack/net-virt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/AbstractMdsalTestBase.java
index ae4e7e4c1b6db16fba613e06318c21dc8b353847..ce41945128ec9ad2bb39a5154b901fc4fd00c162 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (C) 2015 Red Hat, Inc. and others
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -9,10 +9,9 @@ package org.opendaylight.ovsdb.openstack.netvirt.it;
 
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
 
+import com.google.common.collect.ObjectArrays;
 import java.util.Calendar;
-
 import javax.inject.Inject;
-
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
 import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
@@ -22,8 +21,6 @@ import org.ops4j.pax.exam.util.Filter;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.collect.ObjectArrays;
-
 public abstract class AbstractMdsalTestBase extends AbstractConfigTestBase implements BindingAwareProvider {
 
     private static final Logger LOG = LoggerFactory.getLogger(AbstractMdsalTestBase.class);
@@ -63,7 +60,7 @@ public abstract class AbstractMdsalTestBase extends AbstractConfigTestBase imple
     @Override
     public Option[] getLoggingOptions() {
         Option[] options = new Option[] {
-                editConfigurationFilePut(SouthboundITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
+                editConfigurationFilePut(NetvirtITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
                         logConfiguration(AbstractMdsalTestBase.class),
                         LogLevel.INFO.name()),
         };
similarity index 98%
rename from openstack/netvirt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/MdsalUtils.java
rename to openstack/net-virt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/MdsalUtils.java
index 730086c7ea94ab9dcd6ba57b7b60f9f56012e995..927f8eaceeb9bedbd21d806245d3032ccc63f0b6 100644 (file)
@@ -25,7 +25,7 @@ import org.slf4j.LoggerFactory;
  * @author Sam Hague (shague@redhat.com)
  */
 public class MdsalUtils {
-    private static final Logger LOG = LoggerFactory.getLogger(SouthboundIT.class);
+    private static final Logger LOG = LoggerFactory.getLogger(MdsalUtils.class);
     private DataBroker databroker = null;
 
     /**
diff --git a/openstack/net-virt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/NetvirtIT.java b/openstack/net-virt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/NetvirtIT.java
new file mode 100644 (file)
index 0000000..8eb9593
--- /dev/null
@@ -0,0 +1,572 @@
+/*
+ * Copyright (c) 2015 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
+ */
+package org.opendaylight.ovsdb.openstack.netvirt.it;
+
+import static org.junit.Assert.fail;
+import static org.ops4j.pax.exam.CoreOptions.maven;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
+
+import com.google.common.collect.ImmutableBiMap;
+import com.google.common.collect.Lists;
+import com.google.common.collect.ObjectArrays;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import javax.inject.Inject;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.*;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.BridgeExternalIds;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.BridgeOtherConfigs;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.ProtocolEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.ProtocolEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ConnectionInfo;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ConnectionInfoBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.InterfaceTypeEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.OpenvswitchOtherConfigs;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.karaf.options.LogLevelOption;
+import org.ops4j.pax.exam.options.MavenUrlReference;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Integration tests for netvirt
+ *
+ * @author Sam Hague (shague@redhat.com)
+ */
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class NetvirtIT extends AbstractMdsalTestBase {
+    private static final Logger LOG = LoggerFactory.getLogger(NetvirtIT.class);
+    private static final int OVSDB_UPDATE_TIMEOUT = 1000;
+    private static DataBroker dataBroker = null;
+    private static String addressStr;
+    private static String portStr;
+    private static String connectionType;
+    private static Boolean setup = false;
+    private static MdsalUtils mdsalUtils = null;
+    private static final String NETVIRT = "org.opendaylight.ovsdb.openstack.net-virt";
+    private static final String NETVIRTPROVIDERS = "org.opendaylight.ovsdb.openstack.net-virt-providers";
+
+    @Inject
+    private BundleContext bundleContext;
+
+    @Configuration
+    public Option[] config() {
+        return super.config();
+    }
+
+    @Override
+    public String getModuleName() {
+        return "openstack.net-virt";
+    }
+
+    @Override
+    public String getInstanceName() {
+        return "net-virt-default";
+    }
+
+    @Override
+    public MavenUrlReference getFeatureRepo() {
+        return maven()
+                .groupId("org.opendaylight.ovsdb")
+                .artifactId("features-ovsdb")
+                .classifier("features")
+                .type("xml")
+                .versionAsInProject();
+    }
+
+    @Override
+    public String getFeatureName() {
+        return "odl-ovsdb-openstack-sb";
+    }
+
+    protected String usage() {
+        return "Integration Test needs a valid connection configuration as follows :\n"
+                + "active connection : mvn -Dovsdbserver.ipaddress=x.x.x.x -Dovsdbserver.port=yyyy verify\n"
+                + "passive connection : mvn -Dovsdbserver.connection=passive verify\n";
+    }
+
+    @Override
+    public Option[] getFeaturesOptions() {
+        return new Option[]{};
+    }
+
+    @Override
+    public Option[] getLoggingOptions() {
+        Option[] options;
+
+        options = new Option[] {
+            editConfigurationFilePut(NetvirtITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
+                    "log4j.logger.org.opendaylight.ovsdb",
+                    LogLevelOption.LogLevel.DEBUG.name()),
+            editConfigurationFilePut(NetvirtITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
+                    "log4j.logger.org.opendaylight.ovsdb.lib",
+                    LogLevelOption.LogLevel.TRACE.name()),
+            /*editConfigurationFilePut(NetvirtITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
+                    "log4j.logger.org.opendaylight.ovsdb.openstack.net-virt",
+                    LogLevelOption.LogLevel.DEBUG.name())*/
+        };
+
+        options = ObjectArrays.concat(options, super.getLoggingOptions(), Option.class);
+        return options;
+    }
+
+    @Override
+    public Option[] getPropertiesOptions() {
+        Properties props = new Properties(System.getProperties());
+        String addressStr = props.getProperty(NetvirtITConstants.SERVER_IPADDRESS,
+                NetvirtITConstants.DEFAULT_SERVER_IPADDRESS);
+        String portStr = props.getProperty(NetvirtITConstants.SERVER_PORT,
+                NetvirtITConstants.DEFAULT_SERVER_PORT);
+        String connectionType = props.getProperty(NetvirtITConstants.CONNECTION_TYPE,
+                NetvirtITConstants.CONNECTION_TYPE_ACTIVE);
+
+        LOG.info("getPropertiesOptions: Using the following properties: mode= {}, ip:port= {}:{}",
+                connectionType, addressStr, portStr);
+
+        Option[] options = new Option[] {
+                editConfigurationFilePut(NetvirtITConstants.CUSTOM_PROPERTIES,
+                        NetvirtITConstants.SERVER_IPADDRESS, addressStr),
+                editConfigurationFilePut(NetvirtITConstants.CUSTOM_PROPERTIES,
+                        NetvirtITConstants.SERVER_PORT, portStr),
+                editConfigurationFilePut(NetvirtITConstants.CUSTOM_PROPERTIES,
+                        NetvirtITConstants.CONNECTION_TYPE, connectionType),
+        };
+        return options;
+    }
+
+    @Before
+    public void setUp() throws InterruptedException {
+        if (setup == true) {
+            LOG.info("Skipping setUp, already initialized");
+            return;
+        }
+
+        try {
+            super.setup();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        addressStr = bundleContext.getProperty(NetvirtITConstants.SERVER_IPADDRESS);
+        portStr = bundleContext.getProperty(NetvirtITConstants.SERVER_PORT);
+        connectionType = bundleContext.getProperty(NetvirtITConstants.CONNECTION_TYPE);
+
+        LOG.info("setUp: Using the following properties: mode= {}, ip:port= {}:{}",
+                connectionType, addressStr, portStr);
+        if (connectionType.equalsIgnoreCase(NetvirtITConstants.CONNECTION_TYPE_ACTIVE)) {
+            if (addressStr == null) {
+                fail(usage());
+            }
+        }
+
+        isBundleReady(bundleContext, NETVIRT);
+        isBundleReady(bundleContext, NETVIRTPROVIDERS);
+
+        //dataBroker = getSession().getSALService(DataBroker.class);
+        Thread.sleep(10000);
+        //dataBroker = OvsdbInventoryServiceImpl.getDataBroker();
+        dataBroker = org.opendaylight.ovsdb.openstack.netvirt.MdsalUtils.getDatabroker();
+        Assert.assertNotNull("db should not be null", dataBroker);
+
+        mdsalUtils = new MdsalUtils(dataBroker);
+        setup = true;
+    }
+
+    /**
+     * Test passive connection mode. The southbound starts in a listening mode waiting for connections on port
+     * 6640. This test will wait for incoming connections for {@link NetvirtITConstants.CONNECTION_INIT_TIMEOUT} ms.
+     *
+     * @throws InterruptedException
+     */
+    @Test
+    public void testPassiveNode() throws InterruptedException {
+        if (connectionType.equalsIgnoreCase(NetvirtITConstants.CONNECTION_TYPE_PASSIVE)) {
+            //Wait for CONNECTION_INIT_TIMEOUT for the Passive connection to be initiated by the ovsdb-server.
+            Thread.sleep(NetvirtITConstants.CONNECTION_INIT_TIMEOUT);
+        }
+    }
+
+    private ConnectionInfo getConnectionInfo(final String addressStr, final String portStr) {
+        InetAddress inetAddress = null;
+        try {
+            inetAddress = InetAddress.getByName(addressStr);
+        } catch (UnknownHostException e) {
+            fail("Could not allocate InetAddress: " + e);
+        }
+
+        IpAddress address = SouthboundMapper.createIpAddress(inetAddress);
+        PortNumber port = new PortNumber(Integer.parseInt(portStr));
+
+        LOG.info("connectionInfo: {}", new ConnectionInfoBuilder()
+                .setRemoteIp(address)
+                .setRemotePort(port)
+                .build());
+        return new ConnectionInfoBuilder()
+                       .setRemoteIp(address)
+                       .setRemotePort(port)
+                       .build();
+    }
+
+    private String connectionInfoToString(final ConnectionInfo connectionInfo) {
+        return new String(connectionInfo.getRemoteIp().getValue()) + ":" + connectionInfo.getRemotePort().getValue();
+    }
+
+    private boolean addOvsdbNode(final ConnectionInfo connectionInfo) throws InterruptedException {
+        boolean result = mdsalUtils.put(LogicalDatastoreType.CONFIGURATION,
+                SouthboundMapper.createInstanceIdentifier(connectionInfo),
+                SouthboundMapper.createNode(connectionInfo));
+        Thread.sleep(OVSDB_UPDATE_TIMEOUT);
+        return result;
+    }
+
+    private Node getOvsdbNode(final ConnectionInfo connectionInfo) {
+        Node node = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL,
+                SouthboundMapper.createInstanceIdentifier(connectionInfo));
+        return node;
+    }
+
+    private boolean deleteOvsdbNode(final ConnectionInfo connectionInfo) throws InterruptedException {
+        boolean result = mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION,
+                SouthboundMapper.createInstanceIdentifier(connectionInfo));
+        Thread.sleep(OVSDB_UPDATE_TIMEOUT);
+        return result;
+    }
+
+    private Node connectOvsdbNode(final ConnectionInfo connectionInfo) throws InterruptedException {
+        Assert.assertTrue(addOvsdbNode(connectionInfo));
+        Node node = getOvsdbNode(connectionInfo);
+        Assert.assertNotNull("Should find OVSDB node after connect", node);
+        LOG.info("Connected to {}", connectionInfoToString(connectionInfo));
+        return node;
+    }
+
+    private boolean disconnectOvsdbNode(final ConnectionInfo connectionInfo) throws InterruptedException {
+        Assert.assertTrue(deleteOvsdbNode(connectionInfo));
+        Node node = getOvsdbNode(connectionInfo);
+        Assert.assertNull("Should not find OVSDB node after disconnect", node);
+        //Assume.assumeNotNull(node); // Using assumeNotNull because there is no assumeNull
+        LOG.info("Disconnected from {}", connectionInfoToString(connectionInfo));
+        return true;
+    }
+
+    @Test
+    public void testAddDeleteOvsdbNode() throws InterruptedException {
+        ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portStr);
+        connectOvsdbNode(connectionInfo);
+        Assert.assertTrue(disconnectOvsdbNode(connectionInfo));
+        //Assume.assumeTrue(disconnectOvsdbNode(connectionInfo));
+    }
+
+    @Ignore
+    @Test
+    public void testOpenVSwitchOtherConfig() throws InterruptedException {
+        ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portStr);
+        Node ovsdbNode = connectOvsdbNode(connectionInfo);
+        OvsdbNodeAugmentation ovsdbNodeAugmentation = ovsdbNode.getAugmentation(OvsdbNodeAugmentation.class);
+        Assert.assertNotNull(ovsdbNodeAugmentation);
+        List<OpenvswitchOtherConfigs> otherConfigsList = ovsdbNodeAugmentation.getOpenvswitchOtherConfigs();
+        if (otherConfigsList != null) {
+            for (OpenvswitchOtherConfigs otherConfig : otherConfigsList) {
+                if (otherConfig.getOtherConfigKey().equals("local_ip")) {
+                    LOG.info("local_ip: {}", otherConfig.getOtherConfigValue());
+                    break;
+                } else {
+                    LOG.info("other_config {}:{}", otherConfig.getOtherConfigKey(), otherConfig.getOtherConfigValue());
+                }
+            }
+        } else {
+            LOG.info("other_config is not present");
+        }
+        Assert.assertTrue(disconnectOvsdbNode(connectionInfo));
+        //Assume.assumeTrue(disconnectOvsdbNode(connectionInfo));
+    }
+
+    private void setManagedBy(final OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder,
+                              final ConnectionInfo connectionInfo) {
+        InstanceIdentifier<Node> connectionNodePath = SouthboundMapper.createInstanceIdentifier(connectionInfo);
+        ovsdbBridgeAugmentationBuilder.setManagedBy(new OvsdbNodeRef(connectionNodePath));
+    }
+
+    private List<ProtocolEntry> createMdsalProtocols() {
+        List<ProtocolEntry> protocolList = new ArrayList<ProtocolEntry>();
+        ImmutableBiMap<String, Class<? extends OvsdbBridgeProtocolBase>> mapper =
+                SouthboundConstants.OVSDB_PROTOCOL_MAP.inverse();
+        protocolList.add(new ProtocolEntryBuilder().
+                setProtocol((Class<? extends OvsdbBridgeProtocolBase>) mapper.get("OpenFlow13")).build());
+        return protocolList;
+    }
+
+    private OvsdbTerminationPointAugmentationBuilder createGenericOvsdbTerminationPointAugmentationBuilder() {
+        OvsdbTerminationPointAugmentationBuilder ovsdbTerminationPointAugmentationBuilder =
+                new OvsdbTerminationPointAugmentationBuilder();
+        ovsdbTerminationPointAugmentationBuilder.setInterfaceType(
+                new InterfaceTypeEntryBuilder()
+                        .setInterfaceType(
+                                SouthboundMapper.createInterfaceType("internal"))
+                        .build().getInterfaceType());
+        return ovsdbTerminationPointAugmentationBuilder;
+    }
+
+    private boolean addTerminationPoint(final NodeId bridgeNodeId, final String portName,
+            final OvsdbTerminationPointAugmentationBuilder ovsdbTerminationPointAugmentationBuilder)
+        throws InterruptedException {
+
+        InstanceIdentifier<Node> portIid = SouthboundMapper.createInstanceIdentifier(bridgeNodeId);
+        NodeBuilder portNodeBuilder = new NodeBuilder();
+        NodeId portNodeId = SouthboundMapper.createManagedNodeId(portIid);
+        portNodeBuilder.setNodeId(portNodeId);
+        TerminationPointBuilder entry = new TerminationPointBuilder();
+        entry.setKey(new TerminationPointKey(new TpId(portName)));
+        entry.addAugmentation(
+                OvsdbTerminationPointAugmentation.class,
+                ovsdbTerminationPointAugmentationBuilder.build());
+        portNodeBuilder.setTerminationPoint(Lists.newArrayList(entry.build()));
+        boolean result = mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION,
+                portIid, portNodeBuilder.build());
+        Thread.sleep(OVSDB_UPDATE_TIMEOUT);
+        return result;
+    }
+
+    /*
+     * base method for adding test bridges.  Other helper methods used to create bridges should utilize this method.
+     *
+     * @param connectionInfo
+     * @param bridgeIid if passed null, one is created
+     * @param bridgeName cannot be null
+     * @param bridgeNodeId if passed null, one is created based on <code>bridgeIid</code>
+     * @param setProtocolEntries toggles whether default protocol entries are set for the bridge
+     * @param failMode toggles whether default fail mode is set for the bridge
+     * @param setManagedBy toggles whether to setManagedBy for the bridge
+     * @param dpType if passed null, this parameter is ignored
+     * @param externalIds if passed null, this parameter is ignored
+     * @param otherConfig if passed null, this parameter is ignored
+     * @return success of bridge addition
+     * @throws InterruptedException
+     */
+    private boolean addBridge(final ConnectionInfo connectionInfo, InstanceIdentifier<Node> bridgeIid,
+            final String bridgeName, NodeId bridgeNodeId, final boolean setProtocolEntries,
+            final Class<? extends OvsdbFailModeBase> failMode, final boolean setManagedBy,
+            final Class<? extends DatapathTypeBase> dpType,
+            final List<BridgeExternalIds> externalIds,
+            final List<BridgeOtherConfigs> otherConfigs) throws InterruptedException {
+
+        NodeBuilder bridgeNodeBuilder = new NodeBuilder();
+        if (bridgeIid == null) {
+            bridgeIid = SouthboundMapper.createInstanceIdentifier(connectionInfo, new OvsdbBridgeName(bridgeName));
+        }
+        if (bridgeNodeId == null) {
+            bridgeNodeId = SouthboundMapper.createManagedNodeId(bridgeIid);
+        }
+        bridgeNodeBuilder.setNodeId(bridgeNodeId);
+        OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder = new OvsdbBridgeAugmentationBuilder();
+        ovsdbBridgeAugmentationBuilder.setBridgeName(new OvsdbBridgeName(bridgeName));
+        if (setProtocolEntries) {
+            ovsdbBridgeAugmentationBuilder.setProtocolEntry(createMdsalProtocols());
+        }
+        if (failMode != null) {
+            ovsdbBridgeAugmentationBuilder.setFailMode(failMode);
+        }
+        if (setManagedBy) {
+            setManagedBy(ovsdbBridgeAugmentationBuilder, connectionInfo);
+        }
+        if (dpType != null) {
+            ovsdbBridgeAugmentationBuilder.setDatapathType(dpType);
+        }
+        if (externalIds != null) {
+            ovsdbBridgeAugmentationBuilder.setBridgeExternalIds(externalIds);
+        }
+        if (otherConfigs != null) {
+            ovsdbBridgeAugmentationBuilder.setBridgeOtherConfigs(otherConfigs);
+        }
+        bridgeNodeBuilder.addAugmentation(OvsdbBridgeAugmentation.class, ovsdbBridgeAugmentationBuilder.build());
+        LOG.debug("Built with the intent to store bridge data {}",
+                ovsdbBridgeAugmentationBuilder.toString());
+        boolean result = mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION,
+                bridgeIid, bridgeNodeBuilder.build());
+        Thread.sleep(OVSDB_UPDATE_TIMEOUT);
+        return result;
+    }
+
+    private boolean addBridge(final ConnectionInfo connectionInfo, final String bridgeName)
+        throws InterruptedException {
+
+        return addBridge(connectionInfo, null, bridgeName, null, true,
+                SouthboundConstants.OVSDB_FAIL_MODE_MAP.inverse().get("secure"), true, null, null, null);
+    }
+
+    private OvsdbBridgeAugmentation getBridge(ConnectionInfo connectionInfo) {
+        return getBridge(connectionInfo, NetvirtITConstants.BRIDGE_NAME);
+    }
+
+    /**
+     * Extract the <code>store</code> type data store contents for the particular bridge identified by
+     * <code>bridgeName</code>.
+     *
+     * @param connectionInfo
+     * @param bridgeName
+     * @param store defined by the <code>LogicalDatastoreType</code> enumeration
+     * @return <code>store</code> type data store contents
+     */
+    private OvsdbBridgeAugmentation getBridge(ConnectionInfo connectionInfo, String bridgeName,
+            LogicalDatastoreType store) {
+        Node bridgeNode = getBridgeNode(connectionInfo, bridgeName, store);
+        Assert.assertNotNull(bridgeNode);
+        OvsdbBridgeAugmentation ovsdbBridgeAugmentation = bridgeNode.getAugmentation(OvsdbBridgeAugmentation.class);
+        Assert.assertNotNull(ovsdbBridgeAugmentation);
+        return ovsdbBridgeAugmentation;
+    }
+
+    /**
+     * extract the <code>LogicalDataStoreType.OPERATIONAL</code> type data store contents for the particular bridge
+     * identified by <code>bridgeName</code>
+     *
+     * @param connectionInfo
+     * @param bridgeName
+     * @see <code>NetvirtIT.getBridge(ConnectionInfo, String, LogicalDatastoreType)</code>
+     * @return <code>LogicalDatastoreType.OPERATIONAL</code> type data store contents
+     */
+    private OvsdbBridgeAugmentation getBridge(ConnectionInfo connectionInfo, String bridgeName) {
+        return getBridge(connectionInfo, bridgeName, LogicalDatastoreType.OPERATIONAL);
+    }
+
+    /**
+     * Extract the node contents from <code>store</code> type data store for the
+     * bridge identified by <code>bridgeName</code>
+     *
+     * @param connectionInfo
+     * @param bridgeName
+     * @param store defined by the <code>LogicalDatastoreType</code> enumeration
+     * @return <code>store</code> type data store contents
+     */
+    private Node getBridgeNode(ConnectionInfo connectionInfo, String bridgeName, LogicalDatastoreType store) {
+        InstanceIdentifier<Node> bridgeIid =
+                SouthboundMapper.createInstanceIdentifier(connectionInfo,
+                    new OvsdbBridgeName(bridgeName));
+        return mdsalUtils.read(store, bridgeIid);
+    }
+
+    /**
+     * Extract the node contents from <code>LogicalDataStoreType.OPERATIONAL</code> data store for the
+     * bridge identified by <code>bridgeName</code>
+     *
+     * @param connectionInfo
+     * @param bridgeName
+     * @return <code>LogicalDatastoreType.OPERATIONAL</code> type data store contents
+     */
+    private Node getBridgeNode(ConnectionInfo connectionInfo, String bridgeName) {
+        return getBridgeNode(connectionInfo, bridgeName, LogicalDatastoreType.OPERATIONAL);
+    }
+
+    private boolean deleteBridge(ConnectionInfo connectionInfo) throws InterruptedException {
+        return deleteBridge(connectionInfo, NetvirtITConstants.BRIDGE_NAME);
+    }
+
+    private boolean deleteBridge(final ConnectionInfo connectionInfo, final String bridgeName)
+        throws InterruptedException {
+
+        boolean result = mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION,
+                SouthboundMapper.createInstanceIdentifier(connectionInfo,
+                        new OvsdbBridgeName(bridgeName)));
+        Thread.sleep(OVSDB_UPDATE_TIMEOUT);
+        return result;
+    }
+
+    private InstanceIdentifier<Node> getTpIid(ConnectionInfo connectionInfo, OvsdbBridgeAugmentation bridge) {
+        return SouthboundMapper.createInstanceIdentifier(connectionInfo,
+            bridge.getBridgeName());
+    }
+
+    /**
+     * isBundleReady is used to check if the requested bundle is Active
+     */
+    public void isBundleReady(BundleContext bundleContext, String bundleName) throws InterruptedException {
+        boolean ready = false;
+
+        while (!ready) {
+            int state = Bundle.UNINSTALLED;
+            Bundle[] bundles = bundleContext.getBundles();
+            for (Bundle element : bundles) {
+                if (element.getSymbolicName().equals(bundleName)) {
+                    state = element.getState();
+                    LOG.info(">>>>> bundle is ready {}", bundleName);
+                    break;
+                }
+            }
+            if (state != Bundle.ACTIVE) {
+                LOG.info(">>>>> bundle not ready {}", bundleName);
+                Thread.sleep(5000);
+            } else {
+                ready = true;
+            }
+        }
+    }
+
+    private void netVirtAddPort(ConnectionInfo connectionInfo) throws InterruptedException {
+        OvsdbBridgeAugmentation bridge = getBridge(connectionInfo, NetvirtITConstants.INTEGRATION_BRIDGE_NAME);
+        Assert.assertNotNull(bridge);
+        NodeId nodeId = SouthboundMapper.createManagedNodeId(SouthboundMapper.createInstanceIdentifier(
+                connectionInfo, bridge.getBridgeName()));
+        OvsdbTerminationPointAugmentationBuilder ovsdbTerminationBuilder =
+                createGenericOvsdbTerminationPointAugmentationBuilder();
+        String portName = NetvirtITConstants.PORT_NAME;
+        ovsdbTerminationBuilder.setName(portName);
+        Assert.assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder));
+        InstanceIdentifier<Node> terminationPointIid = getTpIid(connectionInfo, bridge);
+        Node terminationPointNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, terminationPointIid);
+        Assert.assertNotNull(terminationPointNode);
+    }
+
+    /**
+     * Test for basic southbound events to netvirt.
+     * <pre>The test will:
+     * - connect to an OVSDB node and verify it is added to operational
+     * - then verify that br-int was created on the node and stored in operational
+     * - a port is then added to the bridge to verify that it is ignored by netvirt
+     * - remove the bridge
+     * - remove the node and verify it is not in operational
+     * </pre>
+     * @throws InterruptedException
+     */
+    // TODO add verification of flows
+    @Test
+    public void testNetVirt() throws InterruptedException {
+        ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portStr);
+        connectOvsdbNode(connectionInfo);
+        Thread.sleep(10000);
+        netVirtAddPort(connectionInfo);
+        Thread.sleep(10000);
+        Assert.assertTrue(deleteBridge(connectionInfo, NetvirtITConstants.INTEGRATION_BRIDGE_NAME));
+        Thread.sleep(10000);
+        Assert.assertTrue(disconnectOvsdbNode(connectionInfo));
+    }
+}
similarity index 87%
rename from openstack/netvirt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/SouthboundITConstants.java
rename to openstack/net-virt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/NetvirtITConstants.java
index 90d8062242eca31649460f24be8b48b5790040ea..cacc671b30993224bb837d4ed89bbcbae62dfa11 100644 (file)
@@ -10,8 +10,8 @@ package org.opendaylight.ovsdb.openstack.netvirt.it;
 /**
  * Constants for SouthboundIT
  */
-public final class SouthboundITConstants {
-    private SouthboundITConstants() {
+public final class NetvirtITConstants {
+    private NetvirtITConstants() {
         throw new AssertionError("This class should not be instantiated.");
     }
 
@@ -28,4 +28,6 @@ public final class SouthboundITConstants {
     public static final String DEFAULT_SERVER_PORT = "6640";
     public static final String DEFAULT_SERVER_EXTRAS = "false";
     public static final String BRIDGE_NAME = "brtest";
+    public static final String PORT_NAME = "porttest";
+    public static final String INTEGRATION_BRIDGE_NAME = "br-int";
 }
diff --git a/openstack/net-virt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/SouthboundConstants.java b/openstack/net-virt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/SouthboundConstants.java
new file mode 100755 (executable)
index 0000000..e302c2b
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, 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
+ */
+package org.opendaylight.ovsdb.openstack.netvirt.it;
+
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.InterfaceTypeBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.InterfaceTypeInternal;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.InterfaceTypePatch;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.InterfaceTypeSystem;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.InterfaceTypeVxlan;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.InterfaceTypeTap;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.InterfaceTypeGeneve;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.InterfaceTypeGre;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.InterfaceTypeIpsecGre;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.InterfaceTypeGre64;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.InterfaceTypeIpsecGre64;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.InterfaceTypeLisp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.InterfaceTypeDpdk;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.InterfaceTypeDpdkr;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.InterfaceTypeDpdkvhost;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.InterfaceTypeDpdkvhostuser;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeProtocolBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeProtocolOpenflow10;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeProtocolOpenflow11;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeProtocolOpenflow12;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeProtocolOpenflow13;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeProtocolOpenflow14;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeProtocolOpenflow15;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbFailModeBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbFailModeSecure;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbFailModeStandalone;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.DatapathTypeBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.DatapathTypeSystem;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.DatapathTypeNetdev;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId;
+
+import com.google.common.collect.ImmutableBiMap;
+
+public class SouthboundConstants {
+    public static final TopologyId OVSDB_TOPOLOGY_ID = new TopologyId(new Uri("ovsdb:1"));
+    public static final String OVSDB_URI_PREFIX = "ovsdb";
+    public static final String BRIDGE_URI_PREFIX = "bridge";
+    public static final String TP_URI_PREFIX = "terminationpoint";
+    public static final Integer DEFAULT_OVSDB_PORT = 6640;
+    public static final ImmutableBiMap<Class<? extends OvsdbBridgeProtocolBase>,String> OVSDB_PROTOCOL_MAP
+        = new ImmutableBiMap.Builder<Class<? extends OvsdbBridgeProtocolBase>,String>()
+            .put(OvsdbBridgeProtocolOpenflow10.class,"OpenFlow10")
+            .put(OvsdbBridgeProtocolOpenflow11.class,"OpenFlow11")
+            .put(OvsdbBridgeProtocolOpenflow12.class,"OpenFlow12")
+            .put(OvsdbBridgeProtocolOpenflow13.class,"OpenFlow13")
+            .put(OvsdbBridgeProtocolOpenflow14.class,"OpenFlow14")
+            .put(OvsdbBridgeProtocolOpenflow15.class,"OpenFlow15")
+            .build();
+
+    public static final ImmutableBiMap<Class<? extends OvsdbFailModeBase>,String> OVSDB_FAIL_MODE_MAP
+        = new ImmutableBiMap.Builder<Class<? extends OvsdbFailModeBase>,String>()
+            .put(OvsdbFailModeStandalone.class,"standalone")
+            .put(OvsdbFailModeSecure.class,"secure")
+            .build();
+
+    public static final ImmutableBiMap<String, Class<? extends InterfaceTypeBase>> OVSDB_INTERFACE_TYPE_MAP
+        = new ImmutableBiMap.Builder<String, Class<? extends InterfaceTypeBase>>()
+            .put("internal", InterfaceTypeInternal.class)
+            .put("vxlan", InterfaceTypeVxlan.class)
+            .put("patch", InterfaceTypePatch.class)
+            .put("system", InterfaceTypeSystem.class)
+            .put("tap", InterfaceTypeTap.class)
+            .put("geneve", InterfaceTypeGeneve.class)
+            .put("gre", InterfaceTypeGre.class)
+            .put("ipsec_gre", InterfaceTypeIpsecGre.class)
+            .put("gre64", InterfaceTypeGre64.class)
+            .put("ipsec_gre64", InterfaceTypeIpsecGre64.class)
+            .put("lisp", InterfaceTypeLisp.class)
+            .put("dpdk", InterfaceTypeDpdk.class)
+            .put("dpdkr", InterfaceTypeDpdkr.class)
+            .put("dpdkvhost", InterfaceTypeDpdkvhost.class)
+            .put("dpdkvhostuser", InterfaceTypeDpdkvhostuser.class)
+            .build();
+
+    public static final ImmutableBiMap<Class<? extends DatapathTypeBase>,String> DATAPATH_TYPE_MAP
+        = new ImmutableBiMap.Builder<Class<? extends DatapathTypeBase>,String>()
+            .put(DatapathTypeSystem.class,"system")
+            .put(DatapathTypeNetdev.class,"netdev")
+            .build();
+    public static final String IID_EXTERNAL_ID_KEY = "opendaylight-iid";
+
+    public static enum VLANMODES {
+        ACCESS("access"),
+        NATIVE_TAGGED("native-tagged"),
+        NATIVE_UNTAGGED("native-untagged"),
+        TRUNK("trunk");
+
+        private final String mode;
+
+        private VLANMODES(String mode) {
+            this.mode = mode;
+        }
+        @Override
+        public String toString() {
+            return mode;
+        }
+
+        public String getMode() {
+            return this.mode;
+        }
+    }
+}
diff --git a/openstack/net-virt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/SouthboundMapper.java b/openstack/net-virt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/SouthboundMapper.java
new file mode 100644 (file)
index 0000000..bf9ac1a
--- /dev/null
@@ -0,0 +1,219 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, 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
+ */
+package org.opendaylight.ovsdb.openstack.netvirt.it;
+
+import java.net.Inet4Address;
+import java.net.Inet6Address;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;
+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.opendaylight.params.xml.ns.yang.ovsdb.rev150105.DatapathId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.DatapathTypeBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.DatapathTypeSystem;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.InterfaceTypeBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeName;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbNodeAugmentation;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbNodeAugmentationBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.ProtocolEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ConnectionInfo;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Joiner;
+import com.google.common.base.Preconditions;
+import com.google.common.base.Splitter;
+import com.google.common.collect.ImmutableBiMap;
+
+public class SouthboundMapper {
+    private static final Logger LOG = LoggerFactory.getLogger(SouthboundMapper.class);
+
+    public static Node createNode(ConnectionInfo key) {
+        NodeBuilder nodeBuilder = new NodeBuilder();
+        nodeBuilder.setNodeId(createNodeId(key.getRemoteIp(),key.getRemotePort()));
+        nodeBuilder.addAugmentation(OvsdbNodeAugmentation.class, createOvsdbAugmentation(key));
+        return nodeBuilder.build();
+    }
+
+    public static OvsdbNodeAugmentation createOvsdbAugmentation(ConnectionInfo key) {
+        OvsdbNodeAugmentationBuilder ovsdbNodeBuilder = new OvsdbNodeAugmentationBuilder();
+        ovsdbNodeBuilder.setConnectionInfo(key);
+        return ovsdbNodeBuilder.build();
+    }
+
+    public static IpAddress createIpAddress(InetAddress address) {
+        IpAddress ip = null;
+        if (address instanceof Inet4Address) {
+            ip = createIpAddress((Inet4Address)address);
+        } else if (address instanceof Inet6Address) {
+            ip = createIpAddress((Inet6Address)address);
+        }
+        return ip;
+    }
+
+    public static IpAddress createIpAddress(Inet4Address address) {
+        Ipv4Address ipv4 = new Ipv4Address(address.getHostAddress());
+        return new IpAddress(ipv4);
+    }
+
+    public static IpAddress createIpAddress(Inet6Address address) {
+        Ipv6Address ipv6 = new Ipv6Address(address.getHostAddress());
+        return new IpAddress(ipv6);
+    }
+
+    public static InstanceIdentifier<Node> createInstanceIdentifier(NodeId nodeId) {
+        InstanceIdentifier<Node> nodePath = InstanceIdentifier
+                .create(NetworkTopology.class)
+                .child(Topology.class, new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID))
+                .child(Node.class,new NodeKey(nodeId));
+        return nodePath;
+    }
+
+    public static InstanceIdentifier<Node> createInstanceIdentifier(ConnectionInfo key,OvsdbBridgeName bridgeName) {
+        return createInstanceIdentifier(createManagedNodeId(key, bridgeName));
+    }
+
+    public static NodeId createManagedNodeId(InstanceIdentifier<Node> iid) {
+        NodeKey nodeKey = iid.firstKeyOf(Node.class, NodeKey.class);
+        return nodeKey.getNodeId();
+    }
+
+    public static InstanceIdentifier<Node> createInstanceIdentifier(ConnectionInfo key) {
+        return createInstanceIdentifier(key.getRemoteIp(), key.getRemotePort());
+    }
+
+    public static InstanceIdentifier<Node> createInstanceIdentifier(IpAddress ip, PortNumber port) {
+        InstanceIdentifier<Node> path = InstanceIdentifier
+                .create(NetworkTopology.class)
+                .child(Topology.class, new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID))
+                .child(Node.class,createNodeKey(ip,port));
+        LOG.debug("Created ovsdb path: {}",path);
+        return path;
+    }
+
+    public static NodeKey createNodeKey(IpAddress ip, PortNumber port) {
+        return new NodeKey(createNodeId(ip,port));
+    }
+
+    public static NodeId createManagedNodeId(ConnectionInfo key, OvsdbBridgeName bridgeName) {
+        return createManagedNodeId(key.getRemoteIp(),key.getRemotePort(),bridgeName);
+    }
+
+    public static NodeId createManagedNodeId(IpAddress ip, PortNumber port, OvsdbBridgeName bridgeName) {
+        return new NodeId(createNodeId(ip,port).getValue()
+                + "/" + SouthboundConstants.BRIDGE_URI_PREFIX + "/" + bridgeName.getValue());
+    }
+
+    public static NodeId createNodeId(IpAddress ip, PortNumber port) {
+        String uriString = SouthboundConstants.OVSDB_URI_PREFIX + "://"
+                + new String(ip.getValue()) + ":" + port.getValue();
+        Uri uri = new Uri(uriString);
+        NodeId nodeId = new NodeId(uri);
+        return nodeId;
+    }
+
+    public static InetAddress createInetAddress(IpAddress ip) throws UnknownHostException {
+        if (ip.getIpv4Address() != null) {
+            return InetAddress.getByName(ip.getIpv4Address().getValue());
+        } else if (ip.getIpv6Address() != null) {
+            return InetAddress.getByName(ip.getIpv6Address().getValue());
+        } else {
+            throw new UnknownHostException("IP Address has no value");
+        }
+    }
+
+    public static DatapathId createDatapathId(Set<String> dpids) {
+        Preconditions.checkNotNull(dpids);
+        if (dpids.isEmpty()) {
+            return null;
+        } else {
+            String[] dpidArray = new String[dpids.size()];
+            dpids.toArray(dpidArray);
+            return createDatapathId(dpidArray[0]);
+        }
+    }
+
+    public static String createDatapathType(OvsdbBridgeAugmentation mdsalbridge) {
+        String datapathtype = new String(SouthboundConstants.DATAPATH_TYPE_MAP.get(DatapathTypeSystem.class));
+
+        if (mdsalbridge.getDatapathType() != null) {
+            if (SouthboundConstants.DATAPATH_TYPE_MAP.get(mdsalbridge.getDatapathType()) != null) {
+                datapathtype = SouthboundConstants.DATAPATH_TYPE_MAP.get(mdsalbridge.getDatapathType());
+            } else {
+                throw new IllegalArgumentException("Unknown datapath type "
+                        + SouthboundConstants.DATAPATH_TYPE_MAP.get(mdsalbridge.getDatapathType()));
+            }
+        }
+        return datapathtype;
+    }
+
+    public static  Class<? extends DatapathTypeBase> createDatapathType(String type) {
+        Preconditions.checkNotNull(type);
+        if (type.isEmpty()) {
+            return DatapathTypeSystem.class;
+        } else {
+            ImmutableBiMap<String, Class<? extends DatapathTypeBase>> mapper =
+                    SouthboundConstants.DATAPATH_TYPE_MAP.inverse();
+            return mapper.get(type);
+        }
+    }
+
+    public static DatapathId createDatapathId(String dpid) {
+        Preconditions.checkNotNull(dpid);
+        DatapathId datapath;
+        if (dpid.matches("^[0-9a-fA-F]{16}")) {
+            Splitter splitter = Splitter.fixedLength(2);
+            Joiner joiner = Joiner.on(":");
+            datapath = new DatapathId(joiner.join(splitter.split(dpid)));
+        } else {
+            datapath = new DatapathId(dpid);
+        }
+        return datapath;
+    }
+
+    public static Set<String> createOvsdbBridgeProtocols(OvsdbBridgeAugmentation ovsdbBridgeNode) {
+        Set<String> protocols = new HashSet<String>();
+        if (ovsdbBridgeNode.getProtocolEntry() != null && ovsdbBridgeNode.getProtocolEntry().size() > 0) {
+            for (ProtocolEntry protocol : ovsdbBridgeNode.getProtocolEntry()) {
+                if (SouthboundConstants.OVSDB_PROTOCOL_MAP.get(protocol.getProtocol()) != null) {
+                    protocols.add(SouthboundConstants.OVSDB_PROTOCOL_MAP.get(protocol.getProtocol()));
+                } else {
+                    throw new IllegalArgumentException("Unknown protocol " + protocol.getProtocol());
+                }
+            }
+        }
+        return protocols;
+    }
+
+    public static  Class<? extends InterfaceTypeBase> createInterfaceType(String type) {
+        Preconditions.checkNotNull(type);
+        return SouthboundConstants.OVSDB_INTERFACE_TYPE_MAP.get(type);
+    }
+
+    public static String createOvsdbInterfaceType(Class<? extends InterfaceTypeBase> mdsaltype) {
+        Preconditions.checkNotNull(mdsaltype);
+        ImmutableBiMap<Class<? extends InterfaceTypeBase>, String> mapper =
+                SouthboundConstants.OVSDB_INTERFACE_TYPE_MAP.inverse();
+        return mapper.get(mdsaltype);
+    }
+}
index 641115b1f67c980c14ab37fac92ce47825c80e1e..b6f0a14d38b3a197344978accbb8361cbcf7b34b 100644 (file)
@@ -70,6 +70,11 @@ import com.google.common.util.concurrent.CheckedFuture;
  */
 public class MdsalUtils {
     private static final Logger LOG = LoggerFactory.getLogger(MdsalUtils.class);
+
+    public static DataBroker getDatabroker() {
+        return databroker;
+    }
+
     private static DataBroker databroker = null;
     private static final int OVSDB_UPDATE_TIMEOUT = 500;
     private static final String PATCH_PORT_TYPE = "patch";
diff --git a/openstack/netvirt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/SouthboundIT.java b/openstack/netvirt-it/src/test/java/org/opendaylight/ovsdb/openstack/netvirt/it/SouthboundIT.java
deleted file mode 100644 (file)
index 58a65f6..0000000
+++ /dev/null
@@ -1,1014 +0,0 @@
-/*
- * Copyright (c) 2015 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
- */
-package org.opendaylight.ovsdb.openstack.netvirt.it;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-import static org.ops4j.pax.exam.CoreOptions.maven;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
-
-import com.google.common.collect.ImmutableBiMap;
-import com.google.common.collect.Lists;
-import com.google.common.collect.ObjectArrays;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-
-import javax.inject.Inject;
-
-import org.junit.Assert;
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.ovsdb.southbound.SouthboundConstants;
-import org.opendaylight.ovsdb.southbound.SouthboundMapper;
-import org.opendaylight.ovsdb.southbound.SouthboundProvider;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeName;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeProtocolBase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbNodeAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbNodeRef;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbPortInterfaceAttributes.VlanMode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.ProtocolEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.ProtocolEntryBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ConnectionInfo;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.ConnectionInfoBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.InterfaceTypeEntryBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.node.attributes.OpenvswitchOtherConfigs;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceExternalIds;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceExternalIdsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceOtherConfigs;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceOtherConfigsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.Options;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.OptionsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.PortExternalIds;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.PortExternalIdsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.PortOtherConfigs;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.PortOtherConfigsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.Trunks;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.TrunksBuilder;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder;
-import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.PaxExam;
-import org.ops4j.pax.exam.karaf.options.LogLevelOption;
-import org.ops4j.pax.exam.options.MavenUrlReference;
-import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
-import org.ops4j.pax.exam.spi.reactors.PerClass;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Integration tests for southbound-impl
- *
- * @author Sam Hague (shague@redhat.com)
- */
-@RunWith(PaxExam.class)
-@ExamReactorStrategy(PerClass.class)
-public class SouthboundIT extends AbstractMdsalTestBase {
-    private static final Logger LOG = LoggerFactory.getLogger(SouthboundIT.class);
-    private static final int OVSDB_UPDATE_TIMEOUT = 1000;
-    private static DataBroker dataBroker = null;
-    private static String addressStr;
-    private static String portStr;
-    private static String connectionType;
-    private static Boolean setup = false;
-    private static MdsalUtils mdsalUtils = null;
-    private static String extras = "true";
-    private static final String NETVIRT = "org.opendaylight.ovsdb.openstack.net-virt";
-    private static final String NETVIRTPROVIDERS = "org.opendaylight.ovsdb.openstack.net-virt-providers";
-
-    @Inject
-    private BundleContext bundleContext;
-
-    @Configuration
-    public Option[] config() {
-        return super.config();
-    }
-
-    @Override
-    public String getModuleName() {
-        return "southbound-impl";
-    }
-
-    @Override
-    public String getInstanceName() {
-        return "southbound-default";
-    }
-
-    @Override
-    public MavenUrlReference getFeatureRepo() {
-        return maven()
-                .groupId("org.opendaylight.ovsdb")
-                //.artifactId("southbound-features")
-                .artifactId("features-ovsdb")
-                .classifier("features")
-                .type("xml")
-                .versionAsInProject();
-    }
-
-    @Override
-    public String getFeatureName() {
-        return "odl-ovsdb-southbound-impl-ui";
-    }
-
-    protected String usage() {
-        return "Integration Test needs a valid connection configuration as follows :\n"
-                + "active connection : mvn -Dovsdbserver.ipaddress=x.x.x.x -Dovsdbserver.port=yyyy verify\n"
-                + "passive connection : mvn -Dovsdbserver.connection=passive verify\n";
-    }
-
-    @Override
-    public Option[] getFeaturesOptions() {
-        /*if (extras.equals("true")) {
-            Option[] options = new Option[] {
-                    features("mvn:org.opendaylight.ovsdb/features-ovsdb/1.1.0-SNAPSHOT/xml/features",
-                            "odl-ovsdb-openstack-sb")};
-            return options;
-        } else {*/
-            return new Option[]{};
-        //}
-    }
-
-    @Override
-    public Option[] getLoggingOptions() {
-        Option[] options = new Option[] {
-                editConfigurationFilePut(SouthboundITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
-                        "log4j.logger.org.opendaylight.ovsdb",
-                        LogLevelOption.LogLevel.DEBUG.name()),
-                /*editConfigurationFilePut(SouthboundITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
-                        "log4j.logger.org.opendaylight.ovsdb.southbound-impl",
-                        LogLevelOption.LogLevel.DEBUG.name())*/
-        };
-
-        LOG.info("getLoggingOptions extras: {}", extras);
-        if (extras.equals("true")) {
-            Option[] extraOptions = new Option[] {
-                editConfigurationFilePut(SouthboundITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
-                        "log4j.logger.org.opendaylight.ovsdb",
-                        LogLevelOption.LogLevel.DEBUG.name()),
-                /*editConfigurationFilePut(SouthboundITConstants.ORG_OPS4J_PAX_LOGGING_CFG,
-                        "log4j.logger.org.opendaylight.ovsdb.openstack.net-virt",
-                        LogLevelOption.LogLevel.DEBUG.name())*/
-            };
-            options = ObjectArrays.concat(options, extraOptions, Option.class);
-        }
-
-        options = ObjectArrays.concat(options, super.getLoggingOptions(), Option.class);
-        return options;
-    }
-
-    @Override
-    public Option[] getPropertiesOptions() {
-        Properties props = new Properties(System.getProperties());
-        String addressStr = props.getProperty(SouthboundITConstants.SERVER_IPADDRESS,
-                SouthboundITConstants.DEFAULT_SERVER_IPADDRESS);
-        String portStr = props.getProperty(SouthboundITConstants.SERVER_PORT,
-                SouthboundITConstants.DEFAULT_SERVER_PORT);
-        String connectionType = props.getProperty(SouthboundITConstants.CONNECTION_TYPE,
-                SouthboundITConstants.CONNECTION_TYPE_ACTIVE);
-        String extras = props.getProperty(SouthboundITConstants.SERVER_EXTRAS,
-                SouthboundITConstants.DEFAULT_SERVER_EXTRAS);
-
-        LOG.info("getPropertiesOptions: Using the following properties: mode= {}, ip:port= {}:{}, extras= {}",
-                connectionType, addressStr, portStr, extras);
-
-        Option[] options = new Option[] {
-                editConfigurationFilePut(SouthboundITConstants.CUSTOM_PROPERTIES,
-                        SouthboundITConstants.SERVER_IPADDRESS, addressStr),
-                editConfigurationFilePut(SouthboundITConstants.CUSTOM_PROPERTIES,
-                        SouthboundITConstants.SERVER_PORT, portStr),
-                editConfigurationFilePut(SouthboundITConstants.CUSTOM_PROPERTIES,
-                        SouthboundITConstants.CONNECTION_TYPE, connectionType),
-                editConfigurationFilePut(SouthboundITConstants.CUSTOM_PROPERTIES,
-                        SouthboundITConstants.SERVER_EXTRAS, extras)
-        };
-        return options;
-    }
-
-    @Override
-    public void setExtras() {
-        Properties props = new Properties(System.getProperties());
-        extras = props.getProperty(SouthboundITConstants.SERVER_EXTRAS,
-                SouthboundITConstants.DEFAULT_SERVER_EXTRAS);
-        LOG.info("setExtras: {}", extras);
-        System.out.println("setExtras: " + extras);
-    }
-
-    @Before
-    public void setUp() throws InterruptedException {
-        if (setup == true) {
-            LOG.info("Skipping setUp, already initialized");
-            return;
-        }
-
-        try {
-            super.setup();
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        dataBroker = getSession().getSALService(DataBroker.class);
-        Thread.sleep(3000);
-        //dataBroker = SouthboundProvider.getDb();
-        Assert.assertNotNull("db should not be null", dataBroker);
-
-        addressStr = bundleContext.getProperty(SouthboundITConstants.SERVER_IPADDRESS);
-        portStr = bundleContext.getProperty(SouthboundITConstants.SERVER_PORT);
-        connectionType = bundleContext.getProperty(SouthboundITConstants.CONNECTION_TYPE);
-
-        LOG.info("setUp: Using the following properties: mode= {}, ip:port= {}:{}, extras= {}",
-                connectionType, addressStr, portStr, extras);
-        if (connectionType.equalsIgnoreCase(SouthboundITConstants.CONNECTION_TYPE_ACTIVE)) {
-            if (addressStr == null) {
-                fail(usage());
-            }
-        }
-
-        mdsalUtils = new MdsalUtils(dataBroker);
-        setup = true;
-
-        //setExtras();
-        LOG.info("setUp: extras: {}", extras);
-        if (extras.equals("true")) {
-            isBundleReady(bundleContext, NETVIRT);
-            isBundleReady(bundleContext, NETVIRTPROVIDERS);
-        }
-    }
-
-    /**
-     * Test passive connection mode. The southbound starts in a listening mode waiting for connections on port
-     * 6640. This test will wait for incoming connections for {@link SouthboundITConstants.CONNECTION_INIT_TIMEOUT} ms.
-     *
-     * @throws InterruptedException
-     */
-    @Test
-    public void testPassiveNode() throws InterruptedException {
-        if (connectionType.equalsIgnoreCase(SouthboundITConstants.CONNECTION_TYPE_PASSIVE)) {
-            //Wait for CONNECTION_INIT_TIMEOUT for the Passive connection to be initiated by the ovsdb-server.
-            Thread.sleep(SouthboundITConstants.CONNECTION_INIT_TIMEOUT);
-        }
-    }
-
-    private ConnectionInfo getConnectionInfo(String addressStr, String portStr) {
-        InetAddress inetAddress = null;
-        try {
-            inetAddress = InetAddress.getByName(addressStr);
-        } catch (UnknownHostException e) {
-            fail("Could not allocate InetAddress: " + e);
-        }
-
-        IpAddress address = SouthboundMapper.createIpAddress(inetAddress);
-        PortNumber port = new PortNumber(Integer.parseInt(portStr));
-
-        LOG.info("connectionInfo: {}", new ConnectionInfoBuilder()
-                .setRemoteIp(address)
-                .setRemotePort(port)
-                .build());
-        return new ConnectionInfoBuilder()
-                       .setRemoteIp(address)
-                       .setRemotePort(port)
-                       .build();
-    }
-
-    private String connectionInfoToString(ConnectionInfo connectionInfo) {
-        return new String(connectionInfo.getRemoteIp().getValue()) + ":" + connectionInfo.getRemotePort().getValue();
-    }
-
-    @Test
-    public void testNetworkTopology() throws InterruptedException {
-        NetworkTopology networkTopology = mdsalUtils.read(LogicalDatastoreType.CONFIGURATION,
-                InstanceIdentifier.create(NetworkTopology.class));
-        Assert.assertNotNull("NetworkTopology could not be found in " + LogicalDatastoreType.CONFIGURATION,
-                networkTopology);
-
-        networkTopology = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL,
-                InstanceIdentifier.create(NetworkTopology.class));
-        Assert.assertNotNull("NetworkTopology could not be found in " + LogicalDatastoreType.OPERATIONAL,
-                networkTopology);
-    }
-
-    @Test
-    public void testOvsdbTopology() throws InterruptedException {
-        InstanceIdentifier<Topology> path = InstanceIdentifier
-                .create(NetworkTopology.class)
-                .child(Topology.class, new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID));
-
-        Topology topology = mdsalUtils.read(LogicalDatastoreType.CONFIGURATION, path);
-        Assert.assertNotNull("Topology could not be found in " + LogicalDatastoreType.CONFIGURATION,
-                topology);
-
-        topology = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, path);
-
-        Assert.assertNotNull("Topology could not be found in " + LogicalDatastoreType.OPERATIONAL,
-                topology);
-    }
-
-    private boolean addOvsdbNode(ConnectionInfo connectionInfo) throws InterruptedException {
-        boolean result = mdsalUtils.put(LogicalDatastoreType.CONFIGURATION,
-                SouthboundMapper.createInstanceIdentifier(connectionInfo),
-                SouthboundMapper.createNode(connectionInfo));
-        Thread.sleep(OVSDB_UPDATE_TIMEOUT);
-        return result;
-    }
-
-    private Node getOvsdbNode(ConnectionInfo connectionInfo) {
-        Node node = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL,
-                SouthboundMapper.createInstanceIdentifier(connectionInfo));
-        return node;
-    }
-
-    private boolean deleteOvsdbNode(ConnectionInfo connectionInfo) throws InterruptedException {
-        boolean result = mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION,
-                SouthboundMapper.createInstanceIdentifier(connectionInfo));
-        Thread.sleep(OVSDB_UPDATE_TIMEOUT);
-        return result;
-    }
-
-    private Node connectOvsdbNode(ConnectionInfo connectionInfo) throws InterruptedException {
-        Assert.assertTrue(addOvsdbNode(connectionInfo));
-        Node node = getOvsdbNode(connectionInfo);
-        Assert.assertNotNull(node);
-        LOG.info("Connected to {}", connectionInfoToString(connectionInfo));
-        return node;
-    }
-
-    private boolean disconnectOvsdbNode(ConnectionInfo connectionInfo) throws InterruptedException {
-        Assert.assertTrue(deleteOvsdbNode(connectionInfo));
-        Node node = getOvsdbNode(connectionInfo);
-        //Assert.assertNull(node);
-        Assume.assumeNotNull(node);
-        LOG.info("Disconnected from {}", connectionInfoToString(connectionInfo));
-        return true;
-    }
-
-    @Test
-    public void testAddDeleteOvsdbNode() throws InterruptedException {
-        ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portStr);
-        Node ovsdbNode = connectOvsdbNode(connectionInfo);
-        //Assert.assertFalse(disconnectOvsdbNode(connectionInfo));
-        Assume.assumeTrue(disconnectOvsdbNode(connectionInfo));
-    }
-
-    @Test
-    public void testOvsdbNodeOvsVersion() throws InterruptedException {
-        ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portStr);
-        Node ovsdbNode = connectOvsdbNode(connectionInfo);
-        OvsdbNodeAugmentation augment = ovsdbNode.getAugmentation(OvsdbNodeAugmentation.class);
-        assertNotNull(augment.getOvsVersion());
-        Assume.assumeTrue(disconnectOvsdbNode(connectionInfo));
-    }
-
-    @Test
-    public void testOpenVSwitchOtherConfig() throws InterruptedException {
-        ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portStr);
-        Node ovsdbNode = connectOvsdbNode(connectionInfo);
-        OvsdbNodeAugmentation ovsdbNodeAugmentation = ovsdbNode.getAugmentation(OvsdbNodeAugmentation.class);
-        assertNotNull(ovsdbNodeAugmentation);
-        List<OpenvswitchOtherConfigs> otherConfigsList = ovsdbNodeAugmentation.getOpenvswitchOtherConfigs();
-        if (otherConfigsList != null) {
-            for (OpenvswitchOtherConfigs otherConfig : otherConfigsList) {
-                if (otherConfig.getOtherConfigKey().equals("local_ip")) {
-                    LOG.info("local_ip: {}", otherConfig.getOtherConfigValue());
-                    break;
-                } else {
-                    LOG.info("other_config {}:{}", otherConfig.getOtherConfigKey(), otherConfig.getOtherConfigValue());
-                }
-            }
-        } else {
-            LOG.info("other_config is not present");
-        }
-        //Assert.assertFalse(disconnectOvsdbNode(connectionInfo));
-        Assume.assumeTrue(disconnectOvsdbNode(connectionInfo));
-    }
-
-    private void setManagedBy(OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder,
-                              ConnectionInfo connectionInfo) {
-        InstanceIdentifier<Node> connectionNodePath = SouthboundMapper.createInstanceIdentifier(connectionInfo);
-        ovsdbBridgeAugmentationBuilder.setManagedBy(new OvsdbNodeRef(connectionNodePath));
-    }
-
-    private List<ProtocolEntry> createMdsalProtocols() {
-        List<ProtocolEntry> protocolList = new ArrayList<ProtocolEntry>();
-        ImmutableBiMap<String, Class<? extends OvsdbBridgeProtocolBase>> mapper =
-                SouthboundConstants.OVSDB_PROTOCOL_MAP.inverse();
-        protocolList.add(new ProtocolEntryBuilder().
-                setProtocol((Class<? extends OvsdbBridgeProtocolBase>) mapper.get("OpenFlow13")).build());
-        return protocolList;
-    }
-
-    private OvsdbTerminationPointAugmentationBuilder createGenericOvsdbTerminationPointAugmentationBuilder() {
-        OvsdbTerminationPointAugmentationBuilder ovsdbTerminationPointAugmentationBuilder =
-                new OvsdbTerminationPointAugmentationBuilder();
-        ovsdbTerminationPointAugmentationBuilder.setInterfaceType(
-                new InterfaceTypeEntryBuilder()
-                        .setInterfaceType(
-                                SouthboundMapper.createInterfaceType("internal"))
-                        .build().getInterfaceType());
-        return ovsdbTerminationPointAugmentationBuilder;
-    }
-
-    private boolean addTerminationPoint(NodeId bridgeNodeId, String portName,
-            OvsdbTerminationPointAugmentationBuilder ovsdbTerminationPointAugmentationBuilder)
-        throws InterruptedException {
-
-        InstanceIdentifier<Node> portIid = SouthboundMapper.createInstanceIdentifier(bridgeNodeId);
-        NodeBuilder portNodeBuilder = new NodeBuilder();
-        NodeId portNodeId = SouthboundMapper.createManagedNodeId(portIid);
-        portNodeBuilder.setNodeId(portNodeId);
-        TerminationPointBuilder entry = new TerminationPointBuilder();
-        entry.setKey(new TerminationPointKey(new TpId(portName)));
-        entry.addAugmentation(
-                OvsdbTerminationPointAugmentation.class,
-                ovsdbTerminationPointAugmentationBuilder.build());
-        portNodeBuilder.setTerminationPoint(Lists.newArrayList(entry.build()));
-        boolean result = mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION,
-                portIid, portNodeBuilder.build());
-        Thread.sleep(OVSDB_UPDATE_TIMEOUT);
-        return result;
-    }
-
-    private boolean addBridge(ConnectionInfo connectionInfo, String bridgeName) throws InterruptedException {
-        //Node node = SouthboundMapper.createNode(connectionInfo);
-        NodeBuilder bridgeNodeBuilder = new NodeBuilder();
-        InstanceIdentifier<Node> bridgeIid =
-                SouthboundMapper.createInstanceIdentifier(connectionInfo, new OvsdbBridgeName(bridgeName));
-        NodeId bridgeNodeId = SouthboundMapper.createManagedNodeId(bridgeIid);
-        bridgeNodeBuilder.setNodeId(bridgeNodeId);
-        OvsdbBridgeAugmentationBuilder ovsdbBridgeAugmentationBuilder = new OvsdbBridgeAugmentationBuilder();
-        ovsdbBridgeAugmentationBuilder.setBridgeName(new OvsdbBridgeName(bridgeName));
-        ovsdbBridgeAugmentationBuilder.setProtocolEntry(createMdsalProtocols());
-        ovsdbBridgeAugmentationBuilder.setFailMode(
-                SouthboundConstants.OVSDB_FAIL_MODE_MAP.inverse().get("secure"));
-        setManagedBy(ovsdbBridgeAugmentationBuilder, connectionInfo);
-        bridgeNodeBuilder.addAugmentation(OvsdbBridgeAugmentation.class, ovsdbBridgeAugmentationBuilder.build());
-
-        LOG.debug("Built with the intent to store bridge data {}",
-                ovsdbBridgeAugmentationBuilder.toString());
-
-        boolean result = mdsalUtils.merge(LogicalDatastoreType.CONFIGURATION,
-                bridgeIid, bridgeNodeBuilder.build());
-        Thread.sleep(OVSDB_UPDATE_TIMEOUT);
-        return result;
-    }
-
-    private OvsdbBridgeAugmentation getBridge(ConnectionInfo connectionInfo) {
-        InstanceIdentifier<Node> bridgeIid =
-                SouthboundMapper.createInstanceIdentifier(connectionInfo,
-                        new OvsdbBridgeName(SouthboundITConstants.BRIDGE_NAME));
-        Node bridgeNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, bridgeIid);
-        Assert.assertNotNull(bridgeNode);
-        OvsdbBridgeAugmentation ovsdbBridgeAugmentation = bridgeNode.getAugmentation(OvsdbBridgeAugmentation.class);
-        Assert.assertNotNull(ovsdbBridgeAugmentation);
-        return ovsdbBridgeAugmentation;
-    }
-
-    private boolean deleteBridge(ConnectionInfo connectionInfo) throws InterruptedException {
-        boolean result = mdsalUtils.delete(LogicalDatastoreType.CONFIGURATION,
-                SouthboundMapper.createInstanceIdentifier(connectionInfo,
-                        new OvsdbBridgeName(SouthboundITConstants.BRIDGE_NAME)));
-        Thread.sleep(OVSDB_UPDATE_TIMEOUT);
-        return result;
-    }
-
-    @Test
-    public void testAddDeleteBridge() throws InterruptedException {
-        ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portStr);
-        Node ovsdbNode = connectOvsdbNode(connectionInfo);
-
-        Assert.assertTrue(addBridge(connectionInfo, SouthboundITConstants.BRIDGE_NAME));
-        OvsdbBridgeAugmentation bridge = getBridge(connectionInfo);
-        Assert.assertNotNull(bridge);
-        LOG.info("bridge: {}", bridge);
-
-        Assert.assertTrue(deleteBridge(connectionInfo));
-
-        //Assert.assertFalse(disconnectOvsdbNode(connectionInfo));
-        Assume.assumeTrue(disconnectOvsdbNode(connectionInfo));
-    }
-
-    private InstanceIdentifier<Node> getTpIid(ConnectionInfo connectionInfo, OvsdbBridgeAugmentation bridge) {
-        return SouthboundMapper.createInstanceIdentifier(connectionInfo,
-            bridge.getBridgeName());
-    }
-
-    @Test
-    public void testTerminationPointOfPort() throws InterruptedException {
-        ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portStr);
-        connectOvsdbNode(connectionInfo);
-
-        Assert.assertTrue(addBridge(connectionInfo, SouthboundITConstants.BRIDGE_NAME));
-        OvsdbBridgeAugmentation bridge = getBridge(connectionInfo);
-        Assert.assertNotNull(bridge);
-        LOG.info("bridge: {}", bridge);
-        NodeId nodeId = SouthboundMapper.createManagedNodeId(SouthboundMapper.createInstanceIdentifier(
-                connectionInfo, bridge.getBridgeName()));
-        OvsdbTerminationPointAugmentationBuilder ovsdbTerminationBuilder =
-                createGenericOvsdbTerminationPointAugmentationBuilder();
-        String portName = "testOfPort";
-        ovsdbTerminationBuilder.setName(portName);
-        Long ofPortExpected = new Long(45002);
-        ovsdbTerminationBuilder.setOfport(ofPortExpected);
-        Assert.assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder));
-        InstanceIdentifier<Node> terminationPointIid = getTpIid(connectionInfo, bridge);
-        Node terminationPointNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, terminationPointIid);
-        Assert.assertNotNull(terminationPointNode);
-
-        List<TerminationPoint> terminationPoints = terminationPointNode.getTerminationPoint();
-        for (TerminationPoint terminationPoint : terminationPoints) {
-            OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation =
-                    terminationPoint.getAugmentation(OvsdbTerminationPointAugmentation.class);
-            if (ovsdbTerminationPointAugmentation.getName().equals(portName)) {
-                Long ofPort = ovsdbTerminationPointAugmentation.getOfport();
-                // if ephemeral port 45002 is in use, ofPort is set to 1
-                Assert.assertTrue(ofPort.equals(ofPortExpected) || ofPort.equals(new Long(1)));
-                LOG.info("ofPort: {}", ofPort);
-            }
-        }
-        Assert.assertTrue(deleteBridge(connectionInfo));
-    }
-
-    @Test
-    public void testTerminationPointOfPortRequest() throws InterruptedException {
-        ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portStr);
-        connectOvsdbNode(connectionInfo);
-        Assert.assertTrue(addBridge(connectionInfo, SouthboundITConstants.BRIDGE_NAME));
-        OvsdbBridgeAugmentation bridge = getBridge(connectionInfo);
-        Assert.assertNotNull(bridge);
-        NodeId nodeId = SouthboundMapper.createManagedNodeId(SouthboundMapper.createInstanceIdentifier(
-                connectionInfo, bridge.getBridgeName()));
-        OvsdbTerminationPointAugmentationBuilder ovsdbTerminationBuilder =
-                createGenericOvsdbTerminationPointAugmentationBuilder();
-        String portName = "testOfPortRequest";
-        ovsdbTerminationBuilder.setName(portName);
-        Long ofPortExpected = new Long(45008);
-        Integer ofPortRequestExpected = ofPortExpected.intValue();
-        Long ofPortInput = new Long(45008);
-        ovsdbTerminationBuilder.setOfport(ofPortInput);
-        ovsdbTerminationBuilder.setOfportRequest(ofPortRequestExpected);
-        Assert.assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder));
-        InstanceIdentifier<Node> terminationPointIid = getTpIid(connectionInfo, bridge);
-        Node terminationPointNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, terminationPointIid);
-        Assert.assertNotNull(terminationPointNode);
-
-        List<TerminationPoint> terminationPoints = terminationPointNode.getTerminationPoint();
-        for (TerminationPoint terminationPoint : terminationPoints) {
-            OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation =
-                    terminationPoint.getAugmentation(OvsdbTerminationPointAugmentation.class);
-            if (ovsdbTerminationPointAugmentation.getName().equals(portName)) {
-                Long ofPort = ovsdbTerminationPointAugmentation.getOfport();
-                // if ephemeral port 45002 is in use, ofPort is set to 1
-                Assert.assertTrue(ofPort.equals(ofPortExpected) || ofPort.equals(new Long(1)));
-                LOG.info("ofPort: {}", ofPort);
-
-                Integer ofPortRequest = ovsdbTerminationPointAugmentation.getOfportRequest();
-                Assert.assertTrue(ofPortRequest.equals(ofPortRequestExpected));
-                LOG.info("ofPortRequest: {}", ofPortRequest);
-            }
-        }
-        Assert.assertTrue(deleteBridge(connectionInfo));
-    }
-
-    @Test
-    public void testTerminationPointPortExternalIds() throws InterruptedException {
-        ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portStr);
-        connectOvsdbNode(connectionInfo);
-        Assert.assertTrue(addBridge(connectionInfo, SouthboundITConstants.BRIDGE_NAME));
-        OvsdbBridgeAugmentation bridge = getBridge(connectionInfo);
-        Assert.assertNotNull(bridge);
-        NodeId nodeId = SouthboundMapper.createManagedNodeId(SouthboundMapper.createInstanceIdentifier(
-                connectionInfo, bridge.getBridgeName()));
-        OvsdbTerminationPointAugmentationBuilder ovsdbTerminationBuilder =
-                createGenericOvsdbTerminationPointAugmentationBuilder();
-        String portName = "testPortExternalIds";
-        ovsdbTerminationBuilder.setName(portName);
-        //setup
-        PortExternalIdsBuilder externalIdsBuilder1 = new PortExternalIdsBuilder();
-        externalIdsBuilder1.setExternalIdKey("portExternalIdKey1");
-        externalIdsBuilder1.setExternalIdValue("portExternalIdValue1");
-        PortExternalIdsBuilder externalIdsBuilder2 = new PortExternalIdsBuilder();
-        externalIdsBuilder2.setExternalIdKey("portExternalIdKey2");
-        externalIdsBuilder2.setExternalIdValue("portExternalIdValue2");
-        List<PortExternalIds> portExternalIds = Lists.newArrayList(externalIdsBuilder1.build(),
-                externalIdsBuilder2.build());
-        ovsdbTerminationBuilder.setPortExternalIds(portExternalIds);
-
-        Assert.assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder));
-        InstanceIdentifier<Node> terminationPointIid = getTpIid(connectionInfo, bridge);
-        Node terminationPointNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, terminationPointIid);
-        Assert.assertNotNull(terminationPointNode);
-
-        List<TerminationPoint> terminationPoints = terminationPointNode.getTerminationPoint();
-        for (TerminationPoint terminationPoint : terminationPoints) {
-            OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation =
-                    terminationPoint.getAugmentation(OvsdbTerminationPointAugmentation.class);
-            if (ovsdbTerminationPointAugmentation.getName().equals(portName)) {
-                List<PortExternalIds> actualPortExternalIds = ovsdbTerminationPointAugmentation.getPortExternalIds();
-                Assert.assertTrue((portExternalIds.size() == actualPortExternalIds.size()));
-                for (PortExternalIds portExternalId : portExternalIds) {
-                    Assert.assertTrue(actualPortExternalIds.contains(portExternalId));
-                }
-            }
-        }
-        Assert.assertTrue(deleteBridge(connectionInfo));
-    }
-
-    @Test
-    public void testTerminationPointInterfaceExternalIds() throws InterruptedException {
-        ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portStr);
-        connectOvsdbNode(connectionInfo);
-        Assert.assertTrue(addBridge(connectionInfo, SouthboundITConstants.BRIDGE_NAME));
-        OvsdbBridgeAugmentation bridge = getBridge(connectionInfo);
-        Assert.assertNotNull(bridge);
-        NodeId nodeId = SouthboundMapper.createManagedNodeId(SouthboundMapper.createInstanceIdentifier(
-                connectionInfo, bridge.getBridgeName()));
-        OvsdbTerminationPointAugmentationBuilder ovsdbTerminationBuilder =
-                createGenericOvsdbTerminationPointAugmentationBuilder();
-        String portName = "testInterfaceExternalIds";
-        ovsdbTerminationBuilder.setName(portName);
-        //setup
-        InterfaceExternalIdsBuilder externalIdsBuilder1 = new InterfaceExternalIdsBuilder();
-        externalIdsBuilder1.setExternalIdKey("interfaceExternalIdKey1");
-        externalIdsBuilder1.setExternalIdValue("interfaceExternalIdValue1");
-        InterfaceExternalIdsBuilder externalIdsBuilder2 = new InterfaceExternalIdsBuilder();
-        externalIdsBuilder2.setExternalIdKey("interfaceExternalIdKey2");
-        externalIdsBuilder2.setExternalIdValue("interfaceExternalIdValue2");
-        List<InterfaceExternalIds> interfaceExternalIds = Lists.newArrayList(externalIdsBuilder1.build(),
-                externalIdsBuilder2.build());
-        ovsdbTerminationBuilder.setInterfaceExternalIds(interfaceExternalIds);
-
-        Assert.assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder));
-        InstanceIdentifier<Node> terminationPointIid = getTpIid(connectionInfo, bridge);
-        Node terminationPointNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, terminationPointIid);
-        Assert.assertNotNull(terminationPointNode);
-
-        List<TerminationPoint> terminationPoints = terminationPointNode.getTerminationPoint();
-        for (TerminationPoint terminationPoint : terminationPoints) {
-            OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation =
-                    terminationPoint.getAugmentation(OvsdbTerminationPointAugmentation.class);
-            if (ovsdbTerminationPointAugmentation.getName().equals(portName)) {
-                List<InterfaceExternalIds> actualInterfaceExternalIds = ovsdbTerminationPointAugmentation.
-                        getInterfaceExternalIds();
-                Assert.assertTrue((interfaceExternalIds.size() == actualInterfaceExternalIds.size()));
-                for (InterfaceExternalIds interfaceExternalId : interfaceExternalIds) {
-                    Assert.assertTrue(actualInterfaceExternalIds.contains(interfaceExternalId));
-                }
-            }
-        }
-        Assert.assertTrue(deleteBridge(connectionInfo));
-    }
-
-    @Test
-    public void testTerminationPointOptions() throws InterruptedException {
-        ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portStr);
-        connectOvsdbNode(connectionInfo);
-        Assert.assertTrue(addBridge(connectionInfo, SouthboundITConstants.BRIDGE_NAME));
-        OvsdbBridgeAugmentation bridge = getBridge(connectionInfo);
-        Assert.assertNotNull(bridge);
-        NodeId nodeId = SouthboundMapper.createManagedNodeId(SouthboundMapper.createInstanceIdentifier(
-                connectionInfo, bridge.getBridgeName()));
-        OvsdbTerminationPointAugmentationBuilder ovsdbTerminationBuilder =
-                createGenericOvsdbTerminationPointAugmentationBuilder();
-        String portName = "testInterfaceOptions";
-        ovsdbTerminationBuilder.setName(portName);
-        //setup
-        OptionsBuilder optionsBuilder1 = new OptionsBuilder();
-        optionsBuilder1.setOption("option1");
-        optionsBuilder1.setValue("optionValue1");
-        OptionsBuilder optionsBuilder2 = new OptionsBuilder();
-        optionsBuilder2.setOption("option2");
-        optionsBuilder2.setValue("optionValue2");
-        List<Options> options = Lists.newArrayList(optionsBuilder1.build(),
-                optionsBuilder2.build());
-        ovsdbTerminationBuilder.setOptions(options);
-
-        Assert.assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder));
-        InstanceIdentifier<Node> terminationPointIid = getTpIid(connectionInfo, bridge);
-        Node terminationPointNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, terminationPointIid);
-        Assert.assertNotNull(terminationPointNode);
-
-        List<TerminationPoint> terminationPoints = terminationPointNode.getTerminationPoint();
-        for (TerminationPoint terminationPoint : terminationPoints) {
-            OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation =
-                    terminationPoint.getAugmentation(OvsdbTerminationPointAugmentation.class);
-            if (ovsdbTerminationPointAugmentation.getName().equals(portName)) {
-                List<Options> actualOptions = ovsdbTerminationPointAugmentation.
-                        getOptions();
-                Assert.assertTrue((options.size() == actualOptions.size()));
-                for (Options option : options) {
-                    Assert.assertTrue(actualOptions.contains(option));
-                }
-            }
-        }
-        Assert.assertTrue(deleteBridge(connectionInfo));
-    }
-
-    @Test
-    public void testTerminationPointInterfaceOtherConfigs() throws InterruptedException {
-        ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portStr);
-        connectOvsdbNode(connectionInfo);
-        Assert.assertTrue(addBridge(connectionInfo, SouthboundITConstants.BRIDGE_NAME));
-        OvsdbBridgeAugmentation bridge = getBridge(connectionInfo);
-        Assert.assertNotNull(bridge);
-        NodeId nodeId = SouthboundMapper.createManagedNodeId(SouthboundMapper.createInstanceIdentifier(
-                connectionInfo, bridge.getBridgeName()));
-        OvsdbTerminationPointAugmentationBuilder ovsdbTerminationBuilder =
-                createGenericOvsdbTerminationPointAugmentationBuilder();
-        String portName = "testInterfaceOtherConfigs";
-        ovsdbTerminationBuilder.setName(portName);
-        //setup
-        InterfaceOtherConfigsBuilder interfaceBuilder1 = new InterfaceOtherConfigsBuilder();
-        interfaceBuilder1.setOtherConfigKey("interfaceOtherConfigsKey1");
-        interfaceBuilder1.setOtherConfigValue("interfaceOtherConfigsValue1");
-        InterfaceOtherConfigsBuilder interfaceBuilder2 = new InterfaceOtherConfigsBuilder();
-        interfaceBuilder2.setOtherConfigKey("interfaceOtherConfigsKey2");
-        interfaceBuilder2.setOtherConfigValue("interfaceOtherConfigsValue2");
-        List<InterfaceOtherConfigs> interfaceOtherConfigs = Lists.newArrayList(interfaceBuilder1.build(),
-                interfaceBuilder2.build());
-        ovsdbTerminationBuilder.setInterfaceOtherConfigs(interfaceOtherConfigs);
-
-        Assert.assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder));
-        Thread.sleep(1000);
-        InstanceIdentifier<Node> terminationPointIid = getTpIid(connectionInfo, bridge);
-        Node terminationPointNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, terminationPointIid);
-        Assert.assertNotNull(terminationPointNode);
-
-        List<TerminationPoint> terminationPoints = terminationPointNode.getTerminationPoint();
-        for (TerminationPoint terminationPoint : terminationPoints) {
-            OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation =
-                    terminationPoint.getAugmentation(OvsdbTerminationPointAugmentation.class);
-            if (ovsdbTerminationPointAugmentation.getName().equals(portName)) {
-                List<InterfaceOtherConfigs> actualInterfaceOtherConfigs = ovsdbTerminationPointAugmentation.
-                        getInterfaceOtherConfigs();
-                Assert.assertNotNull(actualInterfaceOtherConfigs);
-                Assert.assertNotNull(interfaceOtherConfigs);
-                Assert.assertTrue(interfaceOtherConfigs.size() == actualInterfaceOtherConfigs.size());
-                for (InterfaceOtherConfigs interfaceOtherConfig : interfaceOtherConfigs) {
-                    Assert.assertTrue(actualInterfaceOtherConfigs.contains(interfaceOtherConfig));
-                }
-            }
-        }
-        Assert.assertTrue(deleteBridge(connectionInfo));
-    }
-
-    @Test
-    public void testTerminationPointPortOtherConfigs() throws InterruptedException {
-        ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portStr);
-        connectOvsdbNode(connectionInfo);
-        Assert.assertTrue(addBridge(connectionInfo, SouthboundITConstants.BRIDGE_NAME));
-        OvsdbBridgeAugmentation bridge = getBridge(connectionInfo);
-        Assert.assertNotNull(bridge);
-        NodeId nodeId = SouthboundMapper.createManagedNodeId(SouthboundMapper.createInstanceIdentifier(
-                connectionInfo, bridge.getBridgeName()));
-        OvsdbTerminationPointAugmentationBuilder ovsdbTerminationBuilder =
-                createGenericOvsdbTerminationPointAugmentationBuilder();
-        String portName = "testPortOtherConfigs";
-        ovsdbTerminationBuilder.setName(portName);
-        //setup
-        PortOtherConfigsBuilder portBuilder1 = new PortOtherConfigsBuilder();
-        portBuilder1.setOtherConfigKey("portOtherConfigsKey1");
-        portBuilder1.setOtherConfigValue("portOtherConfigsValue1");
-        PortOtherConfigsBuilder portBuilder2 = new PortOtherConfigsBuilder();
-        portBuilder2.setOtherConfigKey("portOtherConfigsKey2");
-        portBuilder2.setOtherConfigValue("portOtherConfigsValue2");
-        List<PortOtherConfigs> portOtherConfigs = Lists.newArrayList(portBuilder1.build(),
-                portBuilder2.build());
-        ovsdbTerminationBuilder.setPortOtherConfigs(portOtherConfigs);
-
-        Assert.assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder));
-        InstanceIdentifier<Node> terminationPointIid = getTpIid(connectionInfo, bridge);
-        Node terminationPointNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, terminationPointIid);
-        Assert.assertNotNull(terminationPointNode);
-
-        List<TerminationPoint> terminationPoints = terminationPointNode.getTerminationPoint();
-        for (TerminationPoint terminationPoint : terminationPoints) {
-            OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation =
-                    terminationPoint.getAugmentation(OvsdbTerminationPointAugmentation.class);
-            if (ovsdbTerminationPointAugmentation.getName().equals(portName)) {
-                List<PortOtherConfigs> actualPortOtherConfigs = ovsdbTerminationPointAugmentation.
-                        getPortOtherConfigs();
-                Assert.assertTrue((portOtherConfigs.size() == actualPortOtherConfigs.size()));
-                for (PortOtherConfigs portOtherConfig : portOtherConfigs) {
-                    Assert.assertTrue(actualPortOtherConfigs.contains(portOtherConfig));
-                }
-            }
-        }
-        Assert.assertTrue(deleteBridge(connectionInfo));
-    }
-
-    @Test
-    public void testTerminationPointVlan() throws InterruptedException {
-        ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portStr);
-        connectOvsdbNode(connectionInfo);
-        Assert.assertTrue(addBridge(connectionInfo, SouthboundITConstants.BRIDGE_NAME));
-        OvsdbBridgeAugmentation bridge = getBridge(connectionInfo);
-        Assert.assertNotNull(bridge);
-        NodeId nodeId = SouthboundMapper.createManagedNodeId(SouthboundMapper.createInstanceIdentifier(
-                connectionInfo, bridge.getBridgeName()));
-        OvsdbTerminationPointAugmentationBuilder ovsdbTerminationBuilder =
-                createGenericOvsdbTerminationPointAugmentationBuilder();
-        String portName = "testTerminationPointVlanId";
-        ovsdbTerminationBuilder.setName(portName);
-        //setup
-        Integer vlanId = new Integer(4000);
-        ovsdbTerminationBuilder.setVlanTag(new VlanId(vlanId));
-
-        Assert.assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder));
-        InstanceIdentifier<Node> terminationPointIid = getTpIid(connectionInfo, bridge);
-        Node terminationPointNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, terminationPointIid);
-        Assert.assertNotNull(terminationPointNode);
-
-        List<TerminationPoint> terminationPoints = terminationPointNode.getTerminationPoint();
-        for (TerminationPoint terminationPoint : terminationPoints) {
-            OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation =
-                    terminationPoint.getAugmentation(OvsdbTerminationPointAugmentation.class);
-            if (ovsdbTerminationPointAugmentation.getName().equals(portName)) {
-                //test
-                VlanId actualVlanId = ovsdbTerminationPointAugmentation.getVlanTag();
-                Assert.assertNotNull(actualVlanId);
-                Integer actualVlanIdInt = actualVlanId.getValue();
-                Assert.assertTrue(actualVlanIdInt.equals(vlanId));
-            }
-        }
-        Assert.assertTrue(deleteBridge(connectionInfo));
-    }
-
-    @Test
-    public void testTerminationPointVlanModes() throws InterruptedException {
-        VlanMode []vlanModes = VlanMode.values();
-        for (VlanMode vlanMode : vlanModes) {
-            ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portStr);
-            connectOvsdbNode(connectionInfo);
-            Assert.assertTrue(addBridge(connectionInfo, SouthboundITConstants.BRIDGE_NAME));
-            OvsdbBridgeAugmentation bridge = getBridge(connectionInfo);
-            Assert.assertNotNull(bridge);
-            NodeId nodeId = SouthboundMapper.createManagedNodeId(SouthboundMapper.createInstanceIdentifier(
-                    connectionInfo, bridge.getBridgeName()));
-            OvsdbTerminationPointAugmentationBuilder ovsdbTerminationBuilder =
-                    createGenericOvsdbTerminationPointAugmentationBuilder();
-            String portName = "testTerminationPointVlanMode" + vlanMode.toString();
-            ovsdbTerminationBuilder.setName(portName);
-            //setup
-            ovsdbTerminationBuilder.setVlanMode(vlanMode);
-            Assert.assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder));
-            InstanceIdentifier<Node> terminationPointIid = getTpIid(connectionInfo, bridge);
-            Node terminationPointNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, terminationPointIid);
-            Assert.assertNotNull(terminationPointNode);
-
-            List<TerminationPoint> terminationPoints = terminationPointNode.getTerminationPoint();
-            for (TerminationPoint terminationPoint : terminationPoints) {
-                OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation =
-                        terminationPoint.getAugmentation(OvsdbTerminationPointAugmentation.class);
-                if (ovsdbTerminationPointAugmentation.getName().equals(portName)) {
-                    //test
-                    Assert.assertTrue(ovsdbTerminationPointAugmentation.getVlanMode().equals(vlanMode));
-                }
-            }
-            Assert.assertTrue(deleteBridge(connectionInfo));
-        }
-    }
-
-    private ArrayList<Set<Integer>> generateVlanSets() {
-        ArrayList<Set<Integer>> vlanSets = new ArrayList<Set<Integer>>();
-
-        Set<Integer> emptySet = new HashSet<Integer>();
-        vlanSets.add(emptySet);
-
-        Set<Integer> singleSet = new HashSet<Integer>();
-        Integer single = new Integer(2222);
-        singleSet.add(single);
-        vlanSets.add(singleSet);
-
-        Set<Integer> minMaxMiddleSet = new HashSet<Integer>();
-        Integer min = new Integer(0);
-        minMaxMiddleSet.add(min);
-        Integer max = new Integer(4095);
-        minMaxMiddleSet.add(max);
-        Integer minPlusOne = new Integer(min + 1);
-        minMaxMiddleSet.add(minPlusOne);
-        Integer maxMinusOne = new Integer(max - 1);
-        minMaxMiddleSet.add(maxMinusOne);
-        Integer middle = new Integer((max - min) / 2);
-        minMaxMiddleSet.add(middle);
-        vlanSets.add(minMaxMiddleSet);
-
-        return vlanSets;
-    }
-
-    private List<Trunks> buildTrunkList(Set<Integer> trunkSet) {
-        List<Trunks> trunkList = Lists.newArrayList();
-        for (Integer trunk : trunkSet) {
-            TrunksBuilder trunkBuilder = new TrunksBuilder();
-            trunkBuilder.setTrunk(new VlanId(trunk));
-            trunkList.add(trunkBuilder.build());
-        }
-        return trunkList;
-    }
-
-    @Test
-    public void testTerminationPointVlanTrunks() throws InterruptedException {
-        ArrayList<Set<Integer>> vlanSets = generateVlanSets();
-        int testCase = 0;
-        for (Set<Integer> vlanSet : vlanSets) {
-            ++testCase;
-            ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portStr);
-            connectOvsdbNode(connectionInfo);
-            Assert.assertTrue(addBridge(connectionInfo, SouthboundITConstants.BRIDGE_NAME));
-            OvsdbBridgeAugmentation bridge = getBridge(connectionInfo);
-            Assert.assertNotNull(bridge);
-            NodeId nodeId = SouthboundMapper.createManagedNodeId(SouthboundMapper.createInstanceIdentifier(
-                    connectionInfo, bridge.getBridgeName()));
-            OvsdbTerminationPointAugmentationBuilder ovsdbTerminationBuilder =
-                    createGenericOvsdbTerminationPointAugmentationBuilder();
-            String portName = "testTerminationPointVlanTrunks" + testCase;
-            ovsdbTerminationBuilder.setName(portName);
-            //setup
-            List<Trunks> trunks = buildTrunkList(vlanSet);
-            ovsdbTerminationBuilder.setTrunks(trunks);
-            Assert.assertTrue(addTerminationPoint(nodeId, portName, ovsdbTerminationBuilder));
-            InstanceIdentifier<Node> terminationPointIid = getTpIid(connectionInfo, bridge);
-            Node terminationPointNode = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, terminationPointIid);
-            Assert.assertNotNull(terminationPointNode);
-
-            List<TerminationPoint> terminationPoints = terminationPointNode.getTerminationPoint();
-            for (TerminationPoint terminationPoint : terminationPoints) {
-                OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation =
-                        terminationPoint.getAugmentation(OvsdbTerminationPointAugmentation.class);
-                if (ovsdbTerminationPointAugmentation.getName().equals(portName)) {
-                    List<Trunks> actualTrunks = ovsdbTerminationPointAugmentation.getTrunks();
-                    for (Trunks trunk : trunks) {
-                        Assert.assertTrue(actualTrunks.contains(trunk));
-                    }
-                }
-            }
-            Assert.assertTrue(deleteBridge(connectionInfo));
-        }
-    }
-
-    /**
-     * isBundleReady is used to check if the requested bundle is Active
-     */
-    public void isBundleReady(BundleContext bundleContext, String bundleName) throws InterruptedException {
-        boolean ready = false;
-
-        while (!ready) {
-            int state = Bundle.UNINSTALLED;
-            Bundle[] bundles = bundleContext.getBundles();
-            for (Bundle element : bundles) {
-                if (element.getSymbolicName().equals(bundleName)) {
-                    state = element.getState();
-                    LOG.info(">>>>> bundle is ready {}", bundleName);
-                    break;
-                }
-            }
-            if (state != Bundle.ACTIVE) {
-                LOG.info(">>>>> bundle not ready {}", bundleName);
-                Thread.sleep(5000);
-            } else {
-                ready = true;
-            }
-        }
-    }
-
-    @Test
-    public void testNetVirt() throws InterruptedException {
-        LOG.info(">>>>> waiting");
-        Thread.sleep(10000);
-        LOG.info(">>>>> back");
-
-        ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portStr);
-        Node ovsdbNode = connectOvsdbNode(connectionInfo);
-        //Assert.assertFalse(disconnectOvsdbNode(connectionInfo));
-        Assume.assumeTrue(disconnectOvsdbNode(connectionInfo));
-    }
-}
index 20435de2462defff00398da23a15e92a9ebcd9c7..4b708c5e5d5efce3abd7abc00ab600693c0fc39c 100644 (file)
@@ -50,5 +50,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
   <modules>
     <module>net-virt</module>
     <module>net-virt-providers</module>
+    <module>net-virt-it</module>
   </modules>
 </project>