Add IT for getting Open_vSwitch other_config:local_ip 66/18366/5
authorSam Hague <shague@redhat.com>
Wed, 15 Apr 2015 18:02:22 +0000 (14:02 -0400)
committerSam Hague <shague@redhat.com>
Wed, 15 Apr 2015 20:14:06 +0000 (16:14 -0400)
Patchset 5: Rebase woes

Change-Id: If713ef7401cb56e571b12741dbd7a5d30d08e042
Signed-off-by: Sam Hague <shague@redhat.com>
southbound/southbound-it/src/test/java/org/opendaylight/ovsdb/southbound/it/SouthboundIT.java

index 1b865fe3b206fc4cae44ce4e59c05734dd2b8d9f..ca66faff624da4b4439d2411d451871fc22ddc2a 100644 (file)
@@ -24,12 +24,14 @@ import com.google.common.util.concurrent.ListenableFuture;
 
 import java.net.InetAddress;
 import java.net.UnknownHostException;
+import java.util.List;
 import java.util.Properties;
 import java.util.concurrent.ExecutionException;
 
 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;
@@ -44,8 +46,10 @@ 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.params.xml.ns.yang.ovsdb.rev150105.OvsdbNodeAugmentation;
 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.OpenvswitchOtherConfigs;
 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.network.topology.Topology;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
@@ -406,4 +410,40 @@ public class SouthboundIT extends AbstractMdsalTestBase {
         Assert.assertNotNull("Topology could not be found in " + LogicalDatastoreType.OPERATIONAL,
                 topology);
     }
+
+    public Node connectNode(String addressStr, String portStr) throws InterruptedException {
+        LOG.error(">>>>> connectNode");
+        addNode("192.168.120.31", "6640");
+        Thread.sleep(1000);
+        Node node = readNode("192.168.120.31", "6640", LogicalDatastoreType.OPERATIONAL);
+        assertNotNull(node);
+        LOG.info("Connected node: {}", node);
+        return node;
+    }
+
+    public void disconnectNode(String addressStr, String portStr) throws InterruptedException {
+        LOG.error(">>>>> disconnectNode");
+        deleteNode("192.168.120.31", "6640");
+        Thread.sleep(1000);
+        LOG.error(">>>>> disconnectNode checking operational");
+        Node node = readNode("192.168.120.31", "6640", LogicalDatastoreType.OPERATIONAL);
+        Assume.assumeNotNull(node);
+    }
+
+    @Test
+    public void testOpenVSwitchOtherConfig() throws InterruptedException {
+        Node node = connectNode(addressStr, portStr);
+        OvsdbNodeAugmentation ovsdbNodeAugmentation = node.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;
+                }
+            }
+        }
+        disconnectNode(addressStr, portStr);
+    }
 }