split it-utils: ovsdb-it-utils + netvirt-it-utils 85/37485/5
authorJosh <jhershbe@redhat.com>
Tue, 12 Apr 2016 11:50:27 +0000 (13:50 +0200)
committerSam Hague <shague@redhat.com>
Thu, 14 Apr 2016 16:48:20 +0000 (12:48 -0400)
Change-Id: I5b512b65c3502431f919028a6383178c4f2dd140
Signed-off-by: Josh <jhershbe@redhat.com>
Signed-off-by: Sam Hague <shague@redhat.com>
utils/ovsdb-it-utils/pom.xml [moved from utils/it-utils/pom.xml with 91% similarity]
utils/ovsdb-it-utils/src/main/java/org/opendaylight/ovsdb/utils/ovsdb/it/utils/ItConstants.java [moved from utils/it-utils/src/main/java/org/opendaylight/ovsdb/utils/it/utils/ItConstants.java with 95% similarity]
utils/ovsdb-it-utils/src/main/java/org/opendaylight/ovsdb/utils/ovsdb/it/utils/NodeInfo.java [moved from utils/it-utils/src/main/java/org/opendaylight/ovsdb/utils/it/utils/NodeInfo.java with 91% similarity]
utils/ovsdb-it-utils/src/main/java/org/opendaylight/ovsdb/utils/ovsdb/it/utils/OvsdbItUtils.java [moved from utils/it-utils/src/main/java/org/opendaylight/ovsdb/utils/it/utils/ItUtils.java with 65% similarity]
utils/pom.xml

similarity index 91%
rename from utils/it-utils/pom.xml
rename to utils/ovsdb-it-utils/pom.xml
index 0f3648b4fe947c43720386db71c0fc64da52c457..aba2cd504b8f9b2bcd38af42e854eb8a3c7bc6a0 100644 (file)
@@ -19,7 +19,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
 
   <modelVersion>4.0.0</modelVersion>
   <groupId>org.opendaylight.ovsdb</groupId>
-  <artifactId>utils.it-utils</artifactId>
+  <artifactId>utils.ovsdb-it-utils</artifactId>
   <version>1.3.0-SNAPSHOT</version>
   <packaging>bundle</packaging>
 
@@ -36,17 +36,17 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
           <artifactId>sal-binding-api</artifactId>
       </dependency>
       <dependency>
-          <groupId>org.opendaylight.ovsdb</groupId>
+          <groupId>${project.groupId}</groupId>
           <artifactId>southbound-api</artifactId>
           <version>${project.version}</version>
       </dependency>
       <dependency>
-          <groupId>org.opendaylight.ovsdb</groupId>
+          <groupId>${project.groupId}</groupId>
           <artifactId>utils.mdsal-utils</artifactId>
           <version>${project.version}</version>
       </dependency>
       <dependency>
-          <groupId>org.opendaylight.ovsdb</groupId>
+          <groupId>${project.groupId}</groupId>
           <artifactId>utils.southbound-utils</artifactId>
           <version>${project.version}</version>
       </dependency>
similarity index 95%
rename from utils/it-utils/src/main/java/org/opendaylight/ovsdb/utils/it/utils/ItConstants.java
rename to utils/ovsdb-it-utils/src/main/java/org/opendaylight/ovsdb/utils/ovsdb/it/utils/ItConstants.java
index 4c493e9f331c4338ee653aa8eceed597704bc21e..c4aaf373db3466f3700379d09d1b6b04373d3aaf 100644 (file)
@@ -5,10 +5,11 @@
  * 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.utils.it.utils;
+
+package org.opendaylight.ovsdb.utils.ovsdb.it.utils;
 
 /**
- * Constants for SouthboundIT
+ * Constants for SouthboundIT.
  */
 public final class ItConstants {
     private ItConstants() {
similarity index 91%
rename from utils/it-utils/src/main/java/org/opendaylight/ovsdb/utils/it/utils/NodeInfo.java
rename to utils/ovsdb-it-utils/src/main/java/org/opendaylight/ovsdb/utils/ovsdb/it/utils/NodeInfo.java
index a32c7b4d860c731d07678e0535cac0ad42845a45..1d30cbe66a15636a2865b9f65367fda3028bdc7a 100644 (file)
@@ -6,7 +6,7 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.ovsdb.utils.it.utils;
+package org.opendaylight.ovsdb.utils.ovsdb.it.utils;
 
 import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNotNull;
@@ -14,6 +14,7 @@ import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
 import java.util.List;
+
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.ovsdb.utils.mdsal.utils.NotifyingDataChangeListener;
 import org.opendaylight.ovsdb.utils.southbound.utils.SouthboundUtils;
@@ -40,15 +41,15 @@ public class NodeInfo {
     NotifyingDataChangeListener ovsdbWaiter;
     NotifyingDataChangeListener bridgeWaiter;
     List<NotifyingDataChangeListener> waitList;
-    ItUtils itUtils;
+    OvsdbItUtils itUtils;
 
     /**
-     * Create a new NodeInfo object
+     * Create a new NodeInfo object.
      * @param connectionInfo of the OVSDB node
-     * @param itUtils ItUtils instance
+     * @param itUtils OvsdbItUtils instance
      * @param waitList for tracking outstanding md-sal events
      */
-    NodeInfo(ConnectionInfo connectionInfo, ItUtils itUtils, List<NotifyingDataChangeListener> waitList) {
+    NodeInfo(ConnectionInfo connectionInfo, OvsdbItUtils itUtils, List<NotifyingDataChangeListener> waitList) {
         this.connectionInfo = connectionInfo;
         this.itUtils = itUtils;
         this.waitList = waitList;
@@ -59,7 +60,7 @@ public class NodeInfo {
     /**
      * Connect to the OVSDB node, wait for the connection to be established and for the integration bridge
      * to be successfully created. Contains assertions for unexpected states
-     * @throws InterruptedException
+     * @throws InterruptedException if interrupted while waiting for connection
      */
     public void connect() throws InterruptedException {
         ovsdbWaiter = new NotifyingDataChangeListener(LogicalDatastoreType.OPERATIONAL, ovsdbIid, waitList);
@@ -87,7 +88,7 @@ public class NodeInfo {
 
     /**
      * Remove integration bridge and teardown connection. Contains assertions for unexpected states.
-     * @throws InterruptedException
+     * @throws InterruptedException if interrupted while waiting for disconnect to complete
      */
     public void disconnect() throws InterruptedException {
         assertTrue(itUtils.southboundUtils.deleteBridge(connectionInfo, INTEGRATION_BRIDGE_NAME, 0));
similarity index 65%
rename from utils/it-utils/src/main/java/org/opendaylight/ovsdb/utils/it/utils/ItUtils.java
rename to utils/ovsdb-it-utils/src/main/java/org/opendaylight/ovsdb/utils/ovsdb/it/utils/OvsdbItUtils.java
index f8b9676773608deb4ca55c187a378baccf95d768..436f199966a2ea66112668d03fb546972bd4b9f1 100644 (file)
@@ -6,55 +6,49 @@
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
 
-package org.opendaylight.ovsdb.utils.it.utils;
+package org.opendaylight.ovsdb.utils.ovsdb.it.utils;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
 import java.util.List;
+
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
 import org.opendaylight.ovsdb.utils.mdsal.utils.MdsalUtils;
 import org.opendaylight.ovsdb.utils.mdsal.utils.NotifyingDataChangeListener;
 import org.opendaylight.ovsdb.utils.southbound.utils.SouthboundUtils;
-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.OvsdbBridgeAugmentation;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.bridge.attributes.ControllerEntry;
 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.TopologyId;
-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.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
  * This class contains various utility methods used in OVSDB integration tests (IT).
  */
-public class ItUtils {
-    private static final Logger LOG = LoggerFactory.getLogger(ItUtils.class);
+public class OvsdbItUtils {
+    private static final Logger LOG = LoggerFactory.getLogger(OvsdbItUtils.class);
     MdsalUtils mdsalUtils;
     SouthboundUtils southboundUtils;
     DataBroker dataBroker;
 
     /**
-     * Create a new ItUtils instance
+     * Create a new OvsdbItUtils instance.
      * @param dataBroker  md-sal data broker
      */
-    public ItUtils(DataBroker dataBroker) {
+    public OvsdbItUtils(DataBroker dataBroker) {
         this.dataBroker = dataBroker;
         mdsalUtils = new MdsalUtils(dataBroker);
         southboundUtils = new SouthboundUtils(mdsalUtils);
     }
 
     /**
-     * Get a NodeInfo instance initialized with this ItUtil's DataBroker
+     * Get a NodeInfo instance initialized with this ItUtil's DataBroker.
      * @param connectionInfo ConnectionInfo for the OVSDB server
      * @param waitList For tracking outstanding md-sal events notifications
-     * @return
+     * @return a new NodeInfo object
      */
     public NodeInfo createNodeInfo(ConnectionInfo connectionInfo, List<NotifyingDataChangeListener> waitList) {
         return new NodeInfo(connectionInfo, this, waitList);
@@ -65,7 +59,7 @@ public class ItUtils {
      * AssertionError for any number of unexpected states.
      * @param connectionInfo
      * @return true if connected
-     * @throws InterruptedException
+     * @throws InterruptedException if interrupted while waiting for connection to appear
      */
     public boolean isControllerConnected(ConnectionInfo connectionInfo) throws InterruptedException {
         LOG.info("isControllerConnected enter");
@@ -94,33 +88,15 @@ public class ItUtils {
         return false;
     }
 
+    /**
+     * Get a DataBroker and assert that it is not null.
+     * @param providerContext ProviderContext from which to retrieve the DataBroker
+     * @return the Databroker
+     */
     public static DataBroker getDatabroker(BindingAwareBroker.ProviderContext providerContext) {
         DataBroker dataBroker = providerContext.getSALService(DataBroker.class);
         assertNotNull("dataBroker should not be null", dataBroker);
         return dataBroker;
     }
 
-    public Boolean getNetvirtTopology() {
-        LOG.info("getNetvirtTopology: looking for {}...", ItConstants.NETVIRT_TOPOLOGY_ID);
-        Boolean found = false;
-        final TopologyId topologyId = new TopologyId(new Uri(ItConstants.NETVIRT_TOPOLOGY_ID));
-        InstanceIdentifier<Topology> path =
-                InstanceIdentifier.create(NetworkTopology.class).child(Topology.class, new TopologyKey(topologyId));
-        for (int i = 0; i < 60; i++) {
-            Topology topology = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, path);
-            if (topology != null) {
-                LOG.info("getNetvirtTopology: found {}...", ItConstants.NETVIRT_TOPOLOGY_ID);
-                found = true;
-                break;
-            } else {
-                LOG.info("getNetvirtTopology: still looking (try {})...", i);
-                try {
-                    Thread.sleep(1000);
-                } catch (InterruptedException e) {
-                    LOG.warn("Interrupted while waiting for {}", ItConstants.NETVIRT_TOPOLOGY_ID, e);
-                }
-            }
-        }
-        return found;
-    }
 }
index a0899b0e09ed54bf537b03daf71eef453734faa1..1ed1de2c58f84fc8344337b1872fa8040af0b09d 100644 (file)
@@ -51,10 +51,10 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
   <modules>
     <module>config</module>
     <module>hwvtepsouthbound-utils</module>
-    <module>it-utils</module>
     <module>mdsal-node</module>
     <module>mdsal-openflow</module>
     <module>mdsal-utils</module>
+    <module>ovsdb-it-utils</module>
     <module>servicehelper</module>
     <module>southbound-utils</module>
     <module>yang-utils</module>