Merge "Change all the tests that need an ovsdb controller to integration tests and...
authorMadhu Venugopal <mavenugo@gmail.com>
Sat, 9 Nov 2013 07:52:33 +0000 (07:52 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Sat, 9 Nov 2013 07:52:33 +0000 (07:52 +0000)
16 files changed:
ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OVSDBTestGetBridgeDomains.java [deleted file]
ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OVSDBTestGetBridgeDomainsIT.java [new file with mode: 0644]
ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddBridge.java [deleted file]
ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddBridgeIT.java [new file with mode: 0755]
ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddPort.java [deleted file]
ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddPortIT.java [new file with mode: 0755]
ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddTunnelIT.java [moved from ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddTunnel.java with 69% similarity]
ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddVlanIT.java [moved from ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddVlan.java with 57% similarity]
ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestBase.java [new file with mode: 0644]
ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestBridgeConfig.java [deleted file]
ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestBridgeConfigIT.java [new file with mode: 0644]
ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestDeletePortIT.java [moved from ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestDeletePort.java with 95% similarity]
ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestSetManager.java [deleted file]
ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestSetManagerIT.java [new file with mode: 0755]
ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestSetOFControler.java [deleted file]
ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestSetOFControlerIT.java [new file with mode: 0644]

diff --git a/ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OVSDBTestGetBridgeDomains.java b/ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OVSDBTestGetBridgeDomains.java
deleted file mode 100644 (file)
index 3eba9d7..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.opendaylight.ovsdb.plugin;
-
-import org.junit.Test;
-import org.opendaylight.controller.sal.connection.ConnectionConstants;
-import org.opendaylight.controller.sal.core.Node;
-import org.opendaylight.controller.sal.core.NodeConnector;
-import org.opendaylight.ovsdb.plugin.ConfigurationService;
-import org.opendaylight.ovsdb.plugin.ConnectionService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class OVSDBTestGetBridgeDomains {
-    private static final Logger logger = LoggerFactory
-            .getLogger(OVSDBTestGetBridgeDomains.class);
-
-    @Test
-    public void getBridgeDomains() throws Throwable{
-        Node.NodeIDType.registerIDType("OVS", String.class);
-        NodeConnector.NodeConnectorIDType.registerIDType("OVS", String.class, "OVS");
-
-        ConnectionService connectionService = new ConnectionService();
-        connectionService.init();
-        String identifier = "TEST";
-        Map<ConnectionConstants, String> params = new HashMap<ConnectionConstants, String>();
-        params.put(ConnectionConstants.ADDRESS, "172.28.30.51");
-
-        Node node = connectionService.connect(identifier, params);
-        if(node == null){
-            logger.error("Could not connect to ovsdb server");
-            return;
-        }
-        /**
-         * List a Bridge Domain
-         *
-         * @param node Node serving this configuration service
-         *
-         */
-        ConfigurationService configurationService = new ConfigurationService();
-        configurationService.setConnectionServiceInternal(connectionService);
-        List<String> ls = configurationService.getBridgeDomains(node);
-        System.out.println(ls);
-    }
-}
diff --git a/ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OVSDBTestGetBridgeDomainsIT.java b/ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OVSDBTestGetBridgeDomainsIT.java
new file mode 100644 (file)
index 0000000..a307c2c
--- /dev/null
@@ -0,0 +1,34 @@
+package org.opendaylight.ovsdb.plugin;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.opendaylight.controller.sal.core.Node;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.gson.internal.Pair;
+
+public class OVSDBTestGetBridgeDomainsIT extends OvsdbTestBase {
+    private static final Logger logger = LoggerFactory
+            .getLogger(OVSDBTestGetBridgeDomainsIT.class);
+
+    @Test
+    public void getBridgeDomains() throws Throwable{
+
+        Pair<ConnectionService, Node> connection = getTestConnection();
+        ConnectionService connectionService = connection.first;
+        Node node = connection.second;
+
+        /**
+         * List a Bridge Domain
+         *
+         * @param node Node serving this configuration service
+         *
+         */
+        ConfigurationService configurationService = new ConfigurationService();
+        configurationService.setConnectionServiceInternal(connectionService);
+        List<String> ls = configurationService.getBridgeDomains(node);
+        System.out.println(ls);
+    }
+}
diff --git a/ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddBridge.java b/ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddBridge.java
deleted file mode 100755 (executable)
index 21f0991..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.opendaylight.ovsdb.plugin;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.controller.sal.core.Node;\r
-import org.opendaylight.controller.sal.core.NodeConnector;\r
-import org.opendaylight.ovsdb.plugin.ConfigurationService;\r
-import org.opendaylight.ovsdb.plugin.ConnectionService;\r
-import org.opendaylight.controller.sal.connection.ConnectionConstants;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-\r
-public class OvsdbTestAddBridge {\r
-    private static final Logger logger = LoggerFactory\r
-            .getLogger(OvsdbTestAddBridge.class);\r
-\r
-    @Test\r
-    public void addBridge() throws Throwable{\r
-        Node.NodeIDType.registerIDType("OVS", String.class);\r
-        NodeConnector.NodeConnectorIDType.registerIDType("OVS", String.class, "OVS");\r
-\r
-        ConnectionService connectionService = new ConnectionService();\r
-        connectionService.init();\r
-        String identifier = "TEST";\r
-        Map<ConnectionConstants, String> params = new HashMap<ConnectionConstants, String>();\r
-        params.put(ConnectionConstants.ADDRESS, "172.16.58.128");\r
-        params.put(ConnectionConstants.PORT, "6634");\r
-\r
-        Node node = connectionService.connect(identifier, params);\r
-        if(node == null){\r
-            logger.error("Could not connect to ovsdb server");\r
-            return;\r
-        }\r
-        /**\r
-         * Create a Bridge Domain\r
-         *\r
-         * @param node Node serving this configuration service\r
-         * @param bridgeDomainIdentifier String representation of a Bridge Domain\r
-         */\r
-        ConfigurationService configurationService = new ConfigurationService();\r
-        configurationService.setConnectionServiceInternal(connectionService);\r
-        configurationService.createBridgeDomain(node, "JUNIT_BRIDGE_TEST", null);\r
-    }\r
-\r
-}\r
diff --git a/ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddBridgeIT.java b/ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddBridgeIT.java
new file mode 100755 (executable)
index 0000000..5d8d808
--- /dev/null
@@ -0,0 +1,32 @@
+package org.opendaylight.ovsdb.plugin;\r
+\r
+import org.junit.Test;\r
+import org.opendaylight.controller.sal.core.Node;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+\r
+import com.google.gson.internal.Pair;\r
+\r
+public class OvsdbTestAddBridgeIT extends OvsdbTestBase {\r
+    private static final Logger logger = LoggerFactory\r
+            .getLogger(OvsdbTestAddBridgeIT.class);\r
+\r
+    @Test\r
+    public void addBridge() throws Throwable{\r
+\r
+        Pair<ConnectionService, Node> connection = getTestConnection();\r
+        ConnectionService connectionService = connection.first;\r
+        Node node = connection.second;\r
+\r
+        /**\r
+         * Create a Bridge Domain\r
+         *\r
+         * @param node Node serving this configuration service\r
+         * @param bridgeDomainIdentifier String representation of a Bridge Domain\r
+         */\r
+        ConfigurationService configurationService = new ConfigurationService();\r
+        configurationService.setConnectionServiceInternal(connectionService);\r
+        configurationService.createBridgeDomain(node, "JUNIT_BRIDGE_TEST", null);\r
+    }\r
+\r
+}\r
diff --git a/ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddPort.java b/ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddPort.java
deleted file mode 100755 (executable)
index f092535..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.opendaylight.ovsdb.plugin;
-
-import org.junit.Test;
-import org.opendaylight.controller.sal.core.Node;
-import org.opendaylight.controller.sal.core.NodeConnector;
-import org.opendaylight.ovsdb.plugin.ConfigurationService;
-import org.opendaylight.ovsdb.plugin.ConnectionService;
-import org.opendaylight.controller.sal.connection.ConnectionConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class OvsdbTestAddPort {
-    private static final Logger logger = LoggerFactory
-            .getLogger(OvsdbTestAddPort.class);
-
-    @Test
-    public void addPort() throws Throwable{
-        Node.NodeIDType.registerIDType("OVS", String.class);
-        NodeConnector.NodeConnectorIDType.registerIDType("OVS", String.class, "OVS");
-
-        ConnectionService connectionService = new ConnectionService();
-        connectionService.init();
-        String identifier = "TEST";
-        Map<ConnectionConstants, String> params = new HashMap<ConnectionConstants, String>();
-        params.put(ConnectionConstants.ADDRESS, "172.28.30.51");
-        params.put(ConnectionConstants.PORT, "6634");
-
-        Node node = connectionService.connect(identifier, params);
-        if(node == null){
-            logger.error("Could not connect to ovsdb server");
-            return;
-        }
-        /**
-         * Create a Port and attach it to a Bridge
-         * Ex. ovs-vsctl add-port br0 vif0
-         * @param node Node serving this configuration service
-         * @param bridgeDomainIdentifier String representation of a Bridge Domain
-         * @param portIdentifier String representation of a user defined Port Name
-         */
-        ConfigurationService configurationService = new ConfigurationService();
-        configurationService.setConnectionServiceInternal(connectionService);
-        configurationService.addPort(node, "JUNIT_BRIDGE_TEST", "Jvif0", null);
-    }
-}
\ No newline at end of file
diff --git a/ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddPortIT.java b/ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddPortIT.java
new file mode 100755 (executable)
index 0000000..d36f0d5
--- /dev/null
@@ -0,0 +1,41 @@
+package org.opendaylight.ovsdb.plugin;
+
+import java.io.IOException;
+import java.util.Properties;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.controller.sal.core.Node;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.gson.internal.Pair;
+
+public class OvsdbTestAddPortIT extends OvsdbTestBase {
+    private static final Logger logger = LoggerFactory
+            .getLogger(OvsdbTestAddPortIT.class);
+    private Properties props;
+
+    @Before
+    public void loadProps() throws IOException {
+        props = loadProperties();
+    }
+
+    @Test
+    public void addPort() throws Throwable{
+        Pair<ConnectionService, Node> connection = getTestConnection();
+        ConnectionService connectionService = connection.first;
+        Node node = connection.second;
+
+        /**
+         * Create a Port and attach it to a Bridge
+         * Ex. ovs-vsctl add-port br0 vif0
+         * @param node Node serving this configuration service
+         * @param bridgeDomainIdentifier String representation of a Bridge Domain
+         * @param portIdentifier String representation of a user defined Port Name
+         */
+        ConfigurationService configurationService = new ConfigurationService();
+        configurationService.setConnectionServiceInternal(connectionService);
+        configurationService.addPort(node, "JUNIT_BRIDGE_TEST", "Jvif0", null);
+    }
+}
\ No newline at end of file
similarity index 69%
rename from ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddTunnel.java
rename to ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddTunnelIT.java
index ed3bdc67fa53a378e87dfc7c68764fd7548a50ec..3ff2fb49200ba4ec9234784eeb946bf169cfcf67 100755 (executable)
@@ -6,26 +6,22 @@ import java.util.Map;
 
 import org.junit.Test;
 import org.opendaylight.controller.sal.core.Node;
-import org.opendaylight.controller.sal.core.NodeConnector;
-import org.opendaylight.controller.sal.connection.ConnectionConstants;
 import org.opendaylight.controller.sal.networkconfig.bridgedomain.ConfigConstants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.opendaylight.ovsdb.plugin.*;
 
-public class OvsdbTestAddTunnel {
+import com.google.gson.internal.Pair;
+
+public class OvsdbTestAddTunnelIT extends OvsdbTestBase {
     private static final Logger logger = LoggerFactory
-            .getLogger(OvsdbTestAddTunnel.class);
+            .getLogger(OvsdbTestAddTunnelIT.class);
 
     @Test
     public void addTunnel() throws Throwable{
-        Node.NodeIDType.registerIDType("OVS", String.class);
-        NodeConnector.NodeConnectorIDType.registerIDType("OVS", String.class, "OVS");
-
-        ConnectionService connectionService = new ConnectionService();
-        connectionService.init();
+        Pair<ConnectionService, Node> connection = getTestConnection();
+        ConnectionService connectionService = connection.first;
+        Node node = connection.second;
 
-        String identifier = "TEST";
         /**
          * tunnelendpoint IP address of the
          * destination Tunnel Endpoint.
@@ -40,15 +36,6 @@ public class OvsdbTestAddTunnel {
         String tunencap = encap.toString();
         String tunnelendpoint = "192.168.100.100";
 
-        Map<ConnectionConstants, String> params = new HashMap<ConnectionConstants, String>();
-        params.put(ConnectionConstants.ADDRESS, "172.28.30.51");
-        params.put(ConnectionConstants.PORT, "6634");
-
-        Node node = connectionService.connect(identifier, params);
-        if(node == null){
-            logger.error("Could not connect to ovsdb server");
-            return;
-        }
         /**
          * Create an Encapsulated Tunnel Interface and destination Tunnel Endpoint
          *
similarity index 57%
rename from ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddVlan.java
rename to ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddVlanIT.java
index cdd3ca4a278f217991b1de51609ec3059714a203..c0bf021d441b8302441390ffcf4252762cdb2dda 100755 (executable)
@@ -1,40 +1,28 @@
 package org.opendaylight.ovsdb.plugin;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import org.junit.Test;
 import org.opendaylight.controller.sal.core.Node;
-import org.opendaylight.controller.sal.core.NodeConnector;
-import org.opendaylight.ovsdb.plugin.ConfigurationService;
-import org.opendaylight.ovsdb.plugin.ConnectionService;
-import org.opendaylight.controller.sal.connection.ConnectionConstants;
 import org.opendaylight.controller.sal.networkconfig.bridgedomain.ConfigConstants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.HashMap;
-import java.util.Map;
+import com.google.gson.internal.Pair;
 
-public class OvsdbTestAddVlan {
+public class OvsdbTestAddVlanIT extends OvsdbTestBase {
     private static final Logger logger = LoggerFactory
-            .getLogger(OvsdbTestAddVlan.class);
+            .getLogger(OvsdbTestAddVlanIT.class);
 
     @Test
     public void addPortVlan() throws Throwable{
-        Node.NodeIDType.registerIDType("OVS", String.class);
-        NodeConnector.NodeConnectorIDType.registerIDType("OVS", String.class, "OVS");
+        Pair<ConnectionService, Node> connection = getTestConnection();
+        ConnectionService connectionService = connection.first;
+        Node node = connection.second;
 
-        ConnectionService connectionService = new ConnectionService();
-        connectionService.init();
-        String identifier = "TEST";
-        Map<ConnectionConstants, String> params = new HashMap<ConnectionConstants, String>();
-        params.put(ConnectionConstants.ADDRESS, "172.28.30.51");
-        params.put(ConnectionConstants.PORT, "6634");
         int vlanid = 100;
 
-        Node node = connectionService.connect(identifier, params);
-        if(node == null){
-            logger.error("Could not connect to ovsdb server");
-            return;
-        }
         /**
          * Create a Port with a user defined VLAN, and attach it to the specified bridge.
          *
diff --git a/ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestBase.java b/ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestBase.java
new file mode 100644 (file)
index 0000000..cbc294f
--- /dev/null
@@ -0,0 +1,54 @@
+package org.opendaylight.ovsdb.plugin;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.opendaylight.controller.sal.connection.ConnectionConstants;
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.core.NodeConnector;
+
+import com.google.gson.internal.Pair;
+
+public abstract class OvsdbTestBase {
+    private final static String identifier = "TEST";
+
+    public Properties loadProperties() throws IOException {
+        InputStream is = this
+                .getClass()
+                .getClassLoader()
+                .getResourceAsStream(
+                        "org/opendaylight/ovsdb/lib/message/integration-test.properties");
+        if (is == null) {
+            throw new IOException("Unable to load integration-test.properties");
+        }
+        Properties props = new Properties();
+        props.load(is);
+
+        return props;
+    }
+
+    public Pair<ConnectionService, Node> getTestConnection() throws IOException {
+        Node.NodeIDType.registerIDType("OVS", String.class);
+        NodeConnector.NodeConnectorIDType.registerIDType("OVS", String.class,
+                "OVS");
+
+        ConnectionService connectionService = new ConnectionService();
+        connectionService.init();
+        Map<ConnectionConstants, String> params = new HashMap<ConnectionConstants, String>();
+        Properties props = loadProperties();
+        params.put(ConnectionConstants.ADDRESS,
+                props.getProperty("ovsdbserver.ipaddress"));
+        params.put(ConnectionConstants.PORT,
+                props.getProperty("ovsdbserver.port", "6640"));
+
+        Node node = connectionService.connect(identifier, params);
+        if (node == null) {
+            throw new IOException("Failed to connecto to ovsdb server");
+        }
+        return new Pair<ConnectionService, Node>(connectionService, node);
+    }
+
+}
diff --git a/ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestBridgeConfig.java b/ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestBridgeConfig.java
deleted file mode 100644 (file)
index 066f464..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.opendaylight.ovsdb.plugin;
-
-import org.junit.Test;
-import org.opendaylight.controller.sal.connection.ConnectionConstants;
-import org.opendaylight.controller.sal.core.Node;
-import org.opendaylight.controller.sal.core.NodeConnector;
-import org.opendaylight.controller.sal.networkconfig.bridgedomain.ConfigConstants;
-import org.opendaylight.ovsdb.plugin.ConfigurationService;
-import org.opendaylight.ovsdb.plugin.ConnectionService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class OvsdbTestBridgeConfig {
-    private static final Logger logger = LoggerFactory
-            .getLogger(OvsdbTestSetManager.class);
-
-    @Test
-    public void setBridgeConfig() throws Throwable{
-        Node.NodeIDType.registerIDType("OVS", String.class);
-        NodeConnector.NodeConnectorIDType.registerIDType("OVS", String.class, "OVS");
-
-        ConnectionService connectionService = new ConnectionService();
-        connectionService.init();
-        String identifier = "TEST";
-        Map<ConnectionConstants, String> params = new HashMap<ConnectionConstants, String>();
-        params.put(ConnectionConstants.ADDRESS, "192.168.254.128");
-        params.put(ConnectionConstants.PORT, "6640");
-
-        Map<ConfigConstants, Object> configs = new HashMap<ConfigConstants, Object>();
-
-        Map<String, String> exterIDPairs = new HashMap<String, String>();
-        exterIDPairs.put("bridge-foo", "bri-bar");
-        //Will accept multiple array pairs. Pairs must be arrays not maps.
-        configs.put(ConfigConstants.CUSTOM, exterIDPairs);
-
-        Node node = connectionService.connect(identifier, params);
-        if(node == null){
-            logger.error("Could not connect to ovsdb server");
-            return;
-        }
-
-        ConfigurationService configurationService = new ConfigurationService();
-        configurationService.setConnectionServiceInternal(connectionService);
-        configurationService.addBridgeDomainConfig(node, "br0", configs);
-    }
-
-}
\ No newline at end of file
diff --git a/ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestBridgeConfigIT.java b/ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestBridgeConfigIT.java
new file mode 100644 (file)
index 0000000..fe10f50
--- /dev/null
@@ -0,0 +1,36 @@
+package org.opendaylight.ovsdb.plugin;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.networkconfig.bridgedomain.ConfigConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.gson.internal.Pair;
+
+public class OvsdbTestBridgeConfigIT extends OvsdbTestBase {
+    private static final Logger logger = LoggerFactory
+            .getLogger(OvsdbTestSetManagerIT.class);
+
+    @Test
+    public void setBridgeConfig() throws Throwable{
+        Pair<ConnectionService, Node> connection = getTestConnection();
+        ConnectionService connectionService = connection.first;
+        Node node = connection.second;
+
+        Map<ConfigConstants, Object> configs = new HashMap<ConfigConstants, Object>();
+
+        Map<String, String> exterIDPairs = new HashMap<String, String>();
+        exterIDPairs.put("bridge-foo", "bri-bar");
+        //Will accept multiple array pairs. Pairs must be arrays not maps.
+        configs.put(ConfigConstants.CUSTOM, exterIDPairs);
+
+        ConfigurationService configurationService = new ConfigurationService();
+        configurationService.setConnectionServiceInternal(connectionService);
+        configurationService.addBridgeDomainConfig(node, "br0", configs);
+    }
+
+}
\ No newline at end of file
similarity index 95%
rename from ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestDeletePort.java
rename to ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestDeletePortIT.java
index a043c6f1944af76905541b4169496d3c449715f3..d31748c91c0969eaef1c5d6453cee1fc697c87b1 100644 (file)
@@ -12,9 +12,9 @@ import org.slf4j.LoggerFactory;
 import java.util.HashMap;
 import java.util.Map;
 
-public class OvsdbTestDeletePort {
+public class OvsdbTestDeletePortIT {
     private static final Logger logger = LoggerFactory
-            .getLogger(OvsdbTestAddPort.class);
+            .getLogger(OvsdbTestAddPortIT.class);
 
     @Test
     public void deletePort() throws Throwable{
diff --git a/ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestSetManager.java b/ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestSetManager.java
deleted file mode 100755 (executable)
index f342166..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.opendaylight.ovsdb.plugin;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.controller.sal.core.Node;\r
-import org.opendaylight.controller.sal.core.NodeConnector;\r
-import org.opendaylight.ovsdb.plugin.ConfigurationService;\r
-import org.opendaylight.ovsdb.plugin.ConnectionService;\r
-import org.opendaylight.controller.sal.connection.ConnectionConstants;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-import java.util.HashMap;\r
-import java.util.Map;\r
-\r
-public class OvsdbTestSetManager {\r
-    private static final Logger logger = LoggerFactory\r
-            .getLogger(OvsdbTestSetManager.class);\r
-\r
-    @Test\r
-    public void setManager() throws Throwable{\r
-        Node.NodeIDType.registerIDType("OVS", String.class);\r
-        NodeConnector.NodeConnectorIDType.registerIDType("OVS", String.class, "OVS");\r
-\r
-        ConnectionService connectionService = new ConnectionService();\r
-        connectionService.init();\r
-        String identifier = "TEST";\r
-        Map<ConnectionConstants, String> params = new HashMap<ConnectionConstants, String>();\r
-        params.put(ConnectionConstants.ADDRESS, "172.28.30.51");\r
-\r
-        Node node = connectionService.connect(identifier, params);\r
-        if(node == null){\r
-            logger.error("Could not connect to ovsdb server");\r
-            return;\r
-        }\r
-        /**\r
-         * Implements the OVS Connection for Managers\r
-         *\r
-         * @param node Node serving this configuration service\r
-         * @param String with IP and connection type ex. type:ip:port\r
-         *\r
-         */\r
-        ConfigurationService configurationService = new ConfigurationService();\r
-        configurationService.setConnectionServiceInternal(connectionService);\r
-        configurationService.setManager(node, "ptcp:6634:172.16.58.128");\r
-    }\r
-\r
-}\r
diff --git a/ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestSetManagerIT.java b/ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestSetManagerIT.java
new file mode 100755 (executable)
index 0000000..a7844bc
--- /dev/null
@@ -0,0 +1,32 @@
+package org.opendaylight.ovsdb.plugin;\r
+\r
+import org.junit.Test;\r
+import org.opendaylight.controller.sal.core.Node;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+\r
+import com.google.gson.internal.Pair;\r
+\r
+public class OvsdbTestSetManagerIT extends OvsdbTestBase {\r
+    private static final Logger logger = LoggerFactory\r
+            .getLogger(OvsdbTestSetManagerIT.class);\r
+\r
+    @Test\r
+    public void setManager() throws Throwable{\r
+        Pair<ConnectionService, Node> connection = getTestConnection();\r
+        ConnectionService connectionService = connection.first;\r
+        Node node = connection.second;\r
+\r
+        /**\r
+         * Implements the OVS Connection for Managers\r
+         *\r
+         * @param node Node serving this configuration service\r
+         * @param String with IP and connection type ex. type:ip:port\r
+         *\r
+         */\r
+        ConfigurationService configurationService = new ConfigurationService();\r
+        configurationService.setConnectionServiceInternal(connectionService);\r
+        configurationService.setManager(node, "ptcp:6634:172.16.58.128");\r
+    }\r
+\r
+}\r
diff --git a/ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestSetOFControler.java b/ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestSetOFControler.java
deleted file mode 100644 (file)
index 60a77bc..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.opendaylight.ovsdb.plugin;
-
-import org.junit.Test;
-import org.opendaylight.controller.sal.connection.ConnectionConstants;
-import org.opendaylight.controller.sal.core.Node;
-import org.opendaylight.controller.sal.core.NodeConnector;
-import org.opendaylight.controller.sal.networkconfig.bridgedomain.ConfigConstants;
-import org.opendaylight.ovsdb.plugin.ConfigurationService;
-import org.opendaylight.ovsdb.plugin.ConnectionService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class OvsdbTestSetOFControler {
-    private static final Logger logger = LoggerFactory
-            .getLogger(OvsdbTestSetOFControler.class);
-
-    @Test
-    public void setController() throws Throwable{
-        Node.NodeIDType.registerIDType("OVS", String.class);
-        NodeConnector.NodeConnectorIDType.registerIDType("OVS", String.class, "OVS");
-
-        ConnectionService connectionService = new ConnectionService();
-        connectionService.init();
-        String identifier = "TEST";
-        Map<ConnectionConstants, String> params = new HashMap<ConnectionConstants, String>();
-        params.put(ConnectionConstants.ADDRESS, "192.168.254.128");
-        params.put(ConnectionConstants.PORT, "6640");
-
-        Node node = connectionService.connect(identifier, params);
-        if(node == null){
-            logger.error("Could not connect to ovsdb server");
-            return;
-        }
-        /**
-         * Implements ovs-vsctl set−controller bridge target..
-         *
-         * @param node Node serving this configuration service
-         * @param bridgeDomainIdentifier String representation of a Bridge Domain
-         * @param configs String passes the OF controllers IP and Port values
-         *
-         */
-        Map<ConfigConstants, Object> configs = new HashMap<ConfigConstants, Object>();
-        configs.put(ConfigConstants.DEST_IP, "192.168.254.1");
-        configs.put(ConfigConstants.CUSTOM, "6633");
-        ConfigurationService configurationService = new ConfigurationService();
-        configurationService.setConnectionServiceInternal(connectionService);
-        configurationService.setBridgeOFController(node, "br0");
-
-    }
-}
diff --git a/ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestSetOFControlerIT.java b/ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestSetOFControlerIT.java
new file mode 100644 (file)
index 0000000..0faf16e
--- /dev/null
@@ -0,0 +1,32 @@
+package org.opendaylight.ovsdb.plugin;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.networkconfig.bridgedomain.ConfigConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.gson.internal.Pair;
+
+public class OvsdbTestSetOFControlerIT extends OvsdbTestBase {
+    private static final Logger logger = LoggerFactory
+            .getLogger(OvsdbTestSetOFControlerIT.class);
+
+    @Test
+    public void setController() throws Throwable{
+        Pair<ConnectionService, Node> connection = getTestConnection();
+        ConnectionService connectionService = connection.first;
+        Node node = connection.second;
+
+        Map<ConfigConstants, Object> configs = new HashMap<ConfigConstants, Object>();
+        configs.put(ConfigConstants.DEST_IP, "192.168.254.1");
+        configs.put(ConfigConstants.CUSTOM, "6633");
+        ConfigurationService configurationService = new ConfigurationService();
+        configurationService.setConnectionServiceInternal(connectionService);
+        configurationService.setBridgeOFController(node, "br0");
+
+    }
+}