BUG-2658: Remove adsal and migrate to mdsal 46/14646/2
authorSam Hague <shague@redhat.com>
Fri, 30 Jan 2015 19:59:32 +0000 (14:59 -0500)
committerFlavio Fernandes <ffernand@redhat.com>
Fri, 30 Jan 2015 22:32:43 +0000 (22:32 +0000)
The patch removes the deprecated BridgeDomain api.

Change-Id: I6e731183cb1c97e2c0e62ac90759d96a97bbb087
Signed-off-by: Sam Hague <shague@redhat.com>
integrationtest/src/test/java/org/opendaylight/ovsdb/integrationtest/bridgedomain/BridgeDomainConfigBridgeTestCases.java [deleted file]
integrationtest/src/test/java/org/opendaylight/ovsdb/integrationtest/bridgedomain/BridgeDomainConfigManagerTestCases.java [deleted file]
integrationtest/src/test/java/org/opendaylight/ovsdb/integrationtest/bridgedomain/BridgeDomainConfigPortTestCases.java [deleted file]
integrationtest/src/test/java/org/opendaylight/ovsdb/integrationtest/bridgedomain/BridgeDomainTestSuiteIT.java [deleted file]
integrationtest/src/test/java/org/opendaylight/ovsdb/integrationtest/bridgedomain/PluginTestBase.java [deleted file]
integrationtest/src/test/java/org/opendaylight/ovsdb/integrationtest/bridgedomain/TearDown.java [deleted file]
plugin/src/main/java/org/opendaylight/ovsdb/plugin/impl/ConfigurationServiceImpl.java
plugin/src/main/java/org/opendaylight/ovsdb/plugin/internal/Activator.java

diff --git a/integrationtest/src/test/java/org/opendaylight/ovsdb/integrationtest/bridgedomain/BridgeDomainConfigBridgeTestCases.java b/integrationtest/src/test/java/org/opendaylight/ovsdb/integrationtest/bridgedomain/BridgeDomainConfigBridgeTestCases.java
deleted file mode 100644 (file)
index 4e93634..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- *
- *  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 : Sam Hague
- * /
- */
-package org.opendaylight.ovsdb.integrationtest.bridgedomain;
-
-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.opendaylight.ovsdb.plugin.impl.ConfigurationServiceImpl;
-import org.opendaylight.ovsdb.plugin.impl.ConnectionServiceImpl;
-import org.opendaylight.ovsdb.plugin.impl.InventoryServiceImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class BridgeDomainConfigBridgeTestCases extends PluginTestBase {
-    private static final Logger logger = LoggerFactory
-            .getLogger(BridgeDomainConfigBridgeTestCases.class);
-
-    /**
-     * Add OVS bridge "JUNIT_TEST_BRIDGE" for all other test
-     * Ex. ovs-vsctl add-br br0
-     *
-     * @throws Throwable
-     */
-    @Test
-    public void addBridge() throws Throwable{
-
-        TestObjects testObjects = getTestConnection();
-        ConnectionServiceImpl 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
-         */
-        ConfigurationServiceImpl configurationService = testObjects.configurationService;
-        configurationService.createBridgeDomain(node, BRIDGE_NAME, null);
-    }
-
-    /**
-     * List all bridge domains on this OVS bridge
-     * Ex. ovs-vsctl show
-     *
-     * @throws Throwable
-     */
-    @Test
-    public void getBridgeDomains() throws Throwable{
-
-        TestObjects testObjects = getTestConnection();
-        ConnectionServiceImpl connectionService = testObjects.connectionService;
-        InventoryServiceImpl inventoryService = testObjects.inventoryService;
-        Node node = testObjects.node;
-
-        /**
-         * List a Bridge Domain
-         *
-         * @param node Node serving this configuration service
-         *
-         */
-        ConfigurationServiceImpl configurationService = testObjects.configurationService;
-        List<String> ls = configurationService.getBridgeDomains(node);
-    }
-
-    /**
-     * Register self node as the bridge's OpenFlow controller
-     * e.g., ovs-vsctl set-controller br0 <node>
-     *
-     * @throws Throwable
-     */
-    @Test
-    public void setController() throws Throwable{
-        TestObjects testObjects = getTestConnection();
-        Node node = testObjects.node;
-
-        ConfigurationServiceImpl configurationService = testObjects.configurationService;
-        configurationService.setBridgeOFController(node, BRIDGE_NAME);
-    }
-
-    /**
-     * Test the assignment of "external ID" key/value pairs on bridge
-     * e.g., ovs-vsctl br−set−external−id br0 <key> <value>
-     *
-     * @throws Throwable
-     */
-    @Test
-    public void setBridgeConfig() throws Throwable{
-        TestObjects testObjects = getTestConnection();
-        ConnectionServiceImpl 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);
-
-        ConfigurationServiceImpl configurationService = testObjects.configurationService;
-        configurationService.addBridgeDomainConfig(node, BRIDGE_NAME, configs);
-    }
-
-}
diff --git a/integrationtest/src/test/java/org/opendaylight/ovsdb/integrationtest/bridgedomain/BridgeDomainConfigManagerTestCases.java b/integrationtest/src/test/java/org/opendaylight/ovsdb/integrationtest/bridgedomain/BridgeDomainConfigManagerTestCases.java
deleted file mode 100644 (file)
index 42d41bc..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *
- *  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 : Sam Hague
- * /
- */
-package org.opendaylight.ovsdb.integrationtest.bridgedomain;
-
-import org.junit.Test;
-import org.opendaylight.controller.sal.core.Node;
-import org.opendaylight.ovsdb.plugin.impl.ConfigurationServiceImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class BridgeDomainConfigManagerTestCases extends PluginTestBase {
-    private static final Logger logger = LoggerFactory
-            .getLogger(BridgeDomainConfigManagerTestCases.class);
-
-    /**
-     * Set manager for the OVS node
-     * Ex. ovs-vsctl set-manager tcp:192.168.254.254:6634
-     *
-     * @throws Throwable
-     */
-    @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
-         *
-         */
-        ConfigurationServiceImpl configurationService = testObjects.configurationService;
-        configurationService.setManager(node, manager);
-    }
-
-}
diff --git a/integrationtest/src/test/java/org/opendaylight/ovsdb/integrationtest/bridgedomain/BridgeDomainConfigPortTestCases.java b/integrationtest/src/test/java/org/opendaylight/ovsdb/integrationtest/bridgedomain/BridgeDomainConfigPortTestCases.java
deleted file mode 100644 (file)
index 2ca2dfe..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- *
- *  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 : Sam Hague
- * /
- */
-package org.opendaylight.ovsdb.integrationtest.bridgedomain;
-
-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.opendaylight.ovsdb.plugin.impl.ConfigurationServiceImpl;
-import org.opendaylight.ovsdb.plugin.impl.ConnectionServiceImpl;
-import org.opendaylight.ovsdb.plugin.internal.Encapsulation;
-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
-     *
-     * @throws Throwable
-     */
-    @Test
-    public void addPort() throws Throwable{
-        TestObjects testObjects = getTestConnection();
-        ConnectionServiceImpl connectionService = testObjects.connectionService;
-        Node node = testObjects.node;
-        ConfigurationServiceImpl 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
-     *
-     * @throws Throwable
-     */
-    @Test
-    public void addPortVlan() throws Throwable{
-        TestObjects testObjects = getTestConnection();
-        ConnectionServiceImpl connectionService = testObjects.connectionService;
-        Node node = testObjects.node;
-
-        int vlanid = 100;
-
-        ConfigurationServiceImpl 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
-     *
-     * @throws Throwable
-     */
-
-    @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;
-
-        ConfigurationServiceImpl 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
-     *
-     * @throws Throwable
-     */
-    @Test
-    public void deletePort() throws Throwable{
-        TestObjects testObjects = getTestConnection();
-        ConnectionServiceImpl connectionService = testObjects.connectionService;
-        Node node = testObjects.node;
-
-        ConfigurationServiceImpl configurationService = testObjects.configurationService;
-        configurationService.deletePort(node, BRIDGE_NAME, PORT_NAME);
-    }
-
-}
diff --git a/integrationtest/src/test/java/org/opendaylight/ovsdb/integrationtest/bridgedomain/BridgeDomainTestSuiteIT.java b/integrationtest/src/test/java/org/opendaylight/ovsdb/integrationtest/bridgedomain/BridgeDomainTestSuiteIT.java
deleted file mode 100644 (file)
index 8b3652f..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *
- *  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 : Sam Hague
- * /
- */
-package org.opendaylight.ovsdb.integrationtest.bridgedomain;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
-    BridgeDomainConfigBridgeTestCases.class,
-    BridgeDomainConfigPortTestCases.class,
-    BridgeDomainConfigManagerTestCases.class,
-    TearDown.class})
-
-public class BridgeDomainTestSuiteIT {
-    static PluginTestBase.TestObjects testObjects;
-
-    public static PluginTestBase.TestObjects getTestObjects() {
-        return testObjects;
-    }
-
-    public static void setTestObjects(PluginTestBase.TestObjects testObjects) {
-        BridgeDomainTestSuiteIT.testObjects = testObjects;
-    }
-
-}
diff --git a/integrationtest/src/test/java/org/opendaylight/ovsdb/integrationtest/bridgedomain/PluginTestBase.java b/integrationtest/src/test/java/org/opendaylight/ovsdb/integrationtest/bridgedomain/PluginTestBase.java
deleted file mode 100644 (file)
index c98e129..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- *
- *  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 : Sam Hague
- * /
- */
-package org.opendaylight.ovsdb.integrationtest.bridgedomain;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-import junit.framework.Assert;
-import org.junit.Rule;
-import org.junit.rules.TestRule;
-import org.junit.rules.TestWatcher;
-import org.junit.runner.Description;
-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.lib.impl.OvsdbConnectionService;
-import org.opendaylight.ovsdb.plugin.impl.ConfigurationServiceImpl;
-import org.opendaylight.ovsdb.plugin.impl.ConnectionServiceImpl;
-import org.opendaylight.ovsdb.plugin.impl.InventoryServiceImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public abstract class PluginTestBase {
-    private static final Logger LOG = LoggerFactory.getLogger(PluginTestBase.class);
-    private final static String identifier = "TEST";
-    protected final static String BRIDGE_NAME = "JUNIT_TEST_BRIDGE";
-    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";
-    private final static String SERVER_PORT = "ovsdbserver.port";
-    private final static String DEFAULT_SERVER_PORT = "6640";
-
-    public Properties loadProperties() throws IOException {
-        Properties props = new Properties(System.getProperties());
-        return props;
-    }
-
-    public class TestObjects {
-        public final ConnectionServiceImpl connectionService;
-        public final InventoryServiceImpl inventoryService;
-        public final ConfigurationServiceImpl configurationService;
-        public final Node node;
-
-        public TestObjects(ConnectionServiceImpl connectionService, Node node, InventoryServiceImpl inventoryService, ConfigurationServiceImpl configurationService) {
-            this.connectionService = connectionService;
-            this.inventoryService = inventoryService;
-            this.configurationService = configurationService;
-            this.node = node;
-        }
-    }
-
-    public TestObjects getTestConnection() throws IOException {
-        if (BridgeDomainTestSuiteIT.getTestObjects() != null) {
-            return BridgeDomainTestSuiteIT.getTestObjects();
-        }
-        Properties props = loadProperties();
-        String address = props.getProperty(SERVER_IPADDRESS);
-        String port = props.getProperty(SERVER_PORT, DEFAULT_SERVER_PORT);
-
-        if (address == null) {
-            Assert.fail("Usage : mvn -Pintegrationtest -Dovsdbserver.ipaddress=x.x.x.x -Dovsdbserver.port=yyyy verify");
-        }
-
-        Node.NodeIDType.registerIDType("OVS", String.class);
-        NodeConnector.NodeConnectorIDType.registerIDType("OVS", String.class,
-                "OVS");
-        InventoryServiceImpl inventoryService = new InventoryServiceImpl();
-        inventoryService.init();
-
-        ConnectionServiceImpl connectionService = new ConnectionServiceImpl();
-        connectionService.init();
-        InventoryServiceImpl inventory = new InventoryServiceImpl();
-        inventory.init();
-        connectionService.setOvsdbInventoryService(inventory);
-        connectionService.setOvsdbConnection(OvsdbConnectionService.getService());
-        ConfigurationServiceImpl configurationService = new ConfigurationServiceImpl();
-        configurationService.setConnectionServiceInternal(connectionService);
-        configurationService.setOvsdbInventoryService(inventory);
-        inventory.setOvsdbConfigurationService(configurationService);
-
-        Map<ConnectionConstants, String> params = new HashMap<ConnectionConstants, String>();
-
-        params.put(ConnectionConstants.ADDRESS, address);
-        params.put(ConnectionConstants.PORT, port);
-
-        Node node = connectionService.connect(identifier, params);
-        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();
-        }
-        TestObjects testObject = new TestObjects(connectionService, node, inventory, configurationService);
-        BridgeDomainTestSuiteIT.setTestObjects(testObject);
-        return testObject;
-    }
-
-    @Rule
-    public TestRule watcher = new TestWatcher() {
-        @Override
-        protected void starting(Description description) {
-            LOG.info("TestWatcher: Starting test: {}",
-                    description.getDisplayName());
-        }
-
-        @Override
-        protected void finished(Description description) {
-            LOG.info("TestWatcher: Finished test: {}", description.getDisplayName());
-        }
-    };
-}
diff --git a/integrationtest/src/test/java/org/opendaylight/ovsdb/integrationtest/bridgedomain/TearDown.java b/integrationtest/src/test/java/org/opendaylight/ovsdb/integrationtest/bridgedomain/TearDown.java
deleted file mode 100644 (file)
index 597289a..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *
- *  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 : Sam Hague
- * /
- */
-package org.opendaylight.ovsdb.integrationtest.bridgedomain;
-
-import org.junit.Test;
-import org.opendaylight.controller.sal.core.Node;
-import org.opendaylight.ovsdb.plugin.impl.ConfigurationServiceImpl;
-import org.opendaylight.ovsdb.plugin.impl.ConnectionServiceImpl;
-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 "JUNIT_TEST_BRIDGE".
-     */
-
-    @Test
-    public void deleteBridge() throws Throwable{
-
-        TestObjects testObjects = getTestConnection();
-        ConnectionServiceImpl connectionService = testObjects.connectionService;
-        Node node = testObjects.node;
-        ConfigurationServiceImpl configurationService = testObjects.configurationService;
-        configurationService.deleteBridgeDomain(node, BRIDGE_NAME);
-    }
-
-}
index 986d8460a3486d83a3f5a6654c894ff9be9ca21a..aa53a40399c1435fe668785dbf59f9dfaafbf210 100644 (file)
@@ -16,22 +16,15 @@ import java.net.UnknownHostException;
 import java.util.AbstractMap;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.ExecutionException;
 
-import org.eclipse.osgi.framework.console.CommandInterpreter;
 import org.eclipse.osgi.framework.console.CommandProvider;
 import org.opendaylight.controller.clustering.services.IClusterGlobalServices;
-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.controller.sal.networkconfig.bridgedomain.IPluginInBridgeDomainConfigService;
 import org.opendaylight.controller.sal.utils.Status;
 import org.opendaylight.controller.sal.utils.StatusCode;
 import org.opendaylight.ovsdb.lib.OvsdbClient;
@@ -61,8 +54,6 @@ import org.opendaylight.ovsdb.plugin.api.StatusWithUuid;
 import org.opendaylight.ovsdb.plugin.error.OvsdbPluginException;
 import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
 import org.opendaylight.ovsdb.schema.openvswitch.Controller;
-import org.opendaylight.ovsdb.schema.openvswitch.Interface;
-import org.opendaylight.ovsdb.schema.openvswitch.Manager;
 import org.opendaylight.ovsdb.schema.openvswitch.OpenVSwitch;
 import org.opendaylight.ovsdb.schema.openvswitch.Port;
 import org.opendaylight.ovsdb.utils.config.ConfigProperties;
@@ -73,21 +64,17 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import com.fasterxml.jackson.databind.node.ObjectNode;
-import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
 import com.google.common.util.concurrent.ListenableFuture;
 
-public class ConfigurationServiceImpl implements IPluginInBridgeDomainConfigService,
-                                                 OvsdbConfigurationService,
-                                                 CommandProvider
+public class ConfigurationServiceImpl implements OvsdbConfigurationService
 {
     private static final Logger logger = LoggerFactory
             .getLogger(ConfigurationServiceImpl.class);
 
     OvsdbConnectionService connectionService;
     OvsdbInventoryService ovsdbInventoryService;
-    boolean forceConnect = false;
     protected static final String OPENFLOW_10 = "1.0";
     protected static final String OPENFLOW_13 = "1.3";
 
@@ -556,600 +543,6 @@ public class ConfigurationServiceImpl implements IPluginInBridgeDomainConfigServ
         return client.createTypedRowWrapper(typedClass);
     }
 
-    public void _ovsconnect (CommandInterpreter ci) {
-        String bridgeName = ci.nextArgument();
-        if (bridgeName == null) {
-            ci.println("Please enter Bridge Name");
-            return;
-        }
-
-        String ovsdbserver = ci.nextArgument();
-        if (ovsdbserver == null) {
-            ci.println("Please enter valid IP-Address");
-            return;
-        }
-        try {
-            InetAddress.getByName(ovsdbserver);
-        }  catch (UnknownHostException e) {
-            logger.error("Unable to resolve " + ovsdbserver, e);
-            ci.println("Please enter valid IP-Address");
-            return;
-        }
-        String port = ci.nextArgument();
-        if (port == null) {
-            port = "6634";
-        }
-
-        ci.println("connecting to ovsdb server : "+ovsdbserver+":"+port+" ... ");
-        Map<ConnectionConstants, String> params = new HashMap<ConnectionConstants, String>();
-        params.put(ConnectionConstants.ADDRESS, ovsdbserver);
-        params.put(ConnectionConstants.PORT, port);
-        Node node = connectionService.connect(bridgeName, params);
-        if (node != null) ci.println("Node Name: "+node.toString());
-        else ci.println("Could not connect to Node");
-    }
-
-    public void _addBridge (CommandInterpreter ci) {
-        String nodeName = ci.nextArgument();
-        if (nodeName == null) {
-            ci.println("Please enter Node Name");
-            return;
-        }
-        String bridgeName = ci.nextArgument();
-        if (bridgeName == null) {
-            ci.println("Please enter Bridge Name");
-            return;
-        }
-        Status status;
-
-        Node node = Node.fromString(nodeName);
-        if (node == null) {
-            ci.println("Invalid Node");
-            return;
-        }
-        status = this.createBridgeDomain(node, bridgeName, null);
-        ci.println("Bridge creation status : "+status.toString());
-    }
-
-    public void _getBridgeDomains (CommandInterpreter ci) {
-        String nodeName = ci.nextArgument();
-        if (nodeName == null) {
-            ci.println("Please enter Node Name");
-            return;
-        }
-
-        List<String> brlist = new ArrayList<String>();
-        Node node = Node.fromString(nodeName);
-        brlist = this.getBridgeDomains(node);
-        if (node == null) {
-            ci.println("Invalid Node");
-            return;
-        }
-        ci.println("Existing Bridges: "+brlist.toString());
-    }
-
-    public void _deleteBridgeDomain (CommandInterpreter ci) {
-        String nodeName = ci.nextArgument();
-        if (nodeName == null) {
-            ci.println("Please enter Node Name");
-            return;
-        }
-        String bridgeName = ci.nextArgument();
-        if (bridgeName == null) {
-            ci.println("Please enter Bridge Name");
-            return;
-        }
-        Status status;
-        Node node = Node.fromString(nodeName);
-        if (node == null) {
-            ci.println("Invalid Node");
-            return;
-        }
-        status = this.deleteBridgeDomain(node, bridgeName);
-        ci.println("Bridge deletion status : "+status.toString());
-    }
-
-    public void _addPort (CommandInterpreter ci) {
-        String nodeName = ci.nextArgument();
-        if (nodeName == null) {
-            ci.println("Please enter Node Name");
-            return;
-        }
-
-        String bridgeName = ci.nextArgument();
-        if (bridgeName == null) {
-            ci.println("Please enter Bridge Name");
-            return;
-        }
-
-        String portName = ci.nextArgument();
-        if (portName == null) {
-            ci.println("Please enter Port Name");
-            return;
-        }
-
-        String type = ci.nextArgument();
-
-        Map<String, String> configs = new HashMap<String, String>();
-        while(true) {
-            String configKey = ci.nextArgument();
-            if (configKey == null) break;
-            String configValue = ci.nextArgument();
-            if (configValue == null) break;
-            configs.put(configKey, configValue);
-        }
-
-        Map<ConfigConstants, Object> customConfigs = null;
-        if (type != null) {
-            customConfigs = new HashMap<ConfigConstants, Object>();
-            customConfigs.put(ConfigConstants.TYPE, type);
-        }
-
-        if (configs.size() > 0) {
-            if (customConfigs == null) customConfigs = new HashMap<ConfigConstants, Object>();
-            customConfigs.put(ConfigConstants.CUSTOM, configs);
-            ci.println(customConfigs.toString());
-        }
-        Status status;
-        Node node = Node.fromString(nodeName);
-        if (node == null) {
-            ci.println("Invalid Node");
-            return;
-        }
-        status = this.addPort(node, bridgeName, portName, customConfigs);
-        ci.println("Port creation status : "+status.toString());
-    }
-
-    public void _deletePort (CommandInterpreter ci) {
-        String nodeName = ci.nextArgument();
-        if (nodeName == null) {
-            ci.println("Please enter Node Name");
-            return;
-        }
-
-        String bridgeName = ci.nextArgument();
-        if (bridgeName == null) {
-            ci.println("Please enter Bridge Name");
-            return;
-        }
-
-        String portName = ci.nextArgument();
-        if (portName == null) {
-            ci.println("Please enter Port Name");
-            return;
-        }
-
-        Status status;
-        Node node = Node.fromString(nodeName);
-        if (node == null) {
-            ci.println("Invalid Node");
-            return;
-        }
-        status = this.deletePort(node, bridgeName, portName);
-        ci.println("Port deletion status : "+status.toString());
-    }
-
-    public void _addPortVlan (CommandInterpreter ci) {
-        String nodeName = ci.nextArgument();
-        if (nodeName == null) {
-            ci.println("Please enter Node Name");
-            return;
-        }
-
-        String bridgeName = ci.nextArgument();
-        if (bridgeName == null) {
-            ci.println("Please enter Bridge Name");
-            return;
-        }
-
-        String portName = ci.nextArgument();
-        if (portName == null) {
-            ci.println("Please enter Port Name");
-            return;
-        }
-
-        String vlan = ci.nextArgument();
-        if (vlan == null) {
-            ci.println("Please enter Valid Vlan");
-            return;
-        } else {
-            try {
-            Integer.parseInt(vlan);
-            } catch (NumberFormatException e) {
-                ci.println("Please enter Valid Vlan");
-                return;
-            }
-        }
-
-        Map<ConfigConstants, Object> configs = new HashMap<ConfigConstants, Object>();
-        configs.put(ConfigConstants.TYPE, "VLAN");
-        configs.put(ConfigConstants.VLAN, vlan);
-
-        Status status;
-        Node node = Node.fromString(nodeName);
-        if (node == null) {
-            ci.println("Invalid Node");
-            return;
-        }
-        status = this.addPort(node, bridgeName, portName, configs);
-        ci.println("Port creation status : "+status.toString());
-    }
-
-    public void _addTunnel (CommandInterpreter ci) {
-        String nodeName = ci.nextArgument();
-        if (nodeName == null) {
-            ci.println("Please enter Node Name");
-            return;
-        }
-
-        String bridgeName = ci.nextArgument();
-        if (bridgeName == null) {
-            ci.println("Please enter Bridge Name");
-            return;
-        }
-
-        String portName = ci.nextArgument();
-        if (portName == null) {
-            ci.println("Please enter Port Name");
-            return;
-        }
-
-        String tunnelType = ci.nextArgument();
-        if (tunnelType == null) {
-            ci.println("Please enter Tunnel Type");
-            return;
-        }
-
-        String remoteIp = ci.nextArgument();
-        if (remoteIp == null) {
-            ci.println("Please enter valid Remote IP Address");
-            return;
-        }
-
-        try {
-            InetAddress.getByName(remoteIp);
-        }  catch (Exception e) {
-            logger.error("Unable to resolve " + remoteIp, e);
-            ci.println("Please enter valid Remote IP Address");
-            return;
-        }
-
-        Map<ConfigConstants, Object> configs = new HashMap<ConfigConstants, Object>();
-        configs.put(ConfigConstants.TYPE, "TUNNEL");
-        configs.put(ConfigConstants.TUNNEL_TYPE, tunnelType);
-        configs.put(ConfigConstants.DEST_IP, remoteIp);
-
-        Status status;
-        Node node = Node.fromString(nodeName);
-        if (node == null) {
-            ci.println("Invalid Node");
-            return;
-        }
-        status = this.addPort(node, bridgeName, portName, configs);
-        ci.println("Port creation status : "+status.toString());
-    }
-
-    public void _printCache (CommandInterpreter ci) {
-        String nodeName = ci.nextArgument();
-        if (nodeName == null) {
-            ci.println("Please enter Node Name");
-            return;
-        }
-        Node node = Node.fromString(nodeName);
-        if (node == null) {
-            ci.println("Invalid Node");
-            return;
-        }
-        ovsdbInventoryService.printCache(node);
-    }
-
-    public void _forceConnect (CommandInterpreter ci) {
-        String force = ci.nextArgument();
-        if (force.equalsIgnoreCase("YES")) {
-            forceConnect = true;
-        }
-        else if (force.equalsIgnoreCase("NO")) {
-            forceConnect = false;
-        }
-        else {
-            ci.println("Please enter YES or NO.");
-        }
-        ci.println("Current ForceConnect State : "+forceConnect);
-    }
-
-    @Override
-    public String getHelp() {
-        StringBuilder help = new StringBuilder();
-        help.append("---OVSDB CLI---\n");
-        help.append("\t ovsconnect <ConnectionName> <ip-address>                        - Connect to OVSDB\n");
-        help.append("\t addBridge <Node> <BridgeName>                                   - Add Bridge\n");
-        help.append("\t getBridgeDomains <Node>                                         - Get Bridges\n");
-        help.append("\t deleteBridgeDomain <Node> <BridgeName>                          - Delete a Bridge\n");
-        help.append("\t addPort <Node> <BridgeName> <PortName> <type> <options pairs>   - Add Port\n");
-        help.append("\t deletePort <Node> <BridgeName> <PortName>                       - Delete Port\n");
-        help.append("\t addPortVlan <Node> <BridgeName> <PortName> <vlan>               - Add Port, Vlan\n");
-        help.append("\t addTunnel <Node> <Bridge> <Port> <tunnel-type> <remote-ip>      - Add Tunnel\n");
-        help.append("\t printCache <Node>                                               - Prints Table Cache");
-        return help.toString();
-    }
-
-
-    /**
-     * Add a new bridge
-     * @param node Node serving this configuration service
-     * @param bridgeIdentifier String representation of a Bridge Connector
-     * @return Bridge Connector configurations
-     */
-    @Override
-    @Deprecated
-    public Status createBridgeDomain(Node node, String bridgeIdentifier, Map<ConfigConstants, Object> configs) {
-        Connection connection = connectionService.getConnection(node);
-        OvsdbClient client = connection.getClient();
-        Bridge bridge = client.createTypedRowWrapper(Bridge.class);
-        bridge.setName(bridgeIdentifier);
-
-        String ovsTableUuid = this.getSpecialCaseParentUUID(node, OvsVswitchdSchemaConstants.DATABASE_NAME, bridge.getSchema().getName());
-        return this.insertRow(node, bridge.getSchema().getName(), ovsTableUuid, bridge.getRow());
-    }
-
-    /**
-     * Create a Port Attached to a Bridge
-     * Ex. ovs-vsctl add-port br0 vif0
-     * @param node Node serving this configuration service
-     * @param bridgeIdentifier String representation of a Bridge Domain
-     * @param portIdentifier String representation of a user defined Port Name
-     */
-    @Override
-    @Deprecated
-    public Status addPort(Node node, String bridgeIdentifier, String portIdentifier,
-                          Map<ConfigConstants, Object> configs) {
-        Connection connection = connectionService.getConnection(node);
-        OvsdbClient client = connection.getClient();
-
-        Bridge bridge = client.getTypedRowWrapper(Bridge.class, null);
-        ConcurrentMap<String, Row> rows = this.getRows(node, bridge.getSchema().getName());
-        if (rows == null || rows.size() == 0) {
-            return new Status(StatusCode.NOTFOUND);
-        }
-        for (String bridgeUuid : rows.keySet()) {
-            Row bridgeRow = rows.get(bridgeUuid);
-            bridge = client.getTypedRowWrapper(Bridge.class, bridgeRow);
-            if (bridge.getName().equals(bridgeIdentifier)) break;
-        }
-        if (bridge.getName() == null || !bridge.getName().equals(bridgeIdentifier)) {
-            return new Status(StatusCode.NOTFOUND);
-        }
-
-        Map<String, String> options = null;
-        String type = null;
-        Set<Long> tags = null;
-        if (configs != null) {
-            type = (String) configs.get(ConfigConstants.TYPE);
-            Map<String, String> customConfigs = (Map<String, String>) configs.get(ConfigConstants.CUSTOM);
-            if (customConfigs != null) {
-                options = new HashMap<String, String>();
-                for (String customConfig : customConfigs.keySet()) {
-                    options.put(customConfig, customConfigs.get(customConfig));
-                }
-            }
-        }
-
-        if (type != null) {
-            logger.debug("Port type : " + type);
-            if (type.equalsIgnoreCase(OvsVswitchdSchemaConstants.PortType.VLAN.name())) {
-                tags = new HashSet<Long>();
-                tags.add(Long.parseLong((String)configs.get(ConfigConstants.VLAN)));
-            }
-        }
-
-        Port port = client.createTypedRowWrapper(Port.class);
-        port.setName(portIdentifier);
-        if (tags != null) port.setTag(tags);
-        StatusWithUuid portStatus = this.insertRow(node, port.getSchema().getName(), bridge.getUuid().toString(), port.getRow());
-
-        if (!portStatus.isSuccess()) return portStatus;
-        // Ugly hack by adding a sleep for the Monitor Update to catch up.
-        // TODO : Remove this once the Select operation is in place.
-        // We are currently relying on the local Cache for any GET operation and that might fail if we try to
-        // fetch the last installed entry. Hence we need the Select operation to work.
-
-        try {
-            Thread.sleep(2000);
-        } catch (InterruptedException e) {
-            // TODO Auto-generated catch block
-            logger.error("Thread interrupted", e);
-        }
-
-        Interface interfaceRow = client.createTypedRowWrapper(Interface.class);
-        ConcurrentMap<String, Row> intfRows = this.getRows(node, interfaceRow.getSchema().getName());
-        if (intfRows == null || intfRows.size() == 0) {
-            return new Status(StatusCode.NOTFOUND);
-        }
-        for (String intfUuid : intfRows.keySet()) {
-            Row intfRow = intfRows.get(intfUuid);
-            interfaceRow = client.getTypedRowWrapper(Interface.class, intfRow);
-            if (interfaceRow == null || interfaceRow.getName() == null) continue;
-            if (interfaceRow.getName().equals(portIdentifier)) break;
-        }
-        if (interfaceRow.getName() == null || !interfaceRow.getName().equals(portIdentifier)) {
-            return new Status(StatusCode.NOTFOUND);
-        }
-        Interface updateInterface = client.createTypedRowWrapper(Interface.class);
-        if (type != null) {
-            logger.debug("Interface type : " + type);
-            if (type.equalsIgnoreCase(OvsVswitchdSchemaConstants.PortType.TUNNEL.name())) {
-                updateInterface.setType((String)configs.get(ConfigConstants.TUNNEL_TYPE));
-                if (options == null) options = new HashMap<String, String>();
-                options.put("remote_ip", (String)configs.get(ConfigConstants.DEST_IP));
-            } else if (type.equalsIgnoreCase(OvsVswitchdSchemaConstants.PortType.PATCH.name()) ||
-                       type.equalsIgnoreCase(OvsVswitchdSchemaConstants.PortType.INTERNAL.name())) {
-                updateInterface.setType(type.toLowerCase());
-            }
-        }
-        if (options != null) {
-            updateInterface.setOptions(options);
-        }
-
-        Status intfStatus = null;
-        intfStatus = this.updateRow(node, interfaceRow.getSchema().getName(), portStatus.getUuid().toString(),
-                                    interfaceRow.getUuid().toString(), updateInterface.getRow());
-
-        if (intfStatus.isSuccess()) return portStatus;
-        return intfStatus;
-    }
-
-    /**
-     * Implements the OVS Connection for Managers
-     *
-     * @param node Node serving this configuration service
-     * @param managerip String Representing IP and connection types
-     */
-    @SuppressWarnings("unchecked")
-    @Deprecated
-    public boolean setManager(Node node, String managerip) {
-        Connection connection = connectionService.getConnection(node);
-        OvsdbClient client = connection.getClient();
-        Manager manager = client.createTypedRowWrapper(Manager.class);
-        manager.setTarget(ImmutableSet.of(managerip));
-
-        OpenVSwitch openVSwitch = connection.getClient().getTypedRowWrapper(OpenVSwitch.class, null);
-        ConcurrentMap<String, Row> row = this.getRows(node, openVSwitch.getSchema().getName());
-        if (row == null || row.size() == 0) {
-            return false;
-        }
-        String ovsTableUuid = (String)row.keySet().toArray()[0];
-
-        Status status = this.insertRow(node, manager.getSchema().getName(), ovsTableUuid, manager.getRow());
-        return status.isSuccess();
-    }
-
-    @Override
-    @Deprecated
-    public Status addBridgeDomainConfig(Node node, String bridgeIdentfier,
-            Map<ConfigConstants, Object> configs) {
-        String mgmt = (String)configs.get(ConfigConstants.MGMT);
-        if (mgmt != null) {
-            if (setManager(node, mgmt)) return new Status(StatusCode.SUCCESS);
-        }
-        return new Status(StatusCode.BADREQUEST);
-    }
-
-    @Override
-    @Deprecated
-    public Status deletePort(Node node, String bridgeIdentifier, String portIdentifier) {
-        Connection connection = connectionService.getConnection(node);
-        OvsdbClient client = connection.getClient();
-
-        Port port = client.getTypedRowWrapper(Port.class, null);
-        ConcurrentMap<String, Row> rows = this.getRows(node, port.getSchema().getName());
-        if (rows == null || rows.size() == 0) {
-            return new Status(StatusCode.NOTFOUND);
-        }
-        for (String portUuid : rows.keySet()) {
-            Row portRow = rows.get(portUuid);
-            port = client.getTypedRowWrapper(Port.class, portRow);
-            if (port.getName().equals(portIdentifier)) break;
-        }
-        if (port.getName() == null || !port.getName().equals(portIdentifier)) {
-            return new Status(StatusCode.NOTFOUND);
-        }
-        return this.deleteRow(node, port.getSchema().getName(), port.getUuid().toString());
-    }
-
-    @Override
-    @Deprecated
-    public Status deleteBridgeDomain(Node node, String bridgeIdentifier) {
-        Connection connection = connectionService.getConnection(node);
-        OvsdbClient client = connection.getClient();
-
-        Bridge bridge = client.getTypedRowWrapper(Bridge.class, null);
-        ConcurrentMap<String, Row> rows = this.getRows(node, bridge.getSchema().getName());
-        if (rows == null || rows.size() == 0) {
-            return new Status(StatusCode.NOTFOUND);
-        }
-        for (String bridgeUuid : rows.keySet()) {
-            Row bridgeRow = rows.get(bridgeUuid);
-            bridge = client.getTypedRowWrapper(Bridge.class, bridgeRow);
-            if (bridge.getName().equals(bridgeIdentifier)) break;
-        }
-        if (bridge.getName() == null || !bridge.getName().equals(bridgeIdentifier)) {
-            return new Status(StatusCode.NOTFOUND);
-        }
-        return this.deleteRow(node, bridge.getSchema().getName(), bridge.getUuid().toString());
-    }
-
-    @Override
-    public List<String> getBridgeDomains(Node node) {
-        if (connectionService == null) {
-            logger.error("Couldn't refer to the ConnectionService");
-            return null;
-        }
-
-        Connection connection = connectionService.getConnection(node);
-        Bridge bridge = connection.getClient().getTypedRowWrapper(Bridge.class, null);
-        List<String> brlist = new ArrayList<String>();
-        Map<String, Row> brTableCache = ovsdbInventoryService.getTableCache(node, OvsVswitchdSchemaConstants.DATABASE_NAME, bridge.getSchema().getName());
-        if(brTableCache != null){
-            for (String uuid : brTableCache.keySet()) {
-                bridge = connection.getClient().getTypedRowWrapper(Bridge.class, brTableCache.get(uuid));
-                brlist.add(bridge.getName());
-            }
-        }
-        return brlist;
-    }
-
-    @Override
-    public NodeConnector getNodeConnector(Node arg0, String arg1, String arg2) {
-        return null;
-    }
-
-    @Override
-    @Deprecated
-    public Status addPortConfig(Node node, String bridgeIdentifier, String portIdentifier,
-            Map<ConfigConstants, Object> configs) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    @Deprecated
-    public Node getBridgeDomainNode(Node node, String bridgeIdentifier) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    @Deprecated
-    public Map<ConfigConstants, Object> getPortConfigs(Node node, String bridgeIdentifier,
-            String portIdentifier) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    @Deprecated
-    public Status removeBridgeDomainConfig(Node node, String bridgeIdentifier,
-            Map<ConfigConstants, Object> configs) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    @Deprecated
-    public Status removePortConfig(Node node, String bridgeIdentifier, String portIdentifier,
-            Map<ConfigConstants, Object> configs) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    @Deprecated
-    public Map<ConfigConstants, Object> getBridgeDomainConfigs(Node node, String bridgeIdentifier) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-
     // SCHEMA-INDEPENDENT Configuration Service APIs
 
     private String getTableNameForRowUuid(Node node, String databaseName, UUID rowUuid) {
index e871f3eafe09c2765e9ac9568ab125c53fa76413..4121c5a6a7f4f7f164eb4afa6861bcee6cb5a2e0 100644 (file)
@@ -20,7 +20,6 @@ import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.core.NodeConnector;
 import org.opendaylight.controller.sal.inventory.IPluginInInventoryService;
 import org.opendaylight.controller.sal.inventory.IPluginOutInventoryService;
-import org.opendaylight.controller.sal.networkconfig.bridgedomain.IPluginInBridgeDomainConfigService;
 import org.opendaylight.controller.sal.utils.GlobalConstants;
 import org.opendaylight.controller.sal.utils.INodeConnectorFactory;
 import org.opendaylight.controller.sal.utils.INodeFactory;
@@ -84,8 +83,7 @@ public class Activator extends ComponentActivatorAbstractBase {
             // Set the protocolPluginType property which will be used
             // by SAL
             props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), "OVS");
-            c.setInterface(new String[] { IPluginInBridgeDomainConfigService.class.getName(),
-                                          OvsdbConfigurationService.class.getName()}, props);
+            c.setInterface(new String[] { OvsdbConfigurationService.class.getName()}, props);
 
             c.add(createServiceDependency()
                     .setService(OvsdbConnectionService.class)