Fixed OVSDB plugin Integration Test issue on Jenkins server 07/9507/8
authorMadhu Venugopal <mavenugo@gmail.com>
Wed, 30 Jul 2014 19:57:18 +0000 (12:57 -0700)
committerMadhu Venugopal <mavenugo@gmail.com>
Thu, 31 Jul 2014 18:32:00 +0000 (11:32 -0700)
1. Removed SureFire plugin and made this FailSafe only IT
2. Moved IT files carrying individual test-case grouped under more logically placed IT classes
3. Changed the port name constants from eth0, eth1 to test0, test1 (somehow this affects Jenkins. Need to work on that more to understand the rootcause).
4. Moved all the Tests under TestSuite with TearDown

Change-Id: I8cc8225332910bcf0c56babb10010d55c9e8df99
Signed-off-by: Madhu Venugopal <mavenugo@gmail.com>
15 files changed:
plugin/pom.xml
plugin/resources/logback.xml [new file with mode: 0644]
plugin/src/test/java/org/opendaylight/ovsdb/plugin/BridgeDomainConfigBridgeTestCases.java [new file with mode: 0644]
plugin/src/test/java/org/opendaylight/ovsdb/plugin/BridgeDomainConfigManagerTestCases.java [moved from plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestSetManagerIT.java with 89% similarity]
plugin/src/test/java/org/opendaylight/ovsdb/plugin/BridgeDomainConfigPortTestCases.java [new file with mode: 0644]
plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbPluginTestSuiteIT.java [new file with mode: 0644]
plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddPortIT.java [deleted file]
plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddTunnelIT.java [deleted file]
plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddVlanIT.java [deleted file]
plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestBridgeConfigIT.java [deleted file]
plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestDeletePortIT.java [deleted file]
plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestGetBridgeDomainsIT.java [deleted file]
plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestSetOFControllerIT.java [deleted file]
plugin/src/test/java/org/opendaylight/ovsdb/plugin/PluginTestBase.java [moved from plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestBase.java with 88% similarity]
plugin/src/test/java/org/opendaylight/ovsdb/plugin/TearDown.java [moved from plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddBridgeIT.java with 63% similarity]

index 97a377d4f5d1f8efebde0145c44cc7ad6653a5a7..37d4e3407d6490eb096555fa48c9570098641f22 100755 (executable)
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-checkstyle-plugin</artifactId>
       </plugin>
-      <!-- ToDo: Fix IT Failures
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-failsafe-plugin</artifactId>
       </plugin>
-      -->
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-      </plugin>
       <plugin>
         <groupId>org.jacoco</groupId>
         <artifactId>jacoco-maven-plugin</artifactId>
diff --git a/plugin/resources/logback.xml b/plugin/resources/logback.xml
new file mode 100644 (file)
index 0000000..3a78a98
--- /dev/null
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<configuration>
+
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <!-- encoders are assigned the type
+             ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{5} - %msg%n</pattern>
+        </encoder>
+    </appender>
+
+    <logger name="org.opendaylight.ovsdb" level="INFO" additivity="false">
+        <appender-ref ref="STDOUT" />
+    </logger>
+
+    <!--<logger name="com.lordofthejars.foo" level="INFO" additivity="false">-->
+        <!--<appender-ref ref="STDOUT" />-->
+    <!--</logger>-->
+
+    <root level="INFO">
+        <appender-ref ref="STDOUT" />
+    </root>
+
+</configuration>
\ No newline at end of file
diff --git a/plugin/src/test/java/org/opendaylight/ovsdb/plugin/BridgeDomainConfigBridgeTestCases.java b/plugin/src/test/java/org/opendaylight/ovsdb/plugin/BridgeDomainConfigBridgeTestCases.java
new file mode 100644 (file)
index 0000000..07a1683
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * [[ Authors will Fill in the Copyright header ]]
+ *
+ * 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
+ *
+ * Authors : Brent Salisbury, Hugo Trippaers
+ */
+package org.opendaylight.ovsdb.plugin;
+
+import java.util.HashMap;
+import java.util.List;
+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;
+
+public class BridgeDomainConfigBridgeTestCases extends PluginTestBase {
+    private static final Logger logger = LoggerFactory
+            .getLogger(BridgeDomainConfigBridgeTestCases.class);
+
+    @Test
+    public void addBridge() throws Throwable{
+
+        TestObjects testObjects = getTestConnection();
+        ConnectionService connectionService = testObjects.connectionService;
+        Node node = testObjects.node;
+
+        /**
+         * Create a Bridge Domain
+         *
+         * @param node Node serving this configuration service
+         * @param bridgeDomainIdentifier String representation of a Bridge Domain
+         */
+        ConfigurationService configurationService = testObjects.configurationService;
+        configurationService.createBridgeDomain(node, BRIDGE_NAME, null);
+    }
+
+    @Test
+    public void getBridgeDomains() throws Throwable{
+
+        TestObjects testObjects = getTestConnection();
+        ConnectionService connectionService = testObjects.connectionService;
+        InventoryService inventoryService = testObjects.inventoryService;
+        Node node = testObjects.node;
+
+        /**
+         * List a Bridge Domain
+         *
+         * @param node Node serving this configuration service
+         *
+         */
+        ConfigurationService configurationService = testObjects.configurationService;
+        List<String> ls = configurationService.getBridgeDomains(node);
+    }
+
+    @Test
+    public void setController() throws Throwable{
+        TestObjects testObjects = getTestConnection();
+        Node node = testObjects.node;
+
+        ConfigurationService configurationService = testObjects.configurationService;
+        configurationService.setBridgeOFController(node, BRIDGE_NAME);
+
+    }
+
+    @Test
+    public void setBridgeConfig() throws Throwable{
+        TestObjects testObjects = getTestConnection();
+        ConnectionService connectionService = testObjects.connectionService;
+        Node node = testObjects.node;
+
+        Map<ConfigConstants, Object> configs = new HashMap<ConfigConstants, Object>();
+
+        Map<String, String> exterIDPairs = new HashMap<String, String>();
+        exterIDPairs.put("br-foo", "br-bar");
+        //Will accept multiple array pairs. Pairs must be arrays not maps.
+        configs.put(ConfigConstants.CUSTOM, exterIDPairs);
+
+        ConfigurationService configurationService = testObjects.configurationService;
+        configurationService.addBridgeDomainConfig(node, BRIDGE_NAME, configs);
+    }
+
+}
similarity index 89%
rename from plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestSetManagerIT.java
rename to plugin/src/test/java/org/opendaylight/ovsdb/plugin/BridgeDomainConfigManagerTestCases.java
index 1ab5f3de320d59b690023631bffcf718d342ba8b..3faee6a37990e4e72cb6c295b7c37d93785b6494 100644 (file)
@@ -1,44 +1,44 @@
-/*\r
- * [[ Authors will Fill in the Copyright header ]]\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Authors : Brent Salisbury, Hugo Trippaers\r
- */\r
-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
-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
-        TestObjects testObjects = getTestConnection();\r
-        Node node = testObjects.node;\r
-\r
-\r
-        String port = "6634";\r
-        String host = FAKE_IP;\r
-        String connectionType = "ptcp";\r
-\r
-        String manager = connectionType + ":" + host + ":" + port;\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 = testObjects.configurationService;\r
-        configurationService.setManager(node, manager);\r
-    }\r
-\r
-}\r
+/*
+ * [[ Authors will Fill in the Copyright header ]]
+ *
+ * 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
+ *
+ * Authors : Brent Salisbury, Hugo Trippaers
+ */
+package org.opendaylight.ovsdb.plugin;
+
+import org.junit.Test;
+import org.opendaylight.controller.sal.core.Node;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class BridgeDomainConfigManagerTestCases extends PluginTestBase {
+    private static final Logger logger = LoggerFactory
+            .getLogger(BridgeDomainConfigManagerTestCases.class);
+
+    @Test
+    public void setManager() throws Throwable{
+        TestObjects testObjects = getTestConnection();
+        Node node = testObjects.node;
+
+
+        String port = "6634";
+        String host = FAKE_IP;
+        String connectionType = "ptcp";
+
+        String manager = connectionType + ":" + host + ":" + port;
+
+        /**
+         * Implements the OVS Connection for Managers
+         *
+         * @param node Node serving this configuration service
+         * @param String with IP and connection type ex. type:ip:port
+         *
+         */
+        ConfigurationService configurationService = testObjects.configurationService;
+        configurationService.setManager(node, manager);
+    }
+
+}
diff --git a/plugin/src/test/java/org/opendaylight/ovsdb/plugin/BridgeDomainConfigPortTestCases.java b/plugin/src/test/java/org/opendaylight/ovsdb/plugin/BridgeDomainConfigPortTestCases.java
new file mode 100644 (file)
index 0000000..11a0910
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * [[ Authors will Fill in the Copyright header ]]
+ *
+ * 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
+ *
+ * Authors : Brent Salisbury, Hugo Trippaers
+ */
+package org.opendaylight.ovsdb.plugin;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.junit.Before;
+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;
+
+public class BridgeDomainConfigPortTestCases extends PluginTestBase {
+    private static final Logger logger = LoggerFactory
+            .getLogger(BridgeDomainConfigPortTestCases.class);
+    private Properties props;
+
+    @Before
+    public void loadProps() throws IOException {
+        props = loadProperties();
+    }
+
+
+    /**
+     * Create a Port and attach it to a Bridge
+     * Ex. ovs-vsctl add-port br0 vif0
+     */
+
+    @Test
+    public void addPort() throws Throwable{
+        TestObjects testObjects = getTestConnection();
+        ConnectionService connectionService = testObjects.connectionService;
+        Node node = testObjects.node;
+        ConfigurationService configurationService = testObjects.configurationService;
+        configurationService.addPort(node, BRIDGE_NAME, PORT_NAME, null);
+    }
+
+    /**
+     * Create a Port with a user defined VLAN, and attach it to the specified bridge.
+     *
+     * Ex. ovs-vsctl add-port JUNIT_BRIDGE_TEST Jvlanvif0 tag=100
+     */
+    @Test
+    public void addPortVlan() throws Throwable{
+        TestObjects testObjects = getTestConnection();
+        ConnectionService connectionService = testObjects.connectionService;
+        Node node = testObjects.node;
+
+        int vlanid = 100;
+
+        ConfigurationService configurationService = testObjects.configurationService;
+        Map<ConfigConstants, Object> configs = new HashMap<ConfigConstants, Object>();
+        configs.put(ConfigConstants.TYPE, "VLAN");
+        configs.put(ConfigConstants.VLAN, vlanid+"");
+        configurationService.addPort(node, BRIDGE_NAME, TAGGED_PORT_NAME, configs);
+    }
+
+    /**
+     * Create an Encapsulated Tunnel Interface and destination Tunnel Endpoint
+     * tunnelendpoint IP address of the destination Tunnel Endpoint.
+     * tunencap is the tunnel encapsulation options being (CAPWAP, GRE, VXLAN).
+     *
+     * Ex. ovs-vsctl add-port br0 vxlan1 (cont)
+     * -- set interface vxlan1 type=vxlan options:remote_ip=192.168.1.11
+     */
+
+    @Test
+    public void addTunnel() throws Throwable{
+        TestObjects testObjects = getTestConnection();
+        Node node = testObjects.node;
+
+        Encapsulation encap = Encapsulation.VXLAN;
+        String tunencap = encap.toString();
+        String tunnelendpoint = FAKE_IP;
+
+        ConfigurationService configurationService = testObjects.configurationService;
+        Map<ConfigConstants, Object> configs = new HashMap<ConfigConstants, Object>();
+        configs.put(ConfigConstants.TYPE, "TUNNEL");
+        configs.put(ConfigConstants.TUNNEL_TYPE, tunencap);
+        configs.put(ConfigConstants.DEST_IP, tunnelendpoint);
+
+        configurationService.addPort(node, BRIDGE_NAME, TUNNEL_PORT_NAME, configs);
+    }
+
+    /**
+     * Deletes an existing port from an existing bridge
+     * Ex. ovs-vsctl del-port ovsbr0 tap0
+     */
+    @Test
+    public void deletePort() throws Throwable{
+        TestObjects testObjects = getTestConnection();
+        ConnectionService connectionService = testObjects.connectionService;
+        Node node = testObjects.node;
+
+        ConfigurationService configurationService = testObjects.configurationService;
+        configurationService.deletePort(node, BRIDGE_NAME, PORT_NAME);
+    }
+
+}
\ No newline at end of file
diff --git a/plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbPluginTestSuiteIT.java b/plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbPluginTestSuiteIT.java
new file mode 100644 (file)
index 0000000..6665a16
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * 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
+ *
+ * Authors : Madhu Venugopal, Dave Tucker
+ */
+package org.opendaylight.ovsdb.plugin;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.opendaylight.ovsdb.plugin.PluginTestBase.TestObjects;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+    BridgeDomainConfigBridgeTestCases.class,
+    BridgeDomainConfigPortTestCases.class,
+    BridgeDomainConfigManagerTestCases.class,
+    TearDown.class})
+
+public class OvsdbPluginTestSuiteIT {
+    static TestObjects testObjects;
+
+    public static TestObjects getTestObjects() {
+        return testObjects;
+    }
+
+    public static void setTestObjects(TestObjects testObjects) {
+        OvsdbPluginTestSuiteIT.testObjects = testObjects;
+    }
+
+}
diff --git a/plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddPortIT.java b/plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddPortIT.java
deleted file mode 100644 (file)
index d88d71a..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * [[ Authors will Fill in the Copyright header ]]
- *
- * 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
- *
- * Authors : Brent Salisbury, Hugo Trippaers
- */
-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;
-
-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{
-        TestObjects testObjects = getTestConnection();
-        ConnectionService connectionService = testObjects.connectionService;
-        Node node = testObjects.node;
-
-        /**
-         * 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 = testObjects.configurationService;
-        configurationService.addPort(node, BRIDGE_NAME, PORT_NAME, null);
-    }
-}
\ No newline at end of file
diff --git a/plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddTunnelIT.java b/plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddTunnelIT.java
deleted file mode 100644 (file)
index 368184d..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * [[ Authors will Fill in the Copyright header ]]
- *
- * 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
- *
- * Authors : Brent Salisbury, Hugo Trippaers
- */
-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;
-
-public class OvsdbTestAddTunnelIT extends OvsdbTestBase {
-    private static final Logger logger = LoggerFactory
-            .getLogger(OvsdbTestAddTunnelIT.class);
-
-    @Test
-    public void addTunnel() throws Throwable{
-        TestObjects testObjects = getTestConnection();
-        Node node = testObjects.node;
-
-        /**
-         * tunnelendpoint IP address of the
-         * destination Tunnel Endpoint.
-         * tunencap is the tunnel encapsulation
-         * options being (CAPWAP, GRE, VXLAN).
-         * Use the following lines to test GRE and CAPWAP
-         * Encapsulation encap = Encapsulation.GRE;
-         * Encapsulation encap = Encapsulation.CAPWAP;
-         */
-
-        Encapsulation encap = Encapsulation.VXLAN;
-        String tunencap = encap.toString();
-        String tunnelendpoint = FAKE_IP;
-
-        /**
-         * Create an Encapsulated Tunnel Interface and destination Tunnel Endpoint
-         *
-         * Ex. ovs-vsctl add-port br0 vxlan1 (cont)
-         * -- set interface vxlan1 type=vxlan options:remote_ip=192.168.1.11
-         * @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
-         * @param tunnelendpoint IP address of the destination Tunnel Endpoint
-         * @param tunencap is the tunnel encapsulation options being CAPWAP, GRE or VXLAN
-         * The Bridge must already be defined before calling addTunnel.
-         */
-        ConfigurationService configurationService = testObjects.configurationService;
-        Map<ConfigConstants, Object> configs = new HashMap<ConfigConstants, Object>();
-        configs.put(ConfigConstants.TYPE, "TUNNEL");
-        configs.put(ConfigConstants.TUNNEL_TYPE, tunencap);
-        configs.put(ConfigConstants.DEST_IP, tunnelendpoint);
-
-        configurationService.addPort(node, BRIDGE_NAME, TUNNEL_PORT_NAME, configs);
-
-    }
-}
\ No newline at end of file
diff --git a/plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddVlanIT.java b/plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddVlanIT.java
deleted file mode 100644 (file)
index fd37e63..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * [[ Authors will Fill in the Copyright header ]]
- *
- * 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
- *
- * Authors : Brent Salisbury, Hugo Trippaers
- */
-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;
-
-public class OvsdbTestAddVlanIT extends OvsdbTestBase {
-    private static final Logger logger = LoggerFactory
-            .getLogger(OvsdbTestAddVlanIT.class);
-
-    @Test
-    public void addPortVlan() throws Throwable{
-        TestObjects testObjects = getTestConnection();
-        ConnectionService connectionService = testObjects.connectionService;
-        Node node = testObjects.node;
-
-        int vlanid = 100;
-
-        /**
-         * Create a Port with a user defined VLAN, and attach it to the specified bridge.
-         *
-         * Ex. ovs-vsctl add-port JUNIT_BRIDGE_TEST Jvlanvif0 tag=100
-         * @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
-         * @param vlanid Integer note: only one VID is accepted with tag=x method
-         */
-        ConfigurationService configurationService = testObjects.configurationService;
-        Map<ConfigConstants, Object> configs = new HashMap<ConfigConstants, Object>();
-        configs.put(ConfigConstants.TYPE, "VLAN");
-        configs.put(ConfigConstants.VLAN, vlanid+"");
-        configurationService.addPort(node, BRIDGE_NAME, TAGGED_PORT_NAME, configs);
-    }
-}
\ No newline at end of file
diff --git a/plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestBridgeConfigIT.java b/plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestBridgeConfigIT.java
deleted file mode 100644 (file)
index ac62266..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * [[ Authors will Fill in the Copyright header ]]
- *
- * 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
- *
- * Authors : Brent Salisbury, Hugo Trippaers
- */
-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;
-
-public class OvsdbTestBridgeConfigIT extends OvsdbTestBase {
-    private static final Logger logger = LoggerFactory
-            .getLogger(OvsdbTestSetManagerIT.class);
-
-    @Test
-    public void setBridgeConfig() throws Throwable{
-        TestObjects testObjects = getTestConnection();
-        ConnectionService connectionService = testObjects.connectionService;
-        Node node = testObjects.node;
-
-        Map<ConfigConstants, Object> configs = new HashMap<ConfigConstants, Object>();
-
-        Map<String, String> exterIDPairs = new HashMap<String, String>();
-        exterIDPairs.put("br-foo", "br-bar");
-        //Will accept multiple array pairs. Pairs must be arrays not maps.
-        configs.put(ConfigConstants.CUSTOM, exterIDPairs);
-
-        ConfigurationService configurationService = testObjects.configurationService;
-        configurationService.addBridgeDomainConfig(node, BRIDGE_NAME, configs);
-    }
-
-}
\ No newline at end of file
diff --git a/plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestDeletePortIT.java b/plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestDeletePortIT.java
deleted file mode 100644 (file)
index c72f4bb..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * [[ Authors will Fill in the Copyright header ]]
- *
- * 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
- *
- * Authors : Brent Salisbury, Hugo Trippaers
- */
-package org.opendaylight.ovsdb.plugin;
-
-import org.junit.Test;
-import org.opendaylight.controller.sal.core.Node;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class OvsdbTestDeletePortIT extends OvsdbTestBase {
-    private static final Logger logger = LoggerFactory
-            .getLogger(OvsdbTestAddPortIT.class);
-
-    @Test
-    public void deletePort() throws Throwable{
-        TestObjects testObjects = getTestConnection();
-        ConnectionService connectionService = testObjects.connectionService;
-        Node node = testObjects.node;
-
-        /**
-         * Deletes an existing port from an existing bridge
-         * Ex. ovs-vsctl del-port ovsbr0 tap0
-         * @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 = testObjects.configurationService;
-        configurationService.deletePort(node, BRIDGE_NAME, PORT_NAME);
-    }
-}
diff --git a/plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestGetBridgeDomainsIT.java b/plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestGetBridgeDomainsIT.java
deleted file mode 100644 (file)
index 630b1e2..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * [[ Authors will Fill in the Copyright header ]]
- *
- * 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
- *
- * Authors : Brent Salisbury, Hugo Trippaers
- */
-package org.opendaylight.ovsdb.plugin;
-
-import java.io.IOException;
-import java.util.List;
-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;
-
-public class OvsdbTestGetBridgeDomainsIT extends OvsdbTestBase {
-    private static final Logger logger = LoggerFactory
-            .getLogger(OvsdbTestGetBridgeDomainsIT.class);
-
-    private Properties props;
-
-    @Before
-    public void loadProps() throws IOException {
-        props = loadProperties();
-    }
-
-    @Test
-    public void getBridgeDomains() throws Throwable{
-
-        TestObjects testObjects = getTestConnection();
-        ConnectionService connectionService = testObjects.connectionService;
-        InventoryService inventoryService = testObjects.inventoryService;
-        Node node = testObjects.node;
-
-        /**
-         * List a Bridge Domain
-         *
-         * @param node Node serving this configuration service
-         *
-         */
-        ConfigurationService configurationService = testObjects.configurationService;
-        List<String> ls = configurationService.getBridgeDomains(node);
-    }
-}
diff --git a/plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestSetOFControllerIT.java b/plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestSetOFControllerIT.java
deleted file mode 100644 (file)
index 1c490ed..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * [[ Authors will Fill in the Copyright header ]]
- *
- * 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
- *
- * Authors : Brent Salisbury, Hugo Trippaers
- */
-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;
-
-public class OvsdbTestSetOFControllerIT extends OvsdbTestBase {
-    private static final Logger logger = LoggerFactory
-            .getLogger(OvsdbTestSetOFControllerIT.class);
-
-    @Test
-    public void setController() throws Throwable{
-        TestObjects testObjects = getTestConnection();
-        Node node = testObjects.node;
-
-        Map<ConfigConstants, Object> configs = new HashMap<ConfigConstants, Object>();
-        configs.put(ConfigConstants.DEST_IP, "192.168.254.1");
-        configs.put(ConfigConstants.CUSTOM, "6633");
-        ConfigurationService configurationService = testObjects.configurationService;
-        configurationService.setBridgeOFController(node, BRIDGE_NAME);
-
-    }
-}
similarity index 88%
rename from plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestBase.java
rename to plugin/src/test/java/org/opendaylight/ovsdb/plugin/PluginTestBase.java
index 379231142fe42d8197a225d2cb50c1ad7f9bb20d..5c088aaa5525e3e57c6dadefa89580506393f620 100644 (file)
@@ -21,11 +21,11 @@ import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.core.NodeConnector;
 import org.opendaylight.ovsdb.lib.impl.OvsdbConnectionService;
 
-public abstract class OvsdbTestBase {
+public abstract class PluginTestBase {
     private final static String identifier = "TEST";
     protected final static String BRIDGE_NAME = "JUNIT_TEST_BRIDGE";
-    protected final static String PORT_NAME = "eth0";
-    protected final static String TAGGED_PORT_NAME = "eth1";
+    protected final static String PORT_NAME = "test0";
+    protected final static String TAGGED_PORT_NAME = "test1";
     protected final static String TUNNEL_PORT_NAME = "vxlan0";
     protected final static String FAKE_IP = "192.168.254.254";
     private final static String SERVER_IPADDRESS = "ovsdbserver.ipaddress";
@@ -52,6 +52,9 @@ public abstract class OvsdbTestBase {
     }
 
     public TestObjects getTestConnection() throws IOException {
+        if (OvsdbPluginTestSuiteIT.getTestObjects() != null) {
+            return OvsdbPluginTestSuiteIT.getTestObjects();
+        }
         Properties props = loadProperties();
         String address = props.getProperty(SERVER_IPADDRESS);
         String port = props.getProperty(SERVER_PORT, DEFAULT_SERVER_PORT);
@@ -86,13 +89,16 @@ public abstract class OvsdbTestBase {
         if (node == null) {
             throw new IOException("Failed to connect to the ovsdb server");
         }
+
         try {
             Thread.sleep(2000);
         } catch (InterruptedException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
-        } // TODO : Remove this once Select is operational
-        return new TestObjects(connectionService, node, inventory, configurationService);
+        }
+        TestObjects testObject = new TestObjects(connectionService, node, inventory, configurationService);
+        OvsdbPluginTestSuiteIT.setTestObjects(testObject);
+        return testObject;
     }
 
 }
similarity index 63%
rename from plugin/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestAddBridgeIT.java
rename to plugin/src/test/java/org/opendaylight/ovsdb/plugin/TearDown.java
index eb6cba7d039913f6453b1c715a8329d4a92f2fb8..a212eff28b8939de4a9b80f89cac0311fd7eca84 100644 (file)
@@ -1,38 +1,35 @@
-/*\r
- * [[ Authors will Fill in the Copyright header ]]\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Authors : Brent Salisbury, Hugo Trippaers\r
- */\r
-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
-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
-        TestObjects testObjects = getTestConnection();\r
-        ConnectionService connectionService = testObjects.connectionService;\r
-        Node node = testObjects.node;\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 = testObjects.configurationService;\r
-        configurationService.createBridgeDomain(node, BRIDGE_NAME, null);\r
-    }\r
-\r
-}\r
+/*
+ * [[ Authors will Fill in the Copyright header ]]
+ *
+ * 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
+ *
+ * Authors : Brent Salisbury, Hugo Trippaers
+ */
+package org.opendaylight.ovsdb.plugin;
+
+import org.junit.Test;
+import org.opendaylight.controller.sal.core.Node;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TearDown extends PluginTestBase {
+    private static final Logger logger = LoggerFactory
+            .getLogger(TearDown.class);
+
+    /**
+     * Final Cleanup. Delete the test Bridge.
+     */
+
+    @Test
+    public void deleteBridge() throws Throwable{
+
+        TestObjects testObjects = getTestConnection();
+        ConnectionService connectionService = testObjects.connectionService;
+        Node node = testObjects.node;
+        ConfigurationService configurationService = testObjects.configurationService;
+        configurationService.deleteBridgeDomain(node, BRIDGE_NAME);
+    }
+
+}