Merge "Fix namespaces for dpdk yang files"
authorFlavio Fernandes <ffernand@redhat.com>
Mon, 9 Feb 2015 17:20:24 +0000 (17:20 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 9 Feb 2015 17:20:24 +0000 (17:20 +0000)
integrationtest/src/test/java/org/opendaylight/ovsdb/integrationtest/neutron/NeutronIT.java
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/api/Constants.java
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/BridgeConfigurationManagerImpl.java
openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/ConfigurationServiceImpl.java
plugin/pom.xml
plugin/src/main/java/org/opendaylight/ovsdb/plugin/impl/ConfigurationServiceImpl.java
plugin/src/main/java/org/opendaylight/ovsdb/plugin/internal/Activator.java

index f0e10acf41487f0b6a8aabd9e37fc980b859faae..e5edde5fc501e4e77335cf0222cd133b72c18b3f 100644 (file)
@@ -42,7 +42,6 @@ import org.apache.felix.dm.DependencyManager;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.Configuration;
@@ -218,23 +217,13 @@ public class NeutronIT extends OvsdbIntegrationTestBase {
         Assert.assertNotEquals(ovsRow.getVersion(), originalVersion);
     }
 
-    // Note: The openFlow version is now determined by configuration's getProperty("ovsdb.of.version", "1.3").
-    // Thus, the ovs version attribute (returned by ovs' OpenVSwitch table) is not used to determine what is
-    // the openFlow version chosen by netVirtConfigurationService.
-    // See: https://git.opendaylight.org/gerrit/#/c/11084/
-    //      https://github.com/opendaylight/ovsdb/commit/2bc58c9cca16dc3e389cdfc18593578748fd52d5
-    @Ignore("netVirtConfigurationService.getOpenflowVersion(node) is not dependent on Constants.OPENFLOW13_SUPPORTED")
     @Test
     public void testGetOpenflowVersion() throws Exception {
         Thread.sleep(5000);
 
         Version ovsVersion = this.getOvsVersion();
-
-        if (ovsVersion.compareTo(Constants.OPENFLOW13_SUPPORTED) < 0) {
-            Assert.assertEquals(Constants.OPENFLOW10, netVirtConfigurationService.getOpenflowVersion(node));
-        } else {
-            Assert.assertEquals(Constants.OPENFLOW13, netVirtConfigurationService.getOpenflowVersion(node));
-        }
+        Assert.assertTrue(ovsVersion.compareTo(Constants.OPENFLOW13_SUPPORTED) >= 0);
+        Assert.assertEquals(Constants.OPENFLOW13, netVirtConfigurationService.getOpenflowVersion(node));
     }
 
     @Test
index acf7a9b496ea226320dd2d6a5aaf354b57171845..a38162ff5256cf6ab9b88c1db4fe4dd218325857 100644 (file)
@@ -44,7 +44,6 @@ public final class Constants {
     /*
      * OpenFlow Versions
      */
-    public static final String OPENFLOW10 = "OpenFlow10";
     public static final String OPENFLOW13 = "OpenFlow13";
     public static final Version OPENFLOW13_SUPPORTED = Version.fromString("1.10.0");
 
index adadf0cfde33b3b583ba56d48f2d5129545e50e2..e33895714acbbe761a664f2862e2590cf25d2c19 100644 (file)
@@ -651,11 +651,7 @@ public class BridgeConfigurationManagerImpl implements BridgeConfigurationManage
          */
 
         try {
-            if (!networkingProviderManager.getProvider(node).hasPerTenantTunneling()) {
-                protocols.add(Constants.OPENFLOW13);
-            } else {
-                protocols.add(Constants.OPENFLOW10);
-            }
+           protocols.add(Constants.OPENFLOW13);
             bridge.setProtocols(protocols);
         } catch (SchemaVersionMismatchException e) {
             logger.info(e.toString());
index 97f2e5fd0466c869aab5f0cf7c7e8ac931d40367..83611d912a2f5927e115e121825273063b36d7dc 100644 (file)
@@ -11,13 +11,11 @@ package org.opendaylight.ovsdb.openstack.netvirt.impl;
 
 import java.net.InetAddress;
 import java.util.Map;
-import java.util.Set;
 
 import org.apache.commons.lang3.tuple.ImmutablePair;
 import org.apache.commons.lang3.tuple.Pair;
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.ovsdb.lib.notation.Row;
-import org.opendaylight.ovsdb.lib.notation.Version;
 import org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService;
 import org.opendaylight.ovsdb.openstack.netvirt.api.Constants;
 import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
@@ -173,42 +171,6 @@ public class ConfigurationServiceImpl implements ConfigurationService {
 
     @Override
     public String getOpenflowVersion(Node node) {
-
-        String configuredVersion = ConfigProperties.getProperty(this.getClass(), "ovsdb.of.version", "1.3");
-        if (configuredVersion != null){
-            switch (configuredVersion){
-                case "1.0":
-                    return Constants.OPENFLOW10;
-                case "1.3":
-                    //fall through
-                default:
-                    return Constants.OPENFLOW13;
-
-            }
-        }
-
-        Map<String, Row> ovsRows = ovsdbConfigurationService.getRows(node,
-                ovsdbConfigurationService.getTableName(node, OpenVSwitch.class));
-
-        if (ovsRows == null) {
-            logger.info("The OVS node {} has no Open_vSwitch rows", node.toString());
-            return null;
-        }
-
-        Version ovsVersion = null;
-        // While there is only one entry in the HashMap, we can't access it by index...
-        for (Row row : ovsRows.values()) {
-            OpenVSwitch ovsRow = ovsdbConfigurationService.getTypedRow(node, OpenVSwitch.class, row);
-            Set<String> versionSet = ovsRow.getOvsVersionColumn().getData();
-            if (versionSet != null && versionSet.iterator().hasNext()) {
-                ovsVersion = Version.fromString(versionSet.iterator().next());
-            }
-        }
-
-        if (ovsVersion == null || ovsVersion.compareTo(Constants.OPENFLOW13_SUPPORTED) < 0) {
-            return Constants.OPENFLOW10;
-        }
-
         return Constants.OPENFLOW13;
     }
 
index 0ccdf2f91d498507529ac6bbaefb4816a881873b..86b15e713956704b2ae64102c0c54d16c1aeeb94 100755 (executable)
         <extensions>true</extensions>
         <configuration>
           <instructions>
-            <Import-Package>
-              org.opendaylight.controller.sal.packet,
-              org.opendaylight.controller.sal.action,
-              org.opendaylight.controller.sal.discovery,
-              org.opendaylight.controller.sal.topology,
-              org.opendaylight.controller.sal.core,
-              org.opendaylight.controller.sal.flowprogrammer,
-              org.opendaylight.controller.sal.reader,
-              org.opendaylight.controller.sal.inventory,
-              org.opendaylight.controller.sal.match,
-              org.opendaylight.controller.sal.utils,
-              org.opendaylight.ovsdb.lib.error,
-              org.opendaylight.ovsdb.lib.notation,
-              org.opendaylight.ovsdb.lib.operations,
-              org.opendaylight.ovsdb.lib.message,
-              org.opendaylight.ovsdb.schema.openvswitch,
-              org.apache.commons.lang3.builder,
-              org.apache.commons.lang3.tuple,
-              org.apache.felix.dm,
-              org.slf4j,
-              org.eclipse.osgi.framework.console,
-              org.osgi.framework,
-              javax.net.ssl,
-              *
-            </Import-Package>
             <Embed-Dependency>commons-codec,javax.servlet-api,portlet-api,commons-collections,utils.config;type=!pom;inline=false</Embed-Dependency>
             <Embed-Transitive>true</Embed-Transitive>
             <Bundle-Activator>org.opendaylight.ovsdb.plugin.internal.Activator</Bundle-Activator>
index 8562eb5fbf94b11cd2430f4121b65ebf82bd076b..d284eb6854d399df51378095d17966b21ca17ae0 100644 (file)
@@ -22,7 +22,6 @@ import java.util.Set;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.ExecutionException;
 
-import org.eclipse.osgi.framework.console.CommandProvider;
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.utils.Status;
 import org.opendaylight.controller.sal.utils.StatusCode;
@@ -57,8 +56,6 @@ import org.opendaylight.ovsdb.schema.openvswitch.OpenVSwitch;
 import org.opendaylight.ovsdb.schema.openvswitch.Port;
 import org.opendaylight.ovsdb.utils.config.ConfigProperties;
 
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.FrameworkUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -94,14 +91,6 @@ public class ConfigurationServiceImpl implements OvsdbConfigurationService
      *
      */
     void start() {
-        registerWithOSGIConsole();
-    }
-
-    private void registerWithOSGIConsole() {
-        BundleContext bundleContext = FrameworkUtil.getBundle(this.getClass())
-                .getBundleContext();
-        bundleContext.registerService(CommandProvider.class.getName(), this,
-                null);
     }
 
     /**
index ab85910ae2fd07c25f2d74851b81244f585a3800..c0ac4ca5363c29f1acf269cba4e86884eba1fd78 100644 (file)
@@ -12,8 +12,8 @@ package org.opendaylight.ovsdb.plugin.internal;
 import java.util.Dictionary;
 import java.util.Hashtable;
 
-import org.apache.felix.dm.Component;
-import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
+import org.apache.felix.dm.DependencyActivatorBase;
+import org.apache.felix.dm.DependencyManager;
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.core.NodeConnector;
 import org.opendaylight.controller.sal.inventory.IPluginInInventoryService;
@@ -33,6 +33,7 @@ import org.opendaylight.ovsdb.plugin.impl.InventoryServiceImpl;
 import org.opendaylight.ovsdb.plugin.impl.NodeConnectorFactory;
 import org.opendaylight.ovsdb.plugin.impl.NodeFactory;
 
+import org.osgi.framework.BundleContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -41,111 +42,83 @@ import org.slf4j.LoggerFactory;
  *
  *
  */
-public class Activator extends ComponentActivatorAbstractBase {
+public class Activator extends DependencyActivatorBase {
     protected static final Logger logger = LoggerFactory
             .getLogger(Activator.class);
 
-    /**
-     * Function called when the activator starts just after some initializations
-     * are done by the ComponentActivatorAbstractBase.
-     * Here it registers the node Type
-     *
-     */
     @Override
-    public void init() {
+    public void init(BundleContext context, DependencyManager manager) throws Exception {
         Node.NodeIDType.registerIDType("OVS", String.class);
         NodeConnector.NodeConnectorIDType.registerIDType("OVS", String.class, "OVS");
-    }
-
-    /**
-     * Function called when the activator stops just before the cleanup done by
-     * ComponentActivatorAbstractBase
-     *
-     */
-    @Override
-    public void destroy() {
-        Node.NodeIDType.unRegisterIDType("OVS");
-        NodeConnector.NodeConnectorIDType.unRegisterIDType("OVS");
-    }
-    @Override
-    public Object[] getGlobalImplementations() {
-        Object[] res = { ConnectionServiceImpl.class, ConfigurationServiceImpl.class, NodeFactory.class, NodeConnectorFactory.class, InventoryServiceImpl.class };
-        return res;
-    }
 
-    @Override
-    public void configureGlobalInstance(Component c, Object imp){
-        if (imp.equals(ConfigurationServiceImpl.class)) {
-            // export the service to be used by SAL
-            Dictionary<String, Object> props = new Hashtable<String, Object>();
-            // Set the protocolPluginType property which will be used
-            // by SAL
-            props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), "OVS");
-            c.setInterface(new String[] { OvsdbConfigurationService.class.getName()}, props);
+        Dictionary<String, Object> props = new Hashtable<String, Object>();
+        props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), "OVS");
 
-            c.add(createServiceDependency()
-                    .setService(OvsdbConnectionService.class)
-                    .setRequired(true));
-            c.add(createServiceDependency()
-                    .setService(OvsdbInventoryService.class)
-                    .setRequired(true));
-        }
+        manager.add(createComponent()
+                        .setInterface(OvsdbConfigurationService.class.getName(), props)
+                        .setImplementation(ConfigurationServiceImpl.class)
+                        .add(createServiceDependency()
+                                        .setService(OvsdbConnectionService.class)
+                                        .setRequired(true))
+                        .add(createServiceDependency()
+                                .setService(OvsdbInventoryService.class)
+                                .setRequired(true)));
 
-        if (imp.equals(ConnectionServiceImpl.class)) {
-            // export the service to be used by SAL
-            Dictionary<String, Object> props = new Hashtable<String, Object>();
-            // Set the protocolPluginType property which will be used
-            // by SAL
-            props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), "OVS");
-            c.setInterface(
-                    new String[] {OvsdbConnectionService.class.getName(),
-                                  OvsdbConnectionListener.class.getName()}, props);
-            c.add(createServiceDependency()
-                    .setService(OvsdbInventoryService.class)
-                    .setRequired(true));
-            c.add(createServiceDependency()
-                    .setService(OvsdbConnection.class)
-                    .setRequired(true));
-        }
+        Dictionary<String, Object> props2 = new Hashtable<String, Object>();
+        props2.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), "OVS");
+        manager.add(createComponent()
+                        .setInterface(
+                                new String[] {OvsdbConnectionService.class.getName(),
+                                        OvsdbConnectionListener.class.getName()}, props2)
+                        .setImplementation(ConnectionServiceImpl.class)
+                        .add(createServiceDependency()
+                                .setService(OvsdbInventoryService.class)
+                                .setRequired(true))
+                        .add(createServiceDependency()
+                                .setService(OvsdbConnection.class)
+                                .setRequired(true))
+        );
 
-        if (imp.equals(InventoryServiceImpl.class)) {
-            Dictionary<String, Object> props = new Hashtable<>();
-            props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), "OVS");
-            props.put("scope", "Global");
-            c.setInterface(
-                    new String[]{IPluginInInventoryService.class.getName(),
-                                 OvsdbInventoryService.class.getName()}, props);
-            c.add(createServiceDependency()
-                          .setService(IPluginOutInventoryService.class, "(scope=Global)")
-                          .setCallbacks("setPluginOutInventoryServices",
+        Dictionary<String, Object> props3 = new Hashtable<>();
+        props3.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), "OVS");
+        props3.put("scope", "Global");
+        manager.add(createComponent()
+                        .setInterface(
+                                new String[]{IPluginInInventoryService.class.getName(),
+                                        OvsdbInventoryService.class.getName()}, props3)
+                        .setImplementation(InventoryServiceImpl.class)
+                        .add(createServiceDependency()
+                                .setService(IPluginOutInventoryService.class, "(scope=Global)")
+                                .setCallbacks("setPluginOutInventoryServices",
                                         "unsetPluginOutInventoryServices")
-                          .setRequired(true));
-            c.add(createServiceDependency()
-                    .setService(OvsdbInventoryListener.class)
-                    .setCallbacks("listenerAdded", "listenerRemoved"));
-            c.add(createServiceDependency()
-                    .setService(OvsdbConfigurationService.class)
-                    .setRequired(false));
-        }
+                                .setRequired(true))
+                        .add(createServiceDependency()
+                                .setService(OvsdbInventoryListener.class)
+                                .setCallbacks("listenerAdded", "listenerRemoved"))
+                        .add(createServiceDependency()
+                                .setService(OvsdbConfigurationService.class)
+                                .setRequired(false)));
+
+        Dictionary<String, Object> props4 = new Hashtable<String, Object>();
+        props4.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), "OVS");
+        props4.put("protocolName", "OVS");
+
+        manager.add(createComponent()
+                .setInterface(INodeFactory.class.getName(), props4)
+                .setImplementation(NodeFactory.class));
+
+        Dictionary<String, Object> props5 = new Hashtable<String, Object>();
+        props5.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), "OVS");
+        props5.put("protocolName", "OVS");
 
-        if (imp.equals(NodeFactory.class)) {
-            // export the service to be used by SAL
-            Dictionary<String, Object> props = new Hashtable<String, Object>();
-            // Set the protocolPluginType property which will be used
-            // by SAL
-            props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), "OVS");
-            props.put("protocolName", "OVS");
-            c.setInterface(INodeFactory.class.getName(), props);
-        }
-        if (imp.equals(NodeConnectorFactory.class)) {
-            // export the service to be used by SAL
-            Dictionary<String, Object> props = new Hashtable<String, Object>();
-            // Set the protocolPluginType property which will be used
-            // by SAL
-            props.put(GlobalConstants.PROTOCOLPLUGINTYPE.toString(), "OVS");
-            props.put("protocolName", "OVS");
-            c.setInterface(INodeConnectorFactory.class.getName(), props);
-        }
+        manager.add(createComponent()
+                .setInterface(INodeConnectorFactory.class.getName(), props5)
+                .setImplementation(NodeConnectorFactory.class));
+    }
 
+    @Override
+    public void destroy(BundleContext context, DependencyManager manager) throws Exception {
+        Node.NodeIDType.unRegisterIDType("OVS");
+        NodeConnector.NodeConnectorIDType.unRegisterIDType("OVS");
     }
 }