Add testGetOvsdbNodes to it 93/19393/1
authorSam Hague <shague@redhat.com>
Thu, 30 Apr 2015 16:11:51 +0000 (12:11 -0400)
committerSam Hague <shague@redhat.com>
Thu, 30 Apr 2015 16:11:51 +0000 (12:11 -0400)
Change-Id: I33d1051bad7a220d14e569642a358ed9d929acf0
Signed-off-by: Sam Hague <shague@redhat.com>
southbound/southbound-it/src/test/java/org/opendaylight/ovsdb/southbound/it/SouthboundIT.java

index 1d803c52ae0a1cd5d22c77c062ffdf8b2018b0d8..7314826af263a45e39b27c182879c624b272cd76 100644 (file)
@@ -73,6 +73,7 @@ import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.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.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;
@@ -975,6 +976,23 @@ public class SouthboundIT extends AbstractMdsalTestBase {
         }
     }
 
+    @Test
+    public void testGetOvsdbNodes() throws InterruptedException {
+        ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portStr);
+        connectOvsdbNode(connectionInfo);
+        InstanceIdentifier<Topology> topologyPath = InstanceIdentifier
+                .create(NetworkTopology.class)
+                .child(Topology.class, new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID));
+
+        Topology topology = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, topologyPath);
+        Assert.assertEquals("There should only be one node in the topology", 1, topology.getNode().size());
+        InstanceIdentifier<Node> expectedNodeIid = SouthboundMapper.createInstanceIdentifier(connectionInfo);
+        Node node = topology.getNode().iterator().next();
+        NodeId expectedNodeId = expectedNodeIid.firstKeyOf(Node.class, NodeKey.class).getNodeId();
+        Assert.assertEquals(expectedNodeId, node.getNodeId());
+        Assert.assertTrue(disconnectOvsdbNode(connectionInfo));
+    }
+
     /**
      * isBundleReady is used to check if the requested bundle is Active
      */