Fix integration tests 37/6837/1
authorDave Tucker <dave@dtucker.co.uk>
Fri, 9 May 2014 18:52:40 +0000 (19:52 +0100)
committerDave Tucker <dave@dtucker.co.uk>
Fri, 9 May 2014 18:53:30 +0000 (19:53 +0100)
Fix hardcoded values and connection issue in OVSDB IT

Change-Id: I79f5fd44f3fa4ee86634a8b979b9bcb7e4fba030
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestBase.java
ovsdb/src/test/java/org/opendaylight/ovsdb/plugin/OvsdbTestDeletePortIT.java

index f6929b335759323a3f69c915ab4405d16f80ce10..998d447254ec40bb185cc9953524ab1c851952da 100644 (file)
@@ -54,6 +54,9 @@ public abstract class OvsdbTestBase {
 
         ConnectionService connectionService = new ConnectionService();
         connectionService.init();
+        InventoryService inventory = new InventoryService();
+        inventory.init();
+        connectionService.setInventoryServiceInternal(inventory);
         Map<ConnectionConstants, String> params = new HashMap<ConnectionConstants, String>();
         Properties props = loadProperties();
         params.put(ConnectionConstants.ADDRESS,
index dd5925862f276fc6f63f885a8f9af693c209512c..17673a66c805c8476736dec0ea8f327f718752f4 100644 (file)
@@ -9,44 +9,33 @@
  */
 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.opendaylight.controller.sal.core.NodeConnector;
-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 OvsdbTestDeletePortIT {
+public class OvsdbTestDeletePortIT 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 deletePort() 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, "10.12.0.78");
-        params.put(ConnectionConstants.PORT, "6634");
-
-        Node node = connectionService.connect(identifier, params);
-        if(node == null){
-            logger.error("Could not connect to ovsdb server");
-            return;
-        }
-        /**
-         * 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
-         */
+        TestObjects testObjects = getTestConnection();
+        ConnectionService connectionService = testObjects.connectionService;
+        Node node = testObjects.node;
+
+
         ConfigurationService configurationService = new ConfigurationService();
         configurationService.setConnectionServiceInternal(connectionService);
         configurationService.deletePort(node, "ovsbr0", "tap2");