Merge "Bug 5953: Fixed NPE in FlowRemovedTranslator."
authorJozef Bacigal <jbacigal@cisco.com>
Tue, 7 Jun 2016 07:28:23 +0000 (07:28 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 7 Jun 2016 07:28:23 +0000 (07:28 +0000)
110 files changed:
.gitignore
applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/util/ReconcileUtilTest.java
applications/inventory-manager/src/main/config/default-config.xml
applications/inventory-manager/src/main/java/org/opendaylight/openflowplugin/applications/inventory/manager/InventoryActivator.java
applications/inventory-manager/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/inventory/manager/impl/rev150530/InventoryManagerImplModule.java
applications/inventory-manager/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/inventory/manager/impl/rev150530/InventoryManagerImplModuleFactory.java
applications/inventory-manager/src/main/yang/inventory-manager-impl.yang
applications/statistics-manager-config/src/main/resources/initial/30-statistics-manager.xml
applications/statistics-manager/pom.xml
applications/statistics-manager/src/main/java/org/opendaylight/openflowplugin/applications/config/yang/statistics_manager/StatisticsManagerModule.java
applications/statistics-manager/src/main/java/org/opendaylight/openflowplugin/applications/config/yang/statistics_manager/StatisticsManagerModuleFactory.java
applications/statistics-manager/src/main/java/org/opendaylight/openflowplugin/applications/statistics/manager/StatisticsManagerFactory.java [new file with mode: 0644]
applications/statistics-manager/src/main/java/org/opendaylight/openflowplugin/applications/statistics/manager/impl/StatNodeRegistrationImpl.java
applications/statistics-manager/src/main/java/org/opendaylight/openflowplugin/applications/statistics/manager/impl/StatisticsManagerFactoryImpl.java [new file with mode: 0644]
applications/statistics-manager/src/main/resources/org/opendaylight/blueprint/statistics-manager.xml [new file with mode: 0644]
applications/statistics-manager/src/main/yang/statistics-manager-app-config.yang [new file with mode: 0644]
applications/statistics-manager/src/main/yang/statistics-manager.yang
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/IpConverter.java
extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/IpConverterTest.java [new file with mode: 0644]
extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/MatchUtilTest.java [moved from extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/MatchUtilTest.java with 98% similarity]
features-li/pom.xml
features-li/src/main/features/features.xml
features/pom.xml
features/src/main/features/features.xml
openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/OpenFlowPluginProviderFactory.java [new file with mode: 0644]
openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/DeviceManager.java
openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/DeviceState.java
openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/lifecycle/DeviceContextChangeListener.java
openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/AbstractModelDrivenSwitchRegistration.java [new file with mode: 0644]
openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/ModelDrivenSwitch.java
openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/ModelDrivenSwitchRegistration.java [new file with mode: 0644]
openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/core/session/SessionContext.java
openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/role/RoleManager.java
openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/rpc/RpcManager.java
openflowplugin-api/src/main/yang/openflow-provider-config.yang [new file with mode: 0644]
openflowplugin-api/src/main/yang/openflow-provider.yang
openflowplugin-blueprint-config-he/pom.xml [new file with mode: 0644]
openflowplugin-blueprint-config-he/src/main/resources/org/opendaylight/blueprint/openflowplugin-helium.xml [new file with mode: 0644]
openflowplugin-blueprint-config/pom.xml [new file with mode: 0644]
openflowplugin-blueprint-config/src/main/resources/org/opendaylight/blueprint/openflowplugin.xml [new file with mode: 0644]
openflowplugin-controller-config/src/main/resources/initial/42-openflowplugin-new.xml
openflowplugin-controller-config/src/main/resources/initial/42-openflowplugin.xml
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/LifecycleConductorImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/OpenFlowPluginProviderFactoryImpl.java [new file with mode: 0644]
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/DeviceContextImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/DeviceStateImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/role/RoleContextImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/rpc/RpcContextImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/rpc/RpcManagerImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/RoleService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/SalGroupServiceImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/SalMeterServiceImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/SalRoleServiceImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/SinglePurposeMultipartReplyTranslator.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/translator/AggregatedFlowStatisticsTranslator.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/translator/FlowRemovedTranslator.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/translator/FlowRemovedV10Translator.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/translator/PacketReceivedTranslator.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/translator/PortUpdateTranslator.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/DeviceInitializationUtils.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/NodeConnectorRefToPortTranslator.java
openflowplugin-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/config/openflow/plugin/impl/rev150327/OpenFlowProviderModule.java
openflowplugin-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/config/openflow/plugin/impl/rev150327/OpenFlowProviderModuleFactory.java
openflowplugin-impl/src/main/resources/org/opendaylight/blueprint/commands.xml [moved from openflowplugin-impl/src/main/resources/OSGI-INF/blueprint/commands.xml with 100% similarity]
openflowplugin-impl/src/main/resources/org/opendaylight/blueprint/openflowplugin-impl.xml [new file with mode: 0644]
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/LifecycleConductorImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/OpenFlowPluginProviderImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/DeviceManagerImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/DeviceStateImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/TransactionChainManagerTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/rpc/RpcContextImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/rpc/RpcManagerImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/AbstractRequestCallbackTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/SalGroupServiceImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/SalMeterServiceImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/services/ServiceMocking.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/SinglePurposeMultipartReplyTranslatorTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImplParamTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsManagerImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/ofpspecific/MessageIntelligenceAgencyImplTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/translator/AggregatedFlowStatisticsTranslatorTest.java
openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/util/NodeConnectorRefToPortTranslatorTest.java
openflowplugin/.gitignore [deleted file]
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/role/OfEntityManager.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/AbstractModelDrivenSwitch.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/OpenflowPluginConfig.java [new file with mode: 0644]
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/OpenflowPluginProvider.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/SalRegistrationManager.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/session/SessionContextOFImpl.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/util/InventoryDataServiceUtil.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/util/RoleUtil.java
openflowplugin/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/openflow/common/config/impl/rev140326/ConfigurableOpenFlowProviderModule.java
openflowplugin/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/openflow/common/config/impl/rev140326/ConfigurableOpenFlowProviderModuleFactory.java
openflowplugin/src/main/yang/openflow-plugin-cfg-impl.yang
openflowplugin/src/main/yang/openflow-plugin-cfg.yang
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/ModelDrivenSwitchImplTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/SalRegistrationManagerTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/FlowConvertorTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/session/MessageDispatchServiceImplTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/session/OFRoleManagerTest.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/util/OpenflowPortsUtilTest.java
parent/pom.xml
pom.xml
test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginGroupTestCommandProvider.java
test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginGroupTestServiceProvider.java
test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginMeterTestServiceProvider.java
test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginStatsTestCommandProvider.java
test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTableFeaturesTestServiceProvider.java
test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestServiceProvider.java
test-scripts/.gitignore [deleted file]

index df9979ce4a3be3936d28993761b2f5a23f4765cc..1b78296903f38bf0b5cc8c6cf93b2e88a3335f33 100644 (file)
@@ -1,24 +1,29 @@
-.idea/\r
-target/\r
-*.class\r
-*.iml\r
-**/target\r
-**/bin\r
-dist\r
-**/logs\r
-products\r
-repository\r
-workspace\r
-*~\r
-target\r
-.classpath\r
-.project\r
-.settings\r
-MANIFEST.MF\r
-xtend-gen\r
+.idea/
+target/
+*.class
+*.iml
+**/target
+**/bin
+dist
+**/logs
+products
+repository
+workspace
+*~
+target
+.classpath
+.project
+.settings
+MANIFEST.MF
+xtend-gen
 yang-gen-sal
 yang-gen-config
-.externalToolBuilders\r
-maven-eclipse.xml\r
+.externalToolBuilders
+maven-eclipse.xml
 .metadata/
 .checkstyle
+maven-metadata-local.xml
+*.pyc
+/.pydevproject
+*.log
+.tox/
index b5d68931b916609f0763fd1d82452d87e0536181..75aa3b23bcd36e0f8dbe863aeff8bbbf99e5336c 100644 (file)
@@ -8,6 +8,7 @@
 
 package org.opendaylight.openflowplugin.applications.frsync.util;
 
+import com.google.common.base.Splitter;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.SettableFuture;
@@ -63,6 +64,7 @@ public class ReconcileUtilTest {
     private static final NodeId NODE_ID = new NodeId("unit-node-id");
     private InstanceIdentifier<Node> NODE_IDENT = InstanceIdentifier.create(Nodes.class)
             .child(Node.class, new NodeKey(NODE_ID));
+    private static final Splitter COMMA_SPLITTER = Splitter.on(",");
 
     @Rule
     public ExpectedException thrown = ExpectedException.none();
@@ -328,8 +330,8 @@ public class ReconcileUtilTest {
 
     private ItemSyncBox<String> createSyncBox(final String pushes, final String updates) {
         ItemSyncBox<String> syncBox1 = new ItemSyncBox<>();
-        syncBox1.getItemsToPush().addAll(Arrays.asList(pushes.split(",")));
-        for (String orig : updates.split(",")) {
+        syncBox1.getItemsToPush().addAll(COMMA_SPLITTER.splitToList(pushes));
+        for (String orig : COMMA_SPLITTER.splitToList(updates)) {
             syncBox1.getItemsToUpdate().add(new ItemSyncBox.ItemUpdateTuple<>(orig, orig + "_updated"));
         }
         return syncBox1;
index cfb992a206926e3471dffad31f20dac2066d56a2..8fa1cc456d9310b65bc1b8cbddb709f082f9f336 100644 (file)
@@ -6,6 +6,9 @@ Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
 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
+
+NOTE: This file is deprecated as wiring is now done via blueprint. This file is kept for
+       backwards compatibility. Runtime modifications are not honored.
 -->
 <snapshot>
   <required-capabilities>
index 3610157774a360893d7bca9c26fd4db3ab9711f6..1ed9397e54bd43a33304b64a0b7c3be40a0fa9ff 100644 (file)
@@ -9,41 +9,30 @@ package org.opendaylight.openflowplugin.applications.inventory.manager;
 
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
-import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class InventoryActivator implements BindingAwareProvider, AutoCloseable {
+public class InventoryActivator implements AutoCloseable {
     private static final Logger LOG = LoggerFactory.getLogger(InventoryActivator.class);
-    private FlowCapableInventoryProvider provider;
-    final private EntityOwnershipService eos;
-
-    public InventoryActivator(EntityOwnershipService eos) {
-        this.eos = eos;
-    }
 
+    private final FlowCapableInventoryProvider provider;
 
-    @Override
-    public void onSessionInitiated(final ProviderContext session) {
-        DataBroker dataBroker = session.getSALService(DataBroker.class);
-        NotificationProviderService salNotifiService =
-                session.getSALService(NotificationProviderService.class);
+    public InventoryActivator(DataBroker dataBroker, NotificationProviderService notificationService,
+            EntityOwnershipService eos) {
+        provider = new FlowCapableInventoryProvider(dataBroker, notificationService, eos);
+    }
 
-        provider = new FlowCapableInventoryProvider(dataBroker, salNotifiService, eos);
+    public void start() {
         provider.start();
     }
 
     @Override
-    public void close() throws Exception {
-        if (provider != null) {
-            try {
-                provider.close();
-            } catch (InterruptedException e) {
-                LOG.warn("Interrupted while waiting for shutdown", e);
-            }
-            provider = null;
+    public void close() {
+        try {
+            provider.close();
+        } catch (InterruptedException e) {
+            LOG.warn("Interrupted while waiting for shutdown", e);
         }
     }
 }
index 673aa2515861d55cebbe1aa02f6208822f10e287..60bf1fbcac8c15d30019eaf24297c26162947d41 100644 (file)
@@ -1,8 +1,12 @@
 package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.inventory.manager.impl.rev150530;
 
-import org.opendaylight.openflowplugin.applications.inventory.manager.InventoryActivator;
+import org.opendaylight.controller.sal.common.util.NoopAutoCloseable;
 
-public class InventoryManagerImplModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.inventory.manager.impl.rev150530.AbstractInventoryManagerImplModule {
+/**
+ * @deprecated Replaced by blueprint wiring
+ */
+@Deprecated
+public class InventoryManagerImplModule extends AbstractInventoryManagerImplModule {
     public InventoryManagerImplModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
         super(identifier, dependencyResolver);
     }
@@ -12,15 +16,8 @@ public class InventoryManagerImplModule extends org.opendaylight.yang.gen.v1.urn
     }
 
     @Override
-    public void customValidation() {
-        // add custom validation form module attributes here.
+    public AutoCloseable createInstance() {
+        // InventoryActivator instance is created via blueprint so this in a no-op.
+        return NoopAutoCloseable.INSTANCE;
     }
-
-    @Override
-    public java.lang.AutoCloseable createInstance() {
-        InventoryActivator provider = new InventoryActivator(getEntityOwnershipServiceDependency());
-        getBrokerDependency().registerProvider(provider);
-        return provider;
-    }
-
 }
index 49369d4a87a87aec800ce80deee05f312bfe382c..b8fe5bc13a3d6b7c6e68a600accdf97b883d10aa 100644 (file)
@@ -8,6 +8,11 @@
 * Do not modify this file unless it is present under src/main directory
 */
 package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.inventory.manager.impl.rev150530;
-public class InventoryManagerImplModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.inventory.manager.impl.rev150530.AbstractInventoryManagerImplModuleFactory {
+
+/**
+ * @deprecated Replaced by blueprint wiring
+ */
+@Deprecated
+public class InventoryManagerImplModuleFactory extends AbstractInventoryManagerImplModuleFactory {
 
 }
index f3483ecd8c58c2670a10171fcb45328bcb81cba7..d68891584bf6d5edfc3591b5e0303cbeb4d79e0f 100644 (file)
@@ -18,6 +18,7 @@ module inventory-manager-impl {
     identity inventory-manager-impl {
         base config:module-type;
         config:java-name-prefix InventoryManagerImpl;
+        status deprecated;
     }
 
     augment "/config:modules/config:module/config:configuration" {
index 9962070ccc5c020be374678f94979add2471a36f..5103b5bf6889763320fe6fb036fc039e864e5b54 100644 (file)
@@ -6,6 +6,10 @@
  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
+
+ NOTE: This file is deprecated as wiring is now done via blueprint. This file is kept for
+       backwards compatibility. Runtime modifications are not honored.
+
 -->
 <snapshot>
     <configuration>
index a87ea4f1055dffd97d55a228c4f09e9519cb4d07..5eb232f41d1516e8926a033f09a95ef83860e641 100644 (file)
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal-binding-config</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>sal-common-util</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.opendaylight.openflowplugin.model</groupId>
       <artifactId>model-flow-base</artifactId>
index 93fecc35b539249f7f0ce36f098bb0a676a7539c..31bedd8ae20e42e36256798d771d89ba990d8999 100644 (file)
@@ -8,19 +8,13 @@
 
 package org.opendaylight.openflowplugin.applications.config.yang.statistics_manager;
 
-import org.opendaylight.openflowplugin.applications.statistics.manager.StatisticsManager;
-import org.opendaylight.openflowplugin.applications.statistics.manager.impl.StatisticsManagerConfig;
-import org.opendaylight.openflowplugin.applications.statistics.manager.impl.StatisticsManagerImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class StatisticsManagerModule extends org.opendaylight.openflowplugin.applications.config.yang.statistics_manager.AbstractStatisticsManagerModule {
-
-    private static final Logger LOG = LoggerFactory.getLogger(StatisticsManagerModule.class);
-
-    private static final int MAX_NODES_FOR_COLLECTOR_DEFAULT = 16;
-    private static final int MIN_REQUEST_NET_MONITOR_INTERVAL_DEFAULT = 3000;
+import org.opendaylight.controller.sal.common.util.NoopAutoCloseable;
 
+/**
+ * @deprecated Replaced by blueprint wiring
+ */
+@Deprecated
+public class StatisticsManagerModule extends AbstractStatisticsManagerModule {
     public StatisticsManagerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
         super(identifier, dependencyResolver);
     }
@@ -30,51 +24,8 @@ public class StatisticsManagerModule extends org.opendaylight.openflowplugin.app
     }
 
     @Override
-    public void customValidation() {
-        // add custom validation form module attributes here.
-    }
-
-    @Override
-    public java.lang.AutoCloseable createInstance() {
-        LOG.info("StatisticsManager module initialization.");
-        final StatisticsManagerConfig config = createConfig();
-        final StatisticsManager statisticsManagerProvider = new StatisticsManagerImpl(getDataBrokerDependency(), config);
-        statisticsManagerProvider.setOwnershipService(getOwnershipServiceDependency());
-        statisticsManagerProvider.start(getNotificationServiceDependency(), getRpcRegistryDependency());
-
-        final StatisticsManager statisticsManagerProviderExposed = statisticsManagerProvider;
-        LOG.info("StatisticsManager started successfully.");
-        return new AutoCloseable() {
-            @Override
-            public void close() throws Exception {
-                try {
-                    statisticsManagerProviderExposed.close();
-                }
-                catch (final Exception e) {
-                    LOG.error("Unexpected error by stopping StatisticsManager module", e);
-                }
-                LOG.info("StatisticsManager module stopped.");
-            }
-        };
-    }
-
-    private StatisticsManagerConfig createConfig() {
-        final StatisticsManagerConfig.StatisticsManagerConfigBuilder builder = StatisticsManagerConfig.builder();
-        if (getStatisticsManagerSettings() != null && getStatisticsManagerSettings().getMaxNodesForCollector() != null) {
-            builder.setMaxNodesForCollector(getStatisticsManagerSettings().getMaxNodesForCollector());
-        } else {
-            LOG.warn("Load the xml ConfigSubsystem input value fail! MaxNodesForCollector value is set to {} ",
-                    MAX_NODES_FOR_COLLECTOR_DEFAULT);
-            builder.setMaxNodesForCollector(MAX_NODES_FOR_COLLECTOR_DEFAULT);
-        }
-        if (getStatisticsManagerSettings() != null &&
-                getStatisticsManagerSettings().getMinRequestNetMonitorInterval() != null) {
-            builder.setMinRequestNetMonitorInterval(getStatisticsManagerSettings().getMinRequestNetMonitorInterval());
-        } else {
-            LOG.warn("Load the xml CofnigSubsystem input value fail! MinRequestNetMonitorInterval value is set to {} ",
-                    MIN_REQUEST_NET_MONITOR_INTERVAL_DEFAULT);
-            builder.setMinRequestNetMonitorInterval(MIN_REQUEST_NET_MONITOR_INTERVAL_DEFAULT);
-        }
-        return builder.build();
+    public AutoCloseable createInstance() {
+        // StatisticsManager instance is created via blueprint so this in a no-op.
+        return NoopAutoCloseable.INSTANCE;
     }
 }
index aad063483161b2272e39a942301ff25752ecc910..444459e9f29aec3b20b60e5898efd02747e93cd4 100644 (file)
 * Do not modify this file unless it is present under src/main directory
 */
 package org.opendaylight.openflowplugin.applications.config.yang.statistics_manager;
-public class StatisticsManagerModuleFactory extends org.opendaylight.openflowplugin.applications.config.yang.statistics_manager.AbstractStatisticsManagerModuleFactory {
+
+/**
+ * @deprecated Replaced by blueprint wiring
+ */
+@Deprecated
+public class StatisticsManagerModuleFactory extends AbstractStatisticsManagerModuleFactory {
 
 }
diff --git a/applications/statistics-manager/src/main/java/org/opendaylight/openflowplugin/applications/statistics/manager/StatisticsManagerFactory.java b/applications/statistics-manager/src/main/java/org/opendaylight/openflowplugin/applications/statistics/manager/StatisticsManagerFactory.java
new file mode 100644 (file)
index 0000000..fde568e
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2016 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ *
+ * 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
+ */
+package org.opendaylight.openflowplugin.applications.statistics.manager;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
+import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.app.statistics.manager.config.rev160509.StatisticsManagerAppConfig;
+
+/**
+ * Factory for creating StatisticsManager instances.
+ *
+ * @author Thomas Pantelis
+ */
+public interface StatisticsManagerFactory {
+    StatisticsManager newInstance(StatisticsManagerAppConfig statsManagerAppConfig, DataBroker dataBroker,
+            NotificationProviderService notifService, RpcConsumerRegistry rpcRegistry,
+            EntityOwnershipService entityOwnershipService);
+
+}
index 0b91579b5edc914988b65b7970d2e5dcf0729779..b590f3356eb90ba89feadd77f298454dc5848106 100644 (file)
@@ -245,7 +245,6 @@ public class StatNodeRegistrationImpl implements StatNodeRegistration,EntityOwne
         NodeIdentifierWithPredicates niWPredicates = (NodeIdentifierWithPredicates)yId.getLastPathArgument();
         Map<QName, Object> keyValMap = niWPredicates.getKeyValues();
         String nodeIdStr = (String)(keyValMap.get(ENTITY_NAME));
-        BigInteger dpId = new BigInteger(nodeIdStr.split(":")[1]);
         NodeId nodeId = new NodeId(nodeIdStr);
         setNodeOwnership(nodeId, ownershipChange.isOwner());
     }
diff --git a/applications/statistics-manager/src/main/java/org/opendaylight/openflowplugin/applications/statistics/manager/impl/StatisticsManagerFactoryImpl.java b/applications/statistics-manager/src/main/java/org/opendaylight/openflowplugin/applications/statistics/manager/impl/StatisticsManagerFactoryImpl.java
new file mode 100644 (file)
index 0000000..11fe70d
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2016 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ *
+ * 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
+ */
+package org.opendaylight.openflowplugin.applications.statistics.manager.impl;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
+import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
+import org.opendaylight.openflowplugin.applications.statistics.manager.StatisticsManager;
+import org.opendaylight.openflowplugin.applications.statistics.manager.StatisticsManagerFactory;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.app.statistics.manager.config.rev160509.StatisticsManagerAppConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Implementation of StatisticsManagerFactory.
+ *
+ * @author Thomas Pantelis
+ */
+public class StatisticsManagerFactoryImpl implements StatisticsManagerFactory {
+    private static final Logger LOG = LoggerFactory.getLogger(StatisticsManagerFactoryImpl.class);
+
+    @Override
+    public StatisticsManager newInstance(StatisticsManagerAppConfig statsManagerAppConfig, DataBroker dataBroker,
+            NotificationProviderService notifService, RpcConsumerRegistry rpcRegistry,
+            EntityOwnershipService entityOwnershipService) {
+        LOG.info("StatisticsManager module initialization.");
+
+        StatisticsManagerConfig.StatisticsManagerConfigBuilder configBuilder = StatisticsManagerConfig.builder();
+        configBuilder.setMaxNodesForCollector(statsManagerAppConfig.getMaxNodesForCollector());
+        configBuilder.setMinRequestNetMonitorInterval(statsManagerAppConfig.getMinRequestNetMonitorInterval());
+
+        StatisticsManager statisticsManager = new StatisticsManagerImpl(dataBroker, configBuilder.build());
+        statisticsManager.setOwnershipService(entityOwnershipService);
+        statisticsManager.start(notifService, rpcRegistry);
+
+        LOG.info("StatisticsManager started successfully.");
+
+        return statisticsManager;
+    }
+}
diff --git a/applications/statistics-manager/src/main/resources/org/opendaylight/blueprint/statistics-manager.xml b/applications/statistics-manager/src/main/resources/org/opendaylight/blueprint/statistics-manager.xml
new file mode 100644 (file)
index 0000000..3155c1f
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0">
+
+  <bean id="statsManagerFactory" class="org.opendaylight.openflowplugin.applications.statistics.manager.impl.StatisticsManagerFactoryImpl"/>
+
+  <service ref="statsManagerFactory" interface="org.opendaylight.openflowplugin.applications.statistics.manager.StatisticsManagerFactory"
+          odl:type="default"/>
+</blueprint>
\ No newline at end of file
diff --git a/applications/statistics-manager/src/main/yang/statistics-manager-app-config.yang b/applications/statistics-manager/src/main/yang/statistics-manager-app-config.yang
new file mode 100644 (file)
index 0000000..d824326
--- /dev/null
@@ -0,0 +1,25 @@
+module statistics-manager-app-config {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:openflowplugin:app:statistics-manager:config";
+    prefix "statistics-manager-app-config";
+
+    description
+        "Configuration for Statistics Manager application.";
+
+    revision "2016-05-09" {
+        description
+            "Initial revision";
+    }
+
+    container statistics-manager-app-config {
+        leaf min-request-net-monitor-interval {
+            type int32;
+            default 3000;
+        }
+
+        leaf max-nodes-for-collector {
+            type int32;
+            default 16;
+        }
+    }
+}
\ No newline at end of file
index d982d35bf652e89379df37bedfec9ef6e9605f8a..43acf0a1055ec31ccc6a32af8c635d0556437481 100644 (file)
@@ -20,6 +20,7 @@ module statistics-manager {
     identity statistics-manager {
             base config:module-type;
             config:java-name-prefix StatisticsManager;
+            status deprecated;
     }
 
     augment "/config:modules/config:module/config:configuration" {
index 2054f24bc7089cf16732e1f128d81e68d60b7e43..de26eb09c47e087ca557690dd620daa42b522922 100644 (file)
@@ -7,8 +7,13 @@
  */
 package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor;
 
+import com.google.common.base.Splitter;
+import com.google.common.collect.Lists;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
 
+import java.util.List;
+import java.util.ListIterator;
+
 /**
  * @author msunal
  *
@@ -16,11 +21,19 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 public final class IpConverter {
 
     public static long Ipv4AddressToLong(Ipv4Address ipv4Address) {
-        String ipAddress = ipv4Address.getValue();
-        long result = 0;
-        String[] atoms = ipAddress.split("\\.");
-        for (int i = 3; i >= 0; i--) {
-            result |= (Long.parseLong(atoms[3 - i]) << (i * 8));
+        long result = 0 ;
+        Iterable<String> splitted = Splitter.on('.')
+                .trimResults()
+                .omitEmptyStrings()
+                .split(ipv4Address.getValue());
+
+        List<String> splittedAddress = Lists.newArrayList(splitted.iterator());
+        int maxIndex = splittedAddress.size() - 1;
+        ListIterator<String> listIter = splittedAddress.listIterator();
+        while(listIter.hasNext()) {
+            String current = listIter.next();
+            int i = splittedAddress.indexOf(current);
+            result |= (Long.parseLong(current) << ((maxIndex-i) * 8));
         }
         return result & 0xFFFFFFFF;
     }
diff --git a/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/IpConverterTest.java b/extension/openflowplugin-extension-nicira/src/test/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/IpConverterTest.java
new file mode 100644 (file)
index 0000000..f8e27ff
--- /dev/null
@@ -0,0 +1,24 @@
+package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+
+public class IpConverterTest {
+
+    @Test
+    public void testIpv4AddressToLong() {
+        Ipv4Address ipAddress = new Ipv4Address("192.168.1.2");
+        long address = 0xc0a80102L;
+        assertEquals(address, IpConverter.Ipv4AddressToLong(ipAddress));
+    }
+
+    @Test
+    public void testIpv4AddressToLong2() {
+        Ipv4Address ipAddress = new Ipv4Address("10.168.1.2");
+        long address = 0x0aa80102L;
+        assertEquals(address, IpConverter.Ipv4AddressToLong(ipAddress));
+    }
+
+}
index 62d49173bbe057832a356a4773a5c3ef93028174..7111c20fe03384fd10265233c547cd59bea4904c 100644 (file)
             <classifier>config</classifier>
             <type>xml</type>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.openflowplugin</groupId>
+            <artifactId>openflowplugin-blueprint-config</artifactId>
+            <version>${project.version}</version>
+        </dependency>
 
         <dependency>
             <groupId>org.opendaylight.dlux</groupId>
index 9872cf47ca44d1960827f6417618694cbe9fc379..638c8a073c6d16bca452f67a9aee8418c5f00c85 100644 (file)
@@ -36,7 +36,8 @@
         <bundle>mvn:org.opendaylight.openflowplugin/openflowplugin/{{VERSION}}</bundle>
         <bundle>mvn:org.opendaylight.openflowplugin/openflowplugin-impl/{{VERSION}}</bundle>
         <bundle>mvn:org.opendaylight.openflowplugin/openflowplugin-extension-api/{{VERSION}}</bundle>
-       <bundle>mvn:org.opendaylight.controller/liblldp/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.controller/liblldp/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.openflowplugin/openflowplugin-blueprint-config/{{VERSION}}</bundle>
         <configfile finalname="etc/opendaylight/karaf/42-openflowplugin-Li.xml">mvn:org.opendaylight.openflowplugin/openflowplugin-controller-config/{{VERSION}}/xml/config-Li</configfile>
     </feature>
 
index c02e3c1d8a21be6f033fe23fe272dc226769d7ac..5568bd2c1d9f8db8b4f005978888b1cf0df1cdf2 100644 (file)
             <groupId>org.opendaylight.openflowplugin</groupId>
             <artifactId>openflowplugin-impl</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.openflowplugin</groupId>
+            <artifactId>openflowplugin-blueprint-config-he</artifactId>
+            <version>${project.version}</version>
+        </dependency>
         <dependency>
             <groupId>org.opendaylight.openflowplugin.applications</groupId>
             <artifactId>table-miss-enforcer</artifactId>
index 36e80a25b53b7d085655c8c229f7763d3fd82dd8..214452365c5c7780c16f2063c94ed640cec524d3 100644 (file)
         <bundle>mvn:org.opendaylight.openflowplugin/openflowplugin/{{VERSION}}</bundle>
         <bundle>mvn:org.opendaylight.openflowplugin/openflowplugin-api/{{VERSION}}</bundle>
         <bundle>mvn:org.opendaylight.openflowplugin/openflowplugin-extension-api/{{VERSION}}</bundle>
-       <bundle>mvn:org.opendaylight.controller/liblldp/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.controller/liblldp/{{VERSION}}</bundle>
         <bundle>mvn:org.opendaylight.openflowplugin.applications/inventory-manager/{{VERSION}}</bundle>
         <bundle>mvn:org.opendaylight.openflowplugin.applications/statistics-manager/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.openflowplugin/openflowplugin-blueprint-config-he/{{VERSION}}</bundle>
         <configfile finalname="${config.configfile.directory}/${config.statistics.manager.configfile}">mvn:org.opendaylight.openflowplugin.applications/statistics-manager-config/{{VERSION}}/xml/config</configfile>
         <configfile finalname="${config.configfile.directory}/${config.inventory.manager.configfile}">mvn:org.opendaylight.openflowplugin.applications/inventory-manager/{{VERSION}}/xml/config</configfile>
         <configfile finalname="etc/opendaylight/karaf/42-openflowplugin-He.xml">mvn:org.opendaylight.openflowplugin/openflowplugin-controller-config/{{VERSION}}/xml/config-He</configfile>
diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/OpenFlowPluginProviderFactory.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/OpenFlowPluginProviderFactory.java
new file mode 100644 (file)
index 0000000..d5caf2d
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2016 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ *
+ * 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
+ */
+package org.opendaylight.openflowplugin.api.openflow;
+
+import java.util.List;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.controller.md.sal.binding.api.NotificationService;
+import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.OpenflowProviderConfig;
+
+/**
+ * Factory for creating OpenFlowPluginProvider instances.
+ *
+ * @author Thomas Pantelis
+ */
+public interface OpenFlowPluginProviderFactory {
+    OpenFlowPluginProvider newInstance(OpenflowProviderConfig providerConfig, DataBroker dataBroker,
+            RpcProviderRegistry rpcRegistry, NotificationService notificationService,
+            NotificationPublishService notificationPublishService,
+            EntityOwnershipService entityOwnershipService,
+            List<SwitchConnectionProvider> switchConnectionProviders);
+}
index 3af5e496428bf83d98bb3f948ae68d1eb52dad49..15d59383eb906dbbaf6f8fc9d0449f99bc6c2df7 100644 (file)
@@ -9,7 +9,6 @@
 package org.opendaylight.openflowplugin.api.openflow.device;
 
 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
-import org.opendaylight.controller.md.sal.binding.api.NotificationService;
 import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceConnectedHandler;
 import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceDisconnectedHandler;
 import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceInitializationPhaseHandler;
index 1cbc3c28039dbaaba0b9cb5ca884e4a12b81f494..36161c386ad0e7b14d38240d54e1d3f6e23eb384 100644 (file)
@@ -12,7 +12,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.OfpRole;
 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
 
 /**
index a3ca90d6bd1828976e9c28b9ff1cb501de5c4097..19854c7913a1f91eb6307f08043d7d708f8d916a 100644 (file)
@@ -9,7 +9,6 @@
 package org.opendaylight.openflowplugin.api.openflow.lifecycle;
 
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.OfpRole;
 
 /**
  * This API is for all listeners who wish to know about device context in cluster
diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/AbstractModelDrivenSwitchRegistration.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/AbstractModelDrivenSwitchRegistration.java
new file mode 100644 (file)
index 0000000..e710c60
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * 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
+ */
+package org.opendaylight.openflowplugin.api.openflow.md;
+
+import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
+
+public abstract class AbstractModelDrivenSwitchRegistration extends AbstractObjectRegistration<ModelDrivenSwitch>
+    implements ModelDrivenSwitchRegistration {
+
+    protected AbstractModelDrivenSwitchRegistration(final ModelDrivenSwitch instance) {
+        super(instance);
+    }
+
+}
index 0120d9004f226ab95a92fd5e6f9f450980d4fdfc..90270c6326ffa39317e73571a727e1fb255c3fba 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.openflowplugin.api.openflow.md;
 
 import com.google.common.base.Optional;
+import java.math.BigInteger;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
@@ -25,12 +26,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.SalP
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.OpendaylightPortStatisticsService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.OpendaylightQueueStatisticsService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.SalTableService;
-import org.opendaylight.yangtools.concepts.CompositeObjectRegistration;
 import org.opendaylight.yangtools.concepts.Identifiable;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
-import java.math.BigInteger;
-
 /**
  * interface concatenating all md-sal services provided by OF-switch
  */
@@ -47,7 +45,7 @@ public interface ModelDrivenSwitch
      * @param rpcProviderRegistry
      * @return wrapped list of {service provider + path} registration couples
      */
-    CompositeObjectRegistration<ModelDrivenSwitch> register(RpcProviderRegistry rpcProviderRegistry);
+    ModelDrivenSwitchRegistration register(RpcProviderRegistry rpcProviderRegistry);
 
     /**
      * @return id of encapsulated node (served by this impl)
diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/ModelDrivenSwitchRegistration.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/ModelDrivenSwitchRegistration.java
new file mode 100644 (file)
index 0000000..9da85b3
--- /dev/null
@@ -0,0 +1,15 @@
+/**
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * 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
+ */
+package org.opendaylight.openflowplugin.api.openflow.md;
+
+import org.opendaylight.yangtools.concepts.ObjectRegistration;
+
+public interface ModelDrivenSwitchRegistration extends ObjectRegistration<ModelDrivenSwitch> {
+    @Override
+    void close();
+}
index 221055b4aa847cc592901b25dda28d2b24f3efba..9de1dd7ad4dab0f7594603b54ed8b5ac5039871b 100644 (file)
@@ -12,7 +12,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
-import org.opendaylight.openflowplugin.api.openflow.md.ModelDrivenSwitch;
+import org.opendaylight.openflowplugin.api.openflow.md.ModelDrivenSwitchRegistration;
 import org.opendaylight.openflowplugin.api.openflow.md.core.ConnectionConductor;
 import org.opendaylight.openflowplugin.api.openflow.md.core.NotificationEnqueuer;
 import org.opendaylight.openflowplugin.api.openflow.md.core.NotificationQueueWrapper;
@@ -20,7 +20,6 @@ import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDist
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ControllerRole;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortGrouping;
-import org.opendaylight.yangtools.concepts.CompositeObjectRegistration;
 
 /**
  * @author mirehak
@@ -160,12 +159,12 @@ public interface SessionContext {
     /**
      * @param registration provider composite registration
      */
-    void setProviderRegistration(CompositeObjectRegistration<ModelDrivenSwitch> registration);
+    void setProviderRegistration(ModelDrivenSwitchRegistration registration);
 
     /**
      * @return provider composite registration
      */
-    CompositeObjectRegistration<ModelDrivenSwitch> getProviderRegistration();
+    ModelDrivenSwitchRegistration getProviderRegistration();
 
     /**
      * @return seed value for random operations
index 5a1bb0dbacc884d02ec9487f88a966cadb05f4aa..dee6ec896a289cc605205ef69c079caf16d23261 100644 (file)
@@ -7,12 +7,10 @@
  */
 package org.opendaylight.openflowplugin.api.openflow.role;
 
-import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceTerminationPhaseHandler;
 import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceInitializationPhaseHandler;
 import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceLifecycleSupervisor;
+import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceTerminationPhaseHandler;
 import org.opendaylight.openflowplugin.api.openflow.lifecycle.RoleChangeListener;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.OfpRole;
 
 /**
  * Created by kramesha on 8/31/15.
index f5c8e2894e91eb9d5910b64d9da9f00d1b53b479..63a0c984973c2e3c0eaf668386ae5efb5466a97d 100644 (file)
@@ -8,10 +8,9 @@
 
 package org.opendaylight.openflowplugin.api.openflow.rpc;
 
-import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceTerminationPhaseHandler;
-import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
 import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceInitializationPhaseHandler;
 import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceLifecycleSupervisor;
+import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceTerminationPhaseHandler;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 
 /**
diff --git a/openflowplugin-api/src/main/yang/openflow-provider-config.yang b/openflowplugin-api/src/main/yang/openflow-provider-config.yang
new file mode 100644 (file)
index 0000000..481793e
--- /dev/null
@@ -0,0 +1,68 @@
+module openflow-provider-config {
+    yang-version 1;
+    namespace "urn:opendaylight:params:xml:ns:yang:openflow:provider:config";
+    prefix "openflow-provider-config";
+
+    description
+        "Configuration for an Openflow provider.";
+
+    revision "2016-05-10" {
+        description
+            "Initial revision";
+    }
+
+    typedef non-zero-uint32-type {
+        type uint32 {
+            range "1..max";
+        }
+    }
+
+    typedef non-zero-uint16-type {
+        type uint16 {
+            range "1..max";
+        }
+    }
+
+    container openflow-provider-config {
+        leaf rpc-requests-quota {
+            type uint32;
+            default 20000;
+        }
+
+        leaf switch-features-mandatory {
+            type boolean;
+            default false;
+        }
+
+        leaf global-notification-quota {
+            type uint32;
+            default 64000;
+        }
+
+        leaf is-statistics-polling-off {
+            type boolean;
+            default "false";
+        }
+
+        leaf is-statistics-rpc-enabled {
+            description "Deprecated - exposing backward compatible statistics rpcs providing result in form of async notification";
+            type boolean;
+            default "false";
+        }
+
+        leaf barrier-interval-timeout-limit {
+            type non-zero-uint32-type;
+            default 500;
+        }
+
+        leaf barrier-count-limit {
+            type non-zero-uint16-type;
+            default 25600;
+        }
+
+        leaf echo-reply-timeout {
+            type non-zero-uint32-type;
+            default 2000;
+        }
+    }
+}
\ No newline at end of file
index fa640fe401c0a6ec34ddefee2c4f325d758d4049..cb020ef858dac66f0aeb8d732977dfe08eddc133 100644 (file)
@@ -16,5 +16,7 @@ module openflow-provider {
     identity openflow-provider{
         base config:service-type;
         config:java-class "org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProvider";
+        config:disable-osgi-service-registration;
+        status deprecated;
     }
 }
\ No newline at end of file
diff --git a/openflowplugin-blueprint-config-he/pom.xml b/openflowplugin-blueprint-config-he/pom.xml
new file mode 100644 (file)
index 0000000..0e1bf7f
--- /dev/null
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+      <groupId>org.opendaylight.openflowplugin</groupId>
+      <artifactId>openflowplugin-parent</artifactId>
+      <version>0.3.0-SNAPSHOT</version>
+      <relativePath>../parent</relativePath>
+    </parent>
+
+    <artifactId>openflowplugin-blueprint-config-he</artifactId>
+    <description>Blueprint configuration for the Helium openflowplugin</description>
+    <packaging>bundle</packaging>
+
+    <build>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.felix</groupId>
+          <artifactId>maven-bundle-plugin</artifactId>
+          <extensions>true</extensions>
+          <configuration>
+            <instructions>
+              <DynamicImport-Package>*</DynamicImport-Package>
+           </instructions>
+         </configuration>
+       </plugin>
+     </plugins>
+   </build>
+</project>
diff --git a/openflowplugin-blueprint-config-he/src/main/resources/org/opendaylight/blueprint/openflowplugin-helium.xml b/openflowplugin-blueprint-config-he/src/main/resources/org/opendaylight/blueprint/openflowplugin-helium.xml
new file mode 100644 (file)
index 0000000..6ef2961
--- /dev/null
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+        odl:use-default-for-reference-types="true">
+
+  <reference id="dataBroker" interface="org.opendaylight.controller.md.sal.binding.api.DataBroker" odl:type="pingpong"/>
+  <reference id="rpcRegistry" interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"/>
+  <reference id="notificationService" interface="org.opendaylight.controller.sal.binding.api.NotificationProviderService"/>
+  <reference id="entityOwnershipService" interface="org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService"/>
+
+  <!-- Create the StatisticsManager -->
+  <reference id="statsManagerFactory"
+          interface="org.opendaylight.openflowplugin.applications.statistics.manager.StatisticsManagerFactory"/>
+
+  <odl:clustered-app-config id="statsManagerAppConfig"
+      binding-class="org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.app.statistics.manager.config.rev160509.StatisticsManagerAppConfig"/>
+
+  <bean id="statsManager" factory-ref="statsManagerFactory" factory-method="newInstance">
+    <argument ref="statsManagerAppConfig"/>
+    <argument ref="dataBroker"/>
+    <argument ref="notificationService"/>
+    <argument ref="rpcRegistry"/>
+    <argument ref="entityOwnershipService"/>
+  </bean>
+
+  <!-- Create the Inventory manager/provider -->
+  <bean id="inventoryManager" class="org.opendaylight.openflowplugin.applications.inventory.manager.InventoryActivator"
+          init-method="start" destroy-method="close">
+    <argument ref="dataBroker"/>
+    <argument ref="notificationService"/>
+    <argument ref="entityOwnershipService"/>
+  </bean>
+
+  <reference id="switchConnProviderFactory"
+          interface="org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProviderFactory"/>
+
+  <!-- Create OF switch connection provider on port 6633 -->
+  <odl:clustered-app-config id="defaultSwitchConnConfig"
+      binding-class="org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow._switch.connection.config.rev160506.SwitchConnectionConfig"
+      list-key-value="openflow-switch-connection-provider-default-impl">
+    <odl:default-config><![CDATA[
+      <switch-connection-config xmlns="urn:opendaylight:params:xml:ns:yang:openflow:switch:connection:config">
+        <instance-name>openflow-switch-connection-provider-default-impl</instance-name>
+        <port>6633</port>
+        <transport-protocol>TCP</transport-protocol>
+      </switch-connection-config>
+    ]]></odl:default-config>
+  </odl:clustered-app-config>
+
+  <bean id="defaultSwitchConnProvider" factory-ref="switchConnProviderFactory" factory-method="newInstance">
+    <argument ref="defaultSwitchConnConfig"/>
+  </bean>
+
+  <service ref="defaultSwitchConnProvider" interface="org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider"
+          odl:type="openflow-switch-connection-provider-default-impl"/>
+
+  <!-- Create OF switch connection provider on port 6653 -->
+  <odl:clustered-app-config id="legacySwitchConnConfig"
+      binding-class="org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow._switch.connection.config.rev160506.SwitchConnectionConfig"
+      list-key-value="openflow-switch-connection-provider-legacy-impl">
+    <odl:default-config><![CDATA[
+      <switch-connection-config xmlns="urn:opendaylight:params:xml:ns:yang:openflow:switch:connection:config">
+        <instance-name>openflow-switch-connection-provider-legacy-impl</instance-name>
+        <port>6653</port>
+        <transport-protocol>TCP</transport-protocol>
+      </switch-connection-config>
+    ]]></odl:default-config>
+  </odl:clustered-app-config>
+
+  <bean id="legacySwitchConnProvider" factory-ref="switchConnProviderFactory" factory-method="newInstance">
+    <argument ref="legacySwitchConnConfig"/>
+  </bean>
+
+  <service ref="legacySwitchConnProvider" interface="org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider"
+          odl:type="openflow-switch-connection-provider-legacy-impl"/>
+
+  <!-- Create OpenflowPluginProvider instance -->
+
+  <bean id="openflowPluginProvider" class="org.opendaylight.openflowplugin.openflow.md.core.sal.OpenflowPluginProvider"
+          init-method="initialization" destroy-method="close" depends-on="statsManager inventoryManager">
+    <property name="dataBroker" ref="dataBroker"/>
+    <property name="rpcRegistry" ref="rpcRegistry"/>
+    <property name="notificationService" ref="notificationService"/>
+    <property name="entityOwnershipService" ref="entityOwnershipService"/>
+    <property name="role" value="NOCHANGE"/>
+    <property name="skipTableFeatures" value="false" />
+    <property name="switchConnectionProviders">
+      <list>
+        <ref component-id="defaultSwitchConnProvider"/>
+        <ref component-id="legacySwitchConnProvider"/>
+      </list>
+    </property>
+  </bean>
+
+  <service ref="openflowPluginProvider" odl:type="openflow-provider-impl">
+    <interfaces>
+      <value>org.opendaylight.openflowplugin.openflow.md.core.sal.OpenflowPluginProvider</value>
+      <value>org.opendaylight.openflowplugin.extension.api.OpenFlowPluginExtensionRegistratorProvider</value>
+    </interfaces>
+  </service>
+
+</blueprint>
\ No newline at end of file
diff --git a/openflowplugin-blueprint-config/pom.xml b/openflowplugin-blueprint-config/pom.xml
new file mode 100644 (file)
index 0000000..61dd36f
--- /dev/null
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+      <groupId>org.opendaylight.openflowplugin</groupId>
+      <artifactId>openflowplugin-parent</artifactId>
+      <version>0.3.0-SNAPSHOT</version>
+      <relativePath>../parent</relativePath>
+    </parent>
+
+    <artifactId>openflowplugin-blueprint-config</artifactId>
+    <description>Blueprint configuration for the openflowplugin</description>
+    <packaging>bundle</packaging>
+
+    <build>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.felix</groupId>
+          <artifactId>maven-bundle-plugin</artifactId>
+          <extensions>true</extensions>
+          <configuration>
+            <instructions>
+              <DynamicImport-Package>*</DynamicImport-Package>
+           </instructions>
+         </configuration>
+       </plugin>
+     </plugins>
+   </build>
+</project>
diff --git a/openflowplugin-blueprint-config/src/main/resources/org/opendaylight/blueprint/openflowplugin.xml b/openflowplugin-blueprint-config/src/main/resources/org/opendaylight/blueprint/openflowplugin.xml
new file mode 100644 (file)
index 0000000..db68c3b
--- /dev/null
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+        odl:use-default-for-reference-types="true">
+
+  <reference id="dataBroker" interface="org.opendaylight.controller.md.sal.binding.api.DataBroker" odl:type="pingpong"/>
+  <reference id="rpcRegistry" interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"/>
+  <reference id="notificationService" interface="org.opendaylight.controller.md.sal.binding.api.NotificationService"/>
+  <reference id="notificationPublishService" interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService"/>
+  <reference id="entityOwnershipService" interface="org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService"/>
+
+  <reference id="switchConnProviderFactory"
+          interface="org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProviderFactory"/>
+
+  <!-- Create OF switch connection provider on port 6633 -->
+  <odl:clustered-app-config id="defaultSwitchConnConfig"
+      binding-class="org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow._switch.connection.config.rev160506.SwitchConnectionConfig"
+      list-key-value="openflow-switch-connection-provider-default-impl">
+    <odl:default-config><![CDATA[
+      <switch-connection-config xmlns="urn:opendaylight:params:xml:ns:yang:openflow:switch:connection:config">
+        <instance-name>openflow-switch-connection-provider-default-impl</instance-name>
+        <port>6633</port>
+        <transport-protocol>TCP</transport-protocol>
+      </switch-connection-config>
+    ]]></odl:default-config>
+  </odl:clustered-app-config>
+
+  <bean id="defaultSwitchConnProvider" factory-ref="switchConnProviderFactory" factory-method="newInstance">
+    <argument ref="defaultSwitchConnConfig"/>
+  </bean>
+
+  <service ref="defaultSwitchConnProvider" interface="org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider"
+          odl:type="openflow-switch-connection-provider-default-impl"/>
+
+  <!-- Create OF switch connection provider on port 6653 -->
+  <odl:clustered-app-config id="legacySwitchConnConfig"
+      binding-class="org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow._switch.connection.config.rev160506.SwitchConnectionConfig"
+      list-key-value="openflow-switch-connection-provider-legacy-impl">
+    <odl:default-config><![CDATA[
+      <switch-connection-config xmlns="urn:opendaylight:params:xml:ns:yang:openflow:switch:connection:config">
+        <instance-name>openflow-switch-connection-provider-legacy-impl</instance-name>
+        <port>6653</port>
+        <transport-protocol>TCP</transport-protocol>
+      </switch-connection-config>
+    ]]></odl:default-config>
+  </odl:clustered-app-config>
+
+  <bean id="legacySwitchConnProvider" factory-ref="switchConnProviderFactory" factory-method="newInstance">
+    <argument ref="legacySwitchConnConfig"/>
+  </bean>
+
+  <service ref="legacySwitchConnProvider" interface="org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider"
+          odl:type="openflow-switch-connection-provider-legacy-impl"/>
+
+  <!-- Create OpenflowPluginProvider instance -->
+
+  <odl:clustered-app-config id="openflowProviderConfig"
+      binding-class="org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.OpenflowProviderConfig"/>
+
+  <reference id="openflowPluginProviderFactory"
+          interface="org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProviderFactory"/>
+
+  <bean id="openflowPluginProvider" factory-ref="openflowPluginProviderFactory" factory-method="newInstance">
+    <argument ref="openflowProviderConfig"/>
+    <argument ref="dataBroker"/>
+    <argument ref="rpcRegistry"/>
+    <argument ref="notificationService"/>
+    <argument ref="notificationPublishService"/>
+    <argument ref="entityOwnershipService"/>
+    <argument>
+      <list>
+        <ref component-id="defaultSwitchConnProvider"/>
+        <ref component-id="legacySwitchConnProvider"/>
+      </list>
+    </argument>
+  </bean>
+
+  <service ref="openflowPluginProvider" odl:type="openflow-plugin-provider-impl">
+    <interfaces>
+      <value>org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProvider</value>
+      <value>org.opendaylight.openflowplugin.extension.api.OpenFlowPluginExtensionRegistratorProvider</value>
+    </interfaces>
+  </service>
+
+</blueprint>
\ No newline at end of file
index 7a282c09dc0b9c53b21cdc95064bb181b91f8f20..0c9db146a83f134650d5da12538282b19ba1a98b 100644 (file)
@@ -6,6 +6,9 @@ Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
 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
+
+NOTE: This file is deprecated as wiring is now done via blueprint. This file is kept for
+       backwards compatibility. Runtime modifications are not honored.
 -->
 <snapshot>
     <required-capabilities>
index f6c9453c26fc2b636e329011379d542376de1f48..70831eb720f6ad1ce5e52f106045456b707a98ba 100644 (file)
@@ -117,11 +117,13 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
                 <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-notification-service</type>
                 <name>binding-notification-broker</name>
             </notification-service>
-           <ownership-service>
-               <type xmlns:entity-ownership="urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:entity-ownership-service">entity-ownership:entity-ownership-service</type>
-               <name>entity-ownership-service</name>
-           </ownership-service>
-           
+            <ownership-service>
+                <type xmlns:entity-ownership="urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:entity-ownership-service">entity-ownership:entity-ownership-service</type>
+                <name>entity-ownership-service</name>
+            </ownership-service>
+
+          <!-- openflowplugin configuraion -->
+          <skip-table-features>false</skip-table-features>
 
         </module>
       </modules>
index ddf73a75cc468af369bcfa7fa373c5f024d6c1b2..b55bff8720b3431029b134b7a853f3fe21e8fa26 100644 (file)
@@ -16,10 +16,14 @@ import com.google.common.util.concurrent.ListenableFuture;
 import io.netty.util.HashedWheelTimer;
 import io.netty.util.Timeout;
 import io.netty.util.TimerTask;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.TimeUnit;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceManager;
-import org.opendaylight.openflowplugin.api.openflow.device.DeviceState;
 import org.opendaylight.openflowplugin.api.openflow.lifecycle.DeviceContextChangeListener;
 import org.opendaylight.openflowplugin.api.openflow.lifecycle.LifecycleConductor;
 import org.opendaylight.openflowplugin.api.openflow.lifecycle.RoleChangeListener;
@@ -31,12 +35,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.OfpR
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.TimeUnit;
-
 /**
  */
 public final class LifecycleConductorImpl implements LifecycleConductor, RoleChangeListener, DeviceContextChangeListener {
diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/OpenFlowPluginProviderFactoryImpl.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/OpenFlowPluginProviderFactoryImpl.java
new file mode 100644 (file)
index 0000000..202b177
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2016 Brocade Communications Systems, Inc. and others.  All rights reserved.
+ *
+ * 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
+ */
+package org.opendaylight.openflowplugin.impl;
+
+import java.util.List;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.controller.md.sal.binding.api.NotificationService;
+import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
+import org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProvider;
+import org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProviderFactory;
+import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.OpenflowProviderConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Implementation of OpenFlowPluginProviderFactory.
+ *
+ * @author Thomas Pantelis
+ */
+public class OpenFlowPluginProviderFactoryImpl implements OpenFlowPluginProviderFactory {
+    private static final Logger LOG = LoggerFactory.getLogger(OpenFlowPluginProviderFactoryImpl.class);
+
+    @Override
+    public OpenFlowPluginProvider newInstance(OpenflowProviderConfig providerConfig, DataBroker dataBroker,
+            RpcProviderRegistry rpcRegistry, NotificationService notificationService,
+            NotificationPublishService notificationPublishService,
+            EntityOwnershipService entityOwnershipService,
+            List<SwitchConnectionProvider> switchConnectionProviders) {
+
+        LOG.info("Initializing new OFP southbound.");
+
+        OpenflowPortsUtil.init();
+        OpenFlowPluginProvider openflowPluginProvider = new OpenFlowPluginProviderImpl(providerConfig.getRpcRequestsQuota(),
+                providerConfig.getGlobalNotificationQuota());
+
+        openflowPluginProvider.setSwitchConnectionProviders(switchConnectionProviders);
+        openflowPluginProvider.setDataBroker(dataBroker);
+        openflowPluginProvider.setRpcProviderRegistry(rpcRegistry);
+        openflowPluginProvider.setNotificationProviderService(notificationService);
+        openflowPluginProvider.setNotificationPublishService(notificationPublishService);
+        openflowPluginProvider.setEntityOwnershipService(entityOwnershipService);
+        openflowPluginProvider.setSwitchFeaturesMandatory(providerConfig.isSwitchFeaturesMandatory());
+        openflowPluginProvider.setIsStatisticsPollingOff(providerConfig.isIsStatisticsPollingOff());
+        openflowPluginProvider.setIsStatisticsRpcEnabled(providerConfig.isIsStatisticsRpcEnabled());
+        openflowPluginProvider.setBarrierCountLimit(providerConfig.getBarrierCountLimit().getValue());
+        openflowPluginProvider.setBarrierInterval(providerConfig.getBarrierIntervalTimeoutLimit().getValue());
+        openflowPluginProvider.setEchoReplyTimeout(providerConfig.getEchoReplyTimeout().getValue());
+
+        openflowPluginProvider.initialize();
+
+        LOG.info("Configured values, StatisticsPollingOff:{}, SwitchFeaturesMandatory:{}, BarrierCountLimit:{}, BarrierTimeoutLimit:{}, EchoReplyTimeout:{}",
+                providerConfig.isIsStatisticsPollingOff(), providerConfig.isSwitchFeaturesMandatory(),
+                providerConfig.getBarrierCountLimit().getValue(),
+                providerConfig.getBarrierIntervalTimeoutLimit().getValue(), providerConfig.getEchoReplyTimeout().getValue());
+
+        return openflowPluginProvider;
+    }
+}
index 441725723740f439ac10f78b1f03bc1e5d2c5028..28faad3263745e4c863970cc3486e7ae54237672 100644 (file)
@@ -66,7 +66,6 @@ import org.opendaylight.openflowplugin.impl.registry.flow.DeviceFlowRegistryImpl
 import org.opendaylight.openflowplugin.impl.registry.flow.FlowRegistryKeyFactory;
 import org.opendaylight.openflowplugin.impl.registry.group.DeviceGroupRegistryImpl;
 import org.opendaylight.openflowplugin.impl.registry.meter.DeviceMeterRegistryImpl;
-import org.opendaylight.openflowplugin.impl.rpc.RpcContextImpl;
 import org.opendaylight.openflowplugin.impl.util.DeviceInitializationUtils;
 import org.opendaylight.openflowplugin.impl.util.MdSalRegistrationUtils;
 import org.opendaylight.openflowplugin.openflow.md.core.session.SwitchConnectionCookieOFImpl;
index 16864cd33978183ee249314dbfa55eca8800c892..37768bc5e97d2e1592daaa0a2124cd5b6298858f 100644 (file)
@@ -19,7 +19,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.N
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FeaturesReply;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.OfpRole;
 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
 
 /**
index 8cd41133159384c3f360f5538b085a2086590388..ab8136281671a144ef13ac4f0a8743e9b140d190 100644 (file)
@@ -8,12 +8,10 @@
 package org.opendaylight.openflowplugin.impl.role;
 
 import com.google.common.base.Preconditions;
-
 import java.util.concurrent.Semaphore;
 import java.util.concurrent.TimeUnit;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
-
 import org.opendaylight.controller.md.sal.common.api.clustering.CandidateAlreadyRegisteredException;
 import org.opendaylight.controller.md.sal.common.api.clustering.Entity;
 import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipCandidateRegistration;
@@ -21,7 +19,6 @@ import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipS
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
 import org.opendaylight.openflowplugin.api.openflow.lifecycle.LifecycleConductor;
 import org.opendaylight.openflowplugin.api.openflow.role.RoleContext;
-import org.opendaylight.openflowplugin.impl.LifecycleConductorImpl;
 import org.opendaylight.openflowplugin.impl.rpc.AbstractRequestContext;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.SalRoleService;
index 91feab60f6580be9199c1d9046cb845fde4c3780..c5dd4eb03f5e4cce0e83e8d6d88f35fe067d4a12 100644 (file)
@@ -15,7 +15,6 @@ import java.util.Map.Entry;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.Semaphore;
-
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
@@ -23,7 +22,6 @@ import org.opendaylight.openflowplugin.api.openflow.device.XidSequencer;
 import org.opendaylight.openflowplugin.api.openflow.rpc.RpcContext;
 import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeContext;
-import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
index 3619e66e914d0f15eeaf0ba0940fc4b27ddac12f..0180530154532b8414c15fe396c5eea4bc6e4a1d 100644 (file)
@@ -14,7 +14,6 @@ import com.google.common.collect.Iterators;
 import java.util.Iterator;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
-import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceInitializationPhaseHandler;
index c677c53a68247079504cb9a8664125eb798020f6..07b5fadcad2b514f16dc89025d166088d1af5827 100644 (file)
@@ -20,7 +20,6 @@ import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
 import org.opendaylight.openflowplugin.impl.role.RoleChangeException;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ControllerRole;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.RoleRequestInputBuilder;
index 0179f8e3f09112ebe945144dab64893f2b3b78f7..1ebc5d4b5ac461ef00f09877ac892db02bfd0c3f 100644 (file)
@@ -7,24 +7,17 @@
  */
 package org.opendaylight.openflowplugin.impl.services;
 
-import java.util.Collection;
-import java.util.concurrent.Future;
-
-import com.google.common.annotations.VisibleForTesting;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
+import java.util.Collection;
+import java.util.concurrent.Future;
+import javax.annotation.Nullable;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
-import org.opendaylight.openflowplugin.api.openflow.registry.flow.FlowDescriptor;
 import org.opendaylight.openflowplugin.api.openflow.rpc.ItemLifeCycleSource;
 import org.opendaylight.openflowplugin.api.openflow.rpc.listener.ItemLifecycleListener;
-import org.opendaylight.openflowplugin.impl.registry.flow.FlowDescriptorFactory;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupInput;
@@ -44,8 +37,6 @@ import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.annotation.Nullable;
-
 public class SalGroupServiceImpl implements SalGroupService, ItemLifeCycleSource {
     private static final Logger LOG = LoggerFactory.getLogger(SalGroupServiceImpl.class);
     private final GroupService<AddGroupInput, AddGroupOutput> addGroup;
index 946669043a64676799b0c3ad28689bd403c3d086..ced8aa4d3659fe16f22025523897d8b889ec7540 100644 (file)
@@ -7,12 +7,12 @@
  */
 package org.opendaylight.openflowplugin.impl.services;
 
-import java.util.Collection;
-import java.util.concurrent.Future;
-
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
+import java.util.Collection;
+import java.util.concurrent.Future;
+import javax.annotation.Nullable;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
 import org.opendaylight.openflowplugin.api.openflow.rpc.ItemLifeCycleSource;
@@ -20,7 +20,6 @@ import org.opendaylight.openflowplugin.api.openflow.rpc.listener.ItemLifecycleLi
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInput;
@@ -38,8 +37,6 @@ import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.annotation.Nullable;
-
 public class SalMeterServiceImpl implements SalMeterService, ItemLifeCycleSource {
     private static final Logger LOG = LoggerFactory.getLogger(SalMeterServiceImpl.class);
     private final MeterService<AddMeterInput, AddMeterOutput> addMeter;
index 32aa20c843413c61f63c9c9ac28f11d45c71c877..c6d15de02fd457be14ab8d7f52c87e7e56f26851 100644 (file)
@@ -23,7 +23,6 @@ import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
 import org.opendaylight.openflowplugin.impl.role.RoleChangeException;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.RoleRequestOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.OfpRole;
index 6c8d587854bb42d827dccaa50427e3a449201445..e58ea89b17ff0f09662d2951c10ba636715a2eed 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.openflowplugin.impl.statistics;
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.List;
-import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.FlowStatsResponseConvertor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.GroupStatsResponseConvertor;
@@ -53,7 +52,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.Meter
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.duration.DurationBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.BytesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.node.connector.statistics.PacketsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FeaturesReply;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregateCase;
index 1381bf9a2d57a5a934483c62291261de8ad76b8d..6e7626d4954a3c2855b3f860e551c81455de2e12 100644 (file)
@@ -8,7 +8,6 @@
 
 package org.opendaylight.openflowplugin.impl.translator;
 
-import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceState;
 import org.opendaylight.openflowplugin.api.openflow.device.MessageTranslator;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.Counter32;
index 8ed2f223eb6cde20ad14ffaa585878b48580724e..4aa08b00288f215fe1ec111544d5600e9e025941 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.openflowplugin.impl.translator;
 
-import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceState;
 import org.opendaylight.openflowplugin.api.openflow.device.MessageTranslator;
 import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
index e684f857a249948aa4259afeee5a68fa6390d450..23efec2ed636a1c5f06feb76987e7b5278c901e1 100644 (file)
@@ -8,7 +8,6 @@
 
 package org.opendaylight.openflowplugin.impl.translator;
 
-import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceState;
 import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchConvertorImpl;
index 9e9793d66ca62f02a4e624f7bcf0549b7fff268e..08862300d76327896cc993a80abbb34882a90b04 100644 (file)
@@ -10,8 +10,6 @@ package org.opendaylight.openflowplugin.impl.translator;
 
 import com.google.common.annotations.VisibleForTesting;
 import java.math.BigInteger;
-import java.util.List;
-import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceState;
 import org.opendaylight.openflowplugin.api.openflow.device.MessageTranslator;
 import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
@@ -24,8 +22,6 @@ import org.opendaylight.openflowplugin.openflow.md.util.PacketInUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.InPortCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessage;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketReceived;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketReceivedBuilder;
index 6c35a2a50ec6692c994ef4fe15d72e3329549289..54a2b4c8d6e2baf25899d40e754bb82bda946dd2 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.openflowplugin.impl.translator;
 
 import java.util.Collections;
 import org.opendaylight.openflowplugin.api.OFConstants;
-import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceState;
 import org.opendaylight.openflowplugin.api.openflow.device.MessageTranslator;
 import org.opendaylight.openflowplugin.openflow.md.util.PortTranslatorUtil;
index d4da3cc131c277265c5705d961d0e16dcd444c47..a9a6e190af485f630958d0df2fd1cf479767f1fc 100644 (file)
@@ -15,9 +15,6 @@ import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.SettableFuture;
 import java.math.BigInteger;
-import java.net.Inet4Address;
-import java.net.Inet6Address;
-import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.util.Arrays;
 import java.util.Collection;
index 4c71ea59e7ed4510d3c9f4f1996d80539ad4170c..477d73ab7ac7fc6fdcdd82afe0f30d30789e2fa9 100644 (file)
@@ -10,26 +10,22 @@ package org.opendaylight.openflowplugin.impl.util;
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
+import java.math.BigInteger;
+import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 import org.opendaylight.openflowplugin.api.OFConstants;
-import org.opendaylight.openflowplugin.api.openflow.device.DeviceState;
 import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
 import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.in.port._case.InPort;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.InPortCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.in.port._case.InPort;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketIn;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.features.reply.PhyPort;
 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
 
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import java.math.BigInteger;
-import java.util.List;
-import java.util.Objects;
-
 /**
  * Created by Tomas Slusny on 23.3.2016.
  */
index 4717561f7de4d8af3d5837bc0e87466bde33ff7c..b3096bb666b935815a69e226c16a0b59950a80ff 100644 (file)
@@ -1,14 +1,20 @@
 package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.config.openflow.plugin.impl.rev150327;
 
+import com.google.common.reflect.AbstractInvocationHandler;
+import com.google.common.reflect.Reflection;
+import java.lang.reflect.Method;
+import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker;
 import org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProvider;
-import org.opendaylight.openflowplugin.impl.OpenFlowPluginProviderImpl;
-import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.opendaylight.openflowplugin.extension.api.OpenFlowPluginExtensionRegistratorProvider;
+import org.osgi.framework.BundleContext;
 
-public class OpenFlowProviderModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.config.openflow.plugin.impl.rev150327.AbstractOpenFlowProviderModule {
+/**
+ * @deprecated Replaced by blueprint wiring
+ */
+@Deprecated
+public class OpenFlowProviderModule extends AbstractOpenFlowProviderModule {
 
-    private static final Logger LOG = LoggerFactory.getLogger(OpenFlowProviderModule.class);
+    private BundleContext bundleContext;
 
     public OpenFlowProviderModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
         super(identifier, dependencyResolver);
@@ -19,37 +25,38 @@ public class OpenFlowProviderModule extends org.opendaylight.yang.gen.v1.urn.ope
     }
 
     @Override
-    public void customValidation() {
-        // add custom validation form module attributes here.
+    public AutoCloseable createInstance() {
+        // The service is provided via blueprint so wait for and return it here for backwards compatibility.
+        String typeFilter = String.format("(type=%s)", getIdentifier().getInstanceName());
+        final WaitingServiceTracker<OpenFlowPluginProvider> tracker = WaitingServiceTracker.create(
+                OpenFlowPluginProvider.class, bundleContext, typeFilter);
+        final OpenFlowPluginProvider openflowPluginProvider = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
+
+        // We don't want to call close on the actual service as its life cycle is controlled by blueprint but
+        // we do want to close the tracker so create a proxy to override close appropriately.
+        return Reflection.newProxy(OpenFlowPluginProviderProxyInterface.class, new AbstractInvocationHandler() {
+            @Override
+            protected Object handleInvocation(Object proxy, Method method, Object[] args) throws Throwable {
+                if (method.getName().equals("close")) {
+                    tracker.close();
+                    return null;
+                } else {
+                    return method.invoke(openflowPluginProvider, args);
+                }
+            }
+        });
+    }
+
+    public void setBundleContext(BundleContext bundleContext) {
+        this.bundleContext = bundleContext;
     }
 
     @Override
-    public java.lang.AutoCloseable createInstance() {
-        LOG.info("Initializing new OFP southbound.");
-        OpenflowPortsUtil.init();
-        final OpenFlowPluginProvider openflowPluginProvider = new OpenFlowPluginProviderImpl(getRpcRequestsQuota(), getGlobalNotificationQuota());
-
-        openflowPluginProvider.setSwitchConnectionProviders(getOpenflowSwitchConnectionProviderDependency());
-        openflowPluginProvider.setDataBroker(getDataBrokerDependency());
-        openflowPluginProvider.setRpcProviderRegistry(getRpcRegistryDependency());
-        openflowPluginProvider.setNotificationProviderService(getNotificationAdapterDependency());
-        openflowPluginProvider.setNotificationPublishService(getNotificationPublishAdapterDependency());
-        openflowPluginProvider.setSwitchFeaturesMandatory(getSwitchFeaturesMandatory());
-        openflowPluginProvider.setIsStatisticsPollingOff(getIsStatisticsPollingOff());
-        openflowPluginProvider.setEntityOwnershipService(getEntityOwnershipServiceDependency());
-        openflowPluginProvider.setIsStatisticsRpcEnabled(getIsStatisticsRpcEnabled());
-        openflowPluginProvider.setBarrierCountLimit(getBarrierCountLimit().getValue());
-        openflowPluginProvider.setBarrierInterval(getBarrierIntervalTimeoutLimit().getValue());
-        openflowPluginProvider.setEchoReplyTimeout(getEchoReplyTimeout().getValue());
-
-        openflowPluginProvider.initialize();
-
-        LOG.info("Configured values, StatisticsPollingOff:{}, SwitchFeaturesMandatory:{}, BarrierCountLimit:{}, BarrierTimeoutLimit:{}, EchoReplyTimeout:{}",
-                getIsStatisticsPollingOff(), getSwitchFeaturesMandatory(), getBarrierCountLimit().getValue(),
-                getBarrierIntervalTimeoutLimit().getValue(), getEchoReplyTimeout().getValue());
-
-
-        return openflowPluginProvider;
+    public boolean canReuseInstance(AbstractOpenFlowProviderModule oldModule) {
+        return true;
     }
 
+    private static interface OpenFlowPluginProviderProxyInterface extends OpenFlowPluginProvider,
+            OpenFlowPluginExtensionRegistratorProvider {
+    }
 }
index e7448330741b378ee1124bf136fb4478f046f4bf..454ba6b5a6e2ab076c0f23ba55ce62f555a5c2d7 100644 (file)
@@ -8,6 +8,29 @@
 * Do not modify this file unless it is present under src/main directory
 */
 package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.config.openflow.plugin.impl.rev150327;
-public class OpenFlowProviderModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.config.openflow.plugin.impl.rev150327.AbstractOpenFlowProviderModuleFactory {
 
+import org.opendaylight.controller.config.api.DependencyResolver;
+import org.osgi.framework.BundleContext;
+
+/**
+ * @deprecated Replaced by blueprint wiring
+ */
+@Deprecated
+public class OpenFlowProviderModuleFactory extends AbstractOpenFlowProviderModuleFactory {
+    @Override
+    public OpenFlowProviderModule instantiateModule(String instanceName, DependencyResolver dependencyResolver,
+            OpenFlowProviderModule oldModule, AutoCloseable oldInstance, BundleContext bundleContext) {
+        OpenFlowProviderModule module = super.instantiateModule(instanceName, dependencyResolver, oldModule,
+                oldInstance, bundleContext);
+        module.setBundleContext(bundleContext);
+        return module;
+    }
+
+    @Override
+    public OpenFlowProviderModule instantiateModule(String instanceName, DependencyResolver dependencyResolver,
+            BundleContext bundleContext) {
+        OpenFlowProviderModule module = super.instantiateModule(instanceName, dependencyResolver, bundleContext);
+        module.setBundleContext(bundleContext);
+        return module;
+    }
 }
diff --git a/openflowplugin-impl/src/main/resources/org/opendaylight/blueprint/openflowplugin-impl.xml b/openflowplugin-impl/src/main/resources/org/opendaylight/blueprint/openflowplugin-impl.xml
new file mode 100644 (file)
index 0000000..20b907b
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0">
+
+  <bean id="ofPluginProviderFactory" class="org.opendaylight.openflowplugin.impl.OpenFlowPluginProviderFactoryImpl"/>
+
+  <service ref="ofPluginProviderFactory" interface="org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginProviderFactory"
+          odl:type="default"/>
+</blueprint>
\ No newline at end of file
index 63c28cdb6349a2d60513a7602fe119c8f39cfda4..1738fe3b130182afb60d6ce5b48383f3dff69df9 100644 (file)
@@ -11,12 +11,12 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyNoMoreInteractions;
 import static org.mockito.Mockito.when;
-
 import com.google.common.util.concurrent.ListenableFuture;
 import io.netty.util.HashedWheelTimer;
 import io.netty.util.TimerTask;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.TimeUnit;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -33,9 +33,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FeaturesReply;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.OfpRole;
 
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.TimeUnit;
-
 @RunWith(MockitoJUnitRunner.class)
 public class LifecycleConductorImplTest {
 
index 3b6f0086ea80fba8467ee7f80f4089ba72718d1b..c32fdc8aab54cbde124a6d2ebcc4ab98e5743007 100644 (file)
@@ -8,9 +8,11 @@
 
 package org.opendaylight.openflowplugin.impl;
 
-import static org.mockito.Mockito.*;
-import static org.junit.Assert.*;
-
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 import com.google.common.collect.Lists;
 import com.google.common.util.concurrent.Futures;
 import org.junit.After;
@@ -23,9 +25,9 @@ import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.NotificationService;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipListenerRegistration;
+import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
 import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.sm.control.rev150812.StatisticsManagerControlService;
 
index 0d61ca0c7bb3633579f80899ac5b4720fdd153bd..8b254137fb25234bca8bf1fa7920275845e00dc3 100644 (file)
@@ -17,17 +17,15 @@ import static org.mockito.Mockito.inOrder;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
-
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+import io.netty.util.TimerTask;
 import java.lang.reflect.Field;
 import java.math.BigInteger;
 import java.util.Collections;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.TimeUnit;
-
-import com.google.common.util.concurrent.Futures;
-import io.netty.util.TimerTask;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -68,7 +66,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.features.reply.PhyPortBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.OfpRole;
 
 @RunWith(MockitoJUnitRunner.class)
 public class DeviceManagerImplTest {
index fad7eb67927a5713a1d170aa4ea7a7c1b2166765..012d744252a87cd24ea40bc9b76bd0dc2cc460a4 100644 (file)
@@ -23,7 +23,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.features.reply.PhyPort;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.features.reply.PhyPortBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.OfpRole;
 
 /**
  * openflowplugin-impl
index cd3a89bc3836509af4441a2a8788753d7c51576b..296ea4ef6b4d4bb89a7321d65e9276d28645b105 100644 (file)
@@ -14,7 +14,6 @@ import com.google.common.util.concurrent.Futures;
 import io.netty.util.HashedWheelTimer;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Matchers;
index 854d4d3269ac9fdb7317802680025cc123f28189..f523828cb17d9c76dac987c531dbc1855e352cac 100644 (file)
@@ -7,11 +7,11 @@
  */
 package org.opendaylight.openflowplugin.impl.rpc;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
-import static org.junit.Assert.assertEquals;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -20,7 +20,6 @@ import org.mockito.Mockito;
 import org.mockito.runners.MockitoJUnitRunner;
 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceState;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
@@ -35,7 +34,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.N
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.RpcService;
-import java.util.concurrent.Semaphore;
 
 @RunWith(MockitoJUnitRunner.class)
 public class RpcContextImplTest {
index fe01124d6c94ab26c7fd4ccd7e398da7e40eccb3..b123dc1e1003ebc9c11bf71889916bf71006db0d 100644 (file)
@@ -7,7 +7,12 @@
  */
 package org.opendaylight.openflowplugin.impl.rpc;
 
+import static org.mockito.Mockito.atLeastOnce;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
 import com.google.common.base.VerifyException;
+import java.util.concurrent.ConcurrentMap;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -35,17 +40,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.N
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FeaturesReply;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.OfpRole;
 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 
-import java.util.concurrent.ConcurrentMap;
-
-import static org.mockito.Mockito.atLeastOnce;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
 
 @RunWith(MockitoJUnitRunner.class)
 public class RpcManagerImplTest {
index d39f9f558c368455ca6d57e659e2da567dbd2548..7b3d80006be936227c5f04bd46dfd577b3a96b4c 100644 (file)
@@ -1,6 +1,9 @@
 package org.opendaylight.openflowplugin.impl.services;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 import com.google.common.util.concurrent.ListenableFuture;
+import java.util.Collection;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.openflowjava.protocol.api.connection.DeviceRequestFailedException;
@@ -12,13 +15,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yangtools.yang.common.RpcError;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 
-import java.util.Collection;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-
 public class AbstractRequestCallbackTest {
 
     private static final Class<?> DUMMY_REQUEST_TYPE = String.class;
index cdafaca8fb7850203ff4d57537cb4efabc77121b..61675a940686952d5189923535ac6ce33f7d4e53 100644 (file)
@@ -1,13 +1,23 @@
 package org.opendaylight.openflowplugin.impl.services;
 
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 import org.junit.Test;
 import org.mockito.Matchers;
 import org.mockito.Mock;
 import org.opendaylight.openflowplugin.api.openflow.registry.group.DeviceGroupRegistry;
 import org.opendaylight.openflowplugin.api.openflow.rpc.listener.ItemLifecycleListener;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.*;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.group.update.OriginalGroup;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.group.update.OriginalGroupBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.group.update.UpdatedGroup;
@@ -16,13 +26,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.Group
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupKey;
 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
-
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
 
 public class SalGroupServiceImplTest extends ServiceMocking {
 
index faf1d13f50d601d7c4a4b56606a96f916919a2f9..e30adff06b49d672d06bfc04616fcd9196680f21 100644 (file)
@@ -4,30 +4,27 @@ import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
-
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
 import org.junit.Test;
 import org.mockito.Matchers;
 import org.mockito.Mock;
-import org.mockito.Mockito;
 import org.opendaylight.openflowplugin.api.openflow.registry.meter.DeviceMeterRegistry;
 import org.opendaylight.openflowplugin.api.openflow.rpc.listener.ItemLifecycleListener;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.*;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.OriginalMeter;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.OriginalMeterBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.UpdatedMeter;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.UpdatedMeterBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 
 public class SalMeterServiceImplTest extends ServiceMocking {
 
index d6edde72994d8f0a5e04ff2bc29c229e9926b131..d826926f539fa1b4fce479a28c2b779bb7d20d34 100644 (file)
@@ -1,11 +1,8 @@
 package org.opendaylight.openflowplugin.impl.services;
 
-import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
-
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
-import io.netty.util.HashedWheelTimer;
 import java.math.BigInteger;
 import java.util.List;
 import org.junit.Before;
index 46414d6c822c6315dee8f751c6a87a207e890bf5..b5087063d2d7da9b66ee32e2be73d976ccb055bb 100644 (file)
@@ -1,64 +1,54 @@
 package org.opendaylight.openflowplugin.impl.statistics;
 
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.Counter32;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.Counter64;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupDescStatsUpdated;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupStatisticsUpdated;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupStatisticsUpdatedBuilder;
-//import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.desc.stats.reply.GroupDescStats;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.*;
-
-
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.buckets.grouping.BucketsList;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group._case.multipart.reply.group.GroupStatsBuilder;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 import com.google.common.collect.Lists;
+import java.math.BigInteger;
+import java.util.Collections;
+import java.util.List;
 import org.junit.Test;
 import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.AggregateFlowStatisticsUpdate;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.AggregateFlowStatisticsUpdateBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdate;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdateBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionAware;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupDescStatsUpdated;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupStatisticsUpdated;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.desc.stats.reply.GroupDescStats;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Node;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FeaturesReply;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.buckets.grouping.BucketsList;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.MultipartReplyBody;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.*;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.aggregate._case.MultipartReplyAggregate;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregateCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyFlowCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupDescCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyPortStatsCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.aggregate._case.MultipartReplyAggregateBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.MultipartReplyFlowBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.multipart.reply.flow.FlowStats;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group._case.MultipartReplyGroupBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group._case.multipart.reply.group.GroupStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group._case.multipart.reply.group.GroupStatsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group._case.multipart.reply.group.group.stats.BucketStats;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.desc._case.MultipartReplyGroupDesc;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.desc._case.MultipartReplyGroupDescBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.desc._case.multipart.reply.group.desc.GroupDesc;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.desc._case.multipart.reply.group.desc.GroupDescBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.MultipartReplyPortStats;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.MultipartReplyPortStatsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.multipart.reply.port.stats.PortStatsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.NodeConnectorStatisticsUpdate;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.NodeConnectorStatisticsUpdateBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMap;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 
-import javax.sql.rowset.spi.TransactionalWriter;
-import java.math.BigInteger;
-import java.util.Collections;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
 public class SinglePurposeMultipartReplyTranslatorTest {
 
     private static final BigInteger DUMMY_DATAPATH_ID = new BigInteger("21");
index 22e5bc44dd914a36eb5117aba0caa099be3a5803..31e74a8b3fcda53964d772d6cd393f1b0b3d7085 100644 (file)
@@ -24,9 +24,7 @@ import java.util.concurrent.ExecutionException;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
-import org.mockito.Mockito;
 import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply;
 import org.opendaylight.yangtools.yang.common.RpcResult;
index f203cfbbc113236b86298b8d3fd77ea37249645b..b558ae343eea461fe50d7ad33129c8b68762e96b 100644 (file)
@@ -7,11 +7,9 @@
  */
 package org.opendaylight.openflowplugin.impl.statistics;
 
-import static org.mockito.Mockito.atLeastOnce;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
-
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
@@ -23,7 +21,6 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.Future;
-
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -55,7 +52,6 @@ import org.opendaylight.openflowplugin.api.openflow.registry.ItemLifeCycleRegist
 import org.opendaylight.openflowplugin.api.openflow.rpc.ItemLifeCycleSource;
 import org.opendaylight.openflowplugin.api.openflow.rpc.listener.ItemLifecycleListener;
 import org.opendaylight.openflowplugin.api.openflow.statistics.StatisticsContext;
-import org.opendaylight.openflowplugin.api.openflow.statistics.StatisticsManager;
 import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy;
 import org.opendaylight.openflowplugin.impl.registry.flow.DeviceFlowRegistryImpl;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
@@ -71,7 +67,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.sm.control.rev150812.GetStatisticsWorkModeOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.sm.control.rev150812.StatisticsManagerControlService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.sm.control.rev150812.StatisticsWorkMode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.role.service.rev150727.OfpRole;
 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
index d599b860b46b84dca3ddee04e168eeedce6e7f32..695a2e14a590ef7f770b175164143e35db5cedb6 100644 (file)
@@ -1,13 +1,10 @@
 package org.opendaylight.openflowplugin.impl.statistics.ofpspecific;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertTrue;
+import java.util.List;
 import org.junit.Test;
 import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy;
 
-import java.util.List;
-
-import static org.junit.Assert.assertTrue;
-
 
 public class MessageIntelligenceAgencyImplTest {
 
index a840fa9a4ae386fee01e45b4237938827ffd5cf6..bac6d1ebc571885026961161e8d97802f4e9091e 100644 (file)
@@ -15,7 +15,6 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mock;
 import org.mockito.runners.MockitoJUnitRunner;
-import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceState;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.get.aggregate.flow.statistics.from.flow.table._for.given.match.output.AggregatedFlowStatistics;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessageBuilder;
index 9245bbbe01a4ca8308bd7d8b53e5551fd80caf37..c376457b733add008b2c10a3478ef9b4b31831ff 100644 (file)
@@ -1,20 +1,15 @@
 package org.opendaylight.openflowplugin.impl.util;
 
 import com.google.common.collect.Lists;
+import java.math.BigInteger;
 import junit.framework.TestCase;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.mockito.Mock;
 import org.mockito.runners.MockitoJUnitRunner;
 import org.opendaylight.openflowplugin.api.OFConstants;
-import org.opendaylight.openflowplugin.api.openflow.device.DeviceState;
 import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PacketInReason;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableId;
@@ -24,18 +19,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.matc
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.InPortCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.in.port._case.InPortBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.MatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketIn;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessageBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.features.reply.PhyPort;
-import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
-
-import static org.mockito.Mockito.*;
-
-import java.math.BigInteger;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
 
 /**
  * Created by Tomas Slusny on 24.3.2016.
diff --git a/openflowplugin/.gitignore b/openflowplugin/.gitignore
deleted file mode 100644 (file)
index ea8c4bf..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/target
index 26d92ec8cdb1812b4007e6c5065c2111cbfcdf15..4f446b58a1349af89fcfabe17511b2d1ab21c92a 100644 (file)
@@ -23,8 +23,9 @@ import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipS
 import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipCandidateRegistration;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
 import org.opendaylight.openflowplugin.api.openflow.md.ModelDrivenSwitch;
+import org.opendaylight.openflowplugin.api.openflow.md.ModelDrivenSwitchRegistration;
 import org.opendaylight.openflowplugin.api.openflow.md.core.NotificationQueueWrapper;
-import org.opendaylight.yangtools.concepts.CompositeObjectRegistration;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.OpenflowPluginConfig;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;
@@ -40,7 +41,6 @@ import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.FutureCallback;
-import java.util.concurrent.ArrayBlockingQueue;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.CheckedFuture;
 import org.slf4j.Logger;
@@ -63,8 +63,11 @@ public class OfEntityManager implements TransactionChainListener{
 
     private final ListeningExecutorService pool;
 
-    public OfEntityManager( EntityOwnershipService entityOwnershipService ) {
+    private final OpenflowPluginConfig openflowPluginConfig;
+
+    public OfEntityManager(EntityOwnershipService entityOwnershipService, OpenflowPluginConfig ofPluginConfig) {
         this.entityOwnershipService = entityOwnershipService;
+        openflowPluginConfig = ofPluginConfig;
         ownershipListener = new OpenflowOwnershipListener(this);
         entsession = new ConcurrentHashMap<>();
         entRegistrationMap = new ConcurrentHashMap<>();
@@ -77,6 +80,19 @@ public class OfEntityManager implements TransactionChainListener{
         this.dataBroker = dbBroker;
     }
 
+    public void init(){
+        registerEntityOwnershipChangeListener();
+    }
+
+    public void registerEntityOwnershipChangeListener() {
+        if(entityOwnershipService!=null) {
+            if(LOG.isDebugEnabled()) {
+                LOG.debug("registerEntityOwnershipChangeListener: Registering entity ownership change listener for entitier of type {}", DEVICE_TYPE);
+            }
+        entityOwnershipService.registerListener(DEVICE_TYPE, ownershipListener);
+        }
+    }
+
     public void requestOpenflowEntityOwnership(final ModelDrivenSwitch ofSwitch,
                                                final SessionContext context,
                                                final NotificationQueueWrapper wrappedNotification,
@@ -84,9 +100,6 @@ public class OfEntityManager implements TransactionChainListener{
         MDSwitchMetaData entityMetaData =
                 new MDSwitchMetaData(ofSwitch,context,wrappedNotification,rpcProviderRegistry);
 
-        if (registeredListener.compareAndSet(false, true)) {
-            entityOwnershipService.registerListener(DEVICE_TYPE, ownershipListener);
-        }
         final Entity entity = new Entity(DEVICE_TYPE, ofSwitch.getNodeId().getValue());
         entsession.put(entity, entityMetaData);
 
@@ -243,6 +256,7 @@ public class OfEntityManager implements TransactionChainListener{
             final String targetSwitchDPId = sessionContext.getFeatures().getDatapathId().toString();
             RolePushTask task = new RolePushTask(newRole, sessionContext);
             ListenableFuture<Boolean> rolePushResult = pool.submit(task);
+
             final CheckedFuture<Boolean, RolePushException> rolePushResultChecked =
                 RoleUtil.makeCheckedRuleRequestFxResult(rolePushResult);
             Futures.addCallback(rolePushResult, new FutureCallback<Boolean>(){
@@ -250,7 +264,12 @@ public class OfEntityManager implements TransactionChainListener{
                 public void onSuccess(Boolean result){
                     LOG.info("onDeviceOwnershipChanged: Controller is successfully set as a " +
                             "MASTER controller for {}", targetSwitchDPId);
-                    entsession.get(entity).getOfSwitch().sendEmptyTableFeatureRequest();
+                    if(!openflowPluginConfig.skipTableFeatures()) {
+                        if(LOG.isDebugEnabled()){
+                            LOG.debug("Send table feature request for entity {}",entity.getId());
+                        }
+                        entsession.get(entity).getOfSwitch().sendEmptyTableFeatureRequest();
+                    }
                     sendNodeAddedNotification(entsession.get(entity));
 
                 }
@@ -329,13 +348,13 @@ public class OfEntityManager implements TransactionChainListener{
        // NOOP
     }
 
-    private void registerRoutedRPCForSwitch(MDSwitchMetaData entityMetadata) {
+    private static void registerRoutedRPCForSwitch(MDSwitchMetaData entityMetadata) {
         // Routed RPC registration is only done when *this* instance is owner of
         // the entity.
         if(entityMetadata.getOfSwitch().isEntityOwner()) {
             if (!entityMetadata.isRPCRegistrationDone.get()) {
                 entityMetadata.setIsRPCRegistrationDone(true);
-                CompositeObjectRegistration<ModelDrivenSwitch> registration =
+                ModelDrivenSwitchRegistration registration =
                         entityMetadata.getOfSwitch().register(entityMetadata.getRpcProviderRegistry());
 
                 entityMetadata.getContext().setProviderRegistration(registration);
@@ -349,9 +368,9 @@ public class OfEntityManager implements TransactionChainListener{
         }
     }
 
-    private void deregisterRoutedRPCForSwitch(MDSwitchMetaData entityMetadata) {
+    private static void deregisterRoutedRPCForSwitch(MDSwitchMetaData entityMetadata) {
 
-        CompositeObjectRegistration<ModelDrivenSwitch> registration = entityMetadata.getContext().getProviderRegistration();
+        ModelDrivenSwitchRegistration registration = entityMetadata.getContext().getProviderRegistration();
         if (null != registration) {
             registration.close();
             entityMetadata.getContext().setProviderRegistration(null);
@@ -361,7 +380,7 @@ public class OfEntityManager implements TransactionChainListener{
                 entityMetadata.getOfSwitch().getNodeId().getValue());
     }
 
-    private void sendNodeAddedNotification(MDSwitchMetaData entityMetadata) {
+    private static void sendNodeAddedNotification(MDSwitchMetaData entityMetadata) {
         //Node added notification need to be sent irrespective of whether
         // *this* instance is owner of the entity or not. Because yang notifications
         // are local, and we should maintain the behavior across the application.
index ad4bdbc3ffa3a62df25e9eea6eaecc934af13b4b..088bc74800e7238a973bf1d78b2ca5f6c2fad935 100644 (file)
@@ -7,9 +7,14 @@
  */
 package org.opendaylight.openflowplugin.openflow.md.core.sal;
 
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableList.Builder;
+import java.util.Collection;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.openflowplugin.api.openflow.md.AbstractModelDrivenSwitchRegistration;
 import org.opendaylight.openflowplugin.api.openflow.md.ModelDrivenSwitch;
+import org.opendaylight.openflowplugin.api.openflow.md.ModelDrivenSwitchRegistration;
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.OpendaylightFlowStatisticsService;
@@ -26,8 +31,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.SalP
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.OpendaylightPortStatisticsService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.OpendaylightQueueStatisticsService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.SalTableService;
-import org.opendaylight.yangtools.concepts.CompositeObjectRegistration;
-import org.opendaylight.yangtools.concepts.CompositeObjectRegistration.CompositeObjectRegistrationBuilder;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 /**
@@ -52,9 +55,8 @@ public abstract class AbstractModelDrivenSwitch implements ModelDrivenSwitch {
     }
 
     @Override
-    public CompositeObjectRegistration<ModelDrivenSwitch> register(RpcProviderRegistry rpcProviderRegistry) {
-        CompositeObjectRegistrationBuilder<ModelDrivenSwitch> builder = CompositeObjectRegistration
-                .<ModelDrivenSwitch> builderFor(this);
+    public ModelDrivenSwitchRegistration register(RpcProviderRegistry rpcProviderRegistry) {
+        final Builder<RoutedRpcRegistration<?>> builder = ImmutableList.builder();
 
         final RoutedRpcRegistration<SalFlowService> flowRegistration = rpcProviderRegistry.addRoutedRpcImplementation(SalFlowService.class, this);
         flowRegistration.registerPath(NodeContext.class, getIdentifier());
@@ -108,7 +110,15 @@ public abstract class AbstractModelDrivenSwitch implements ModelDrivenSwitch {
         queueStatisticsRegistration.registerPath(NodeContext.class, getIdentifier());
         builder.add(queueStatisticsRegistration);
 
-        return builder.build();
+        final Collection<RoutedRpcRegistration<?>> registrations = builder.build();
+        return new AbstractModelDrivenSwitchRegistration(this) {
+            @Override
+            protected void removeRegistration() {
+                for (RoutedRpcRegistration<?> r : registrations) {
+                    r.close();
+                }
+            }
+        };
     }
 
     /**
diff --git a/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/OpenflowPluginConfig.java b/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/OpenflowPluginConfig.java
new file mode 100644 (file)
index 0000000..1cda22e
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2016 Ericsson Systems, Inc. and others.  All rights reserved.
+ *
+ * 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
+ */
+
+package org.opendaylight.openflowplugin.openflow.md.core.sal;
+
+/**
+ * Created by eshuvka on 5/16/2016.
+ */
+public class OpenflowPluginConfig {
+
+    private final boolean skipTableFeatures;
+
+    private OpenflowPluginConfig (OpenflowPluginConfigBuilder builder){
+        skipTableFeatures = builder.skipTableFeatures();
+    }
+
+    public boolean skipTableFeatures(){
+        return skipTableFeatures;
+    }
+
+    public static OpenflowPluginConfigBuilder builder(){
+        return new OpenflowPluginConfigBuilder();
+    }
+
+    public static class OpenflowPluginConfigBuilder{
+        private boolean skipTableFeatures;
+
+        public boolean skipTableFeatures(){
+            return skipTableFeatures;
+        }
+
+        public void setSkipTableFeatures(boolean skip){
+            skipTableFeatures = skip;
+        }
+
+        public OpenflowPluginConfig build() {return new OpenflowPluginConfig(this);}
+    }
+}
index c151c04faa30ad41317fe1e2a9386d8145a56169..58754980b056e55a3ea56f20250fa08864831720 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal;
 import com.google.common.annotations.VisibleForTesting;
 import java.util.Collection;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
 import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
@@ -20,13 +21,12 @@ import org.opendaylight.openflowplugin.extension.api.OpenFlowPluginExtensionRegi
 import org.opendaylight.openflowplugin.extension.api.core.extension.ExtensionConverterManager;
 import org.opendaylight.openflowplugin.openflow.md.core.MDController;
 import org.opendaylight.openflowplugin.openflow.md.core.extension.ExtensionConverterManagerImpl;
+import org.opendaylight.openflowplugin.openflow.md.core.role.OfEntityManager;
 import org.opendaylight.openflowplugin.openflow.md.core.session.OFRoleManager;
 import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
-import org.opendaylight.openflowplugin.openflow.md.core.role.OfEntityManager;
 import org.opendaylight.openflowplugin.statistics.MessageSpyCounterImpl;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.common.config.impl.rev140326.OfpRole;
 import org.opendaylight.yangtools.yang.binding.DataContainer;
-import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -37,6 +37,8 @@ public class OpenflowPluginProvider implements AutoCloseable, OpenFlowPluginExte
 
     private static final Logger LOG = LoggerFactory.getLogger(OpenflowPluginProvider.class);
 
+    private static final boolean SKIP_TABLE_FEATURES = false;
+
     private Collection<SwitchConnectionProvider> switchConnectionProviders;
 
     private MDController mdController;
@@ -48,6 +50,7 @@ public class OpenflowPluginProvider implements AutoCloseable, OpenFlowPluginExte
     private ExtensionConverterManager extensionConverterManager;
 
     private OfpRole role;
+    private Boolean skipTableFeatures;
 
     private OFRoleManager roleManager;
     private OfEntityManager entManager;
@@ -56,6 +59,10 @@ public class OpenflowPluginProvider implements AutoCloseable, OpenFlowPluginExte
     private RpcProviderRegistry rpcRegistry;
     private EntityOwnershipService entityOwnershipService;
 
+    private OpenflowPluginConfig openflowPluginConfig;
+
+
+
     /**
      * Initialization of services and msgSpy counter
      */
@@ -63,8 +70,10 @@ public class OpenflowPluginProvider implements AutoCloseable, OpenFlowPluginExte
         messageCountProvider = new MessageSpyCounterImpl();
         extensionConverterManager = new ExtensionConverterManagerImpl();
         roleManager = new OFRoleManager(OFSessionUtil.getSessionManager());
-        entManager = new OfEntityManager(entityOwnershipService);
+        openflowPluginConfig = readConfig(skipTableFeatures);
+        entManager = new OfEntityManager(entityOwnershipService,getOpenflowPluginConfig());
         entManager.setDataBroker(dataBroker);
+        entManager.init();
 
         LOG.debug("dependencies gathered..");
         registrationManager = new SalRegistrationManager();
@@ -92,10 +101,16 @@ public class OpenflowPluginProvider implements AutoCloseable, OpenFlowPluginExte
     @Override
     public void close() {
         LOG.debug("close");
-        mdController.stop();
-        mdController = null;
-        registrationManager.close();
-        registrationManager = null;
+
+        if(mdController != null) {
+            mdController.stop();
+            mdController = null;
+        }
+
+        if(registrationManager != null) {
+            registrationManager.close();
+            registrationManager = null;
+        }
     }
 
     public MessageCountDumper getMessageCountDumper() {
@@ -144,6 +159,20 @@ public class OpenflowPluginProvider implements AutoCloseable, OpenFlowPluginExte
         }
     }
 
+    private OpenflowPluginConfig readConfig(Boolean skipTableFeatures){
+
+        final OpenflowPluginConfig.OpenflowPluginConfigBuilder openflowCfgBuilder = OpenflowPluginConfig.builder();
+
+        if(skipTableFeatures !=null){
+            openflowCfgBuilder.setSkipTableFeatures(skipTableFeatures.booleanValue());
+        } else{
+            LOG.warn("Could not load XML configuration file via ConfigSubsystem! Fallback to default config value(s)");
+            openflowCfgBuilder.setSkipTableFeatures(SKIP_TABLE_FEATURES);
+        }
+
+        return openflowCfgBuilder.build();
+    }
+
     public void setDataBroker(DataBroker dataBroker) {
         this.dataBroker = dataBroker;
     }
@@ -160,6 +189,15 @@ public class OpenflowPluginProvider implements AutoCloseable, OpenFlowPluginExte
         this.entityOwnershipService = entityOwnershipService;
     }
 
+    public void setSkipTableFeatures(Boolean skipTableFeatures) {
+        this.skipTableFeatures = skipTableFeatures;
+    }
+
+    @VisibleForTesting
+    public OpenflowPluginConfig getOpenflowPluginConfig() {
+        return openflowPluginConfig;
+    }
+
     @VisibleForTesting
     protected RpcProviderRegistry getRpcRegistry() {
         return rpcRegistry;
index 46463f1c7098076e337d2c8c5b20a4c60687a147..8b45aba2a2d6ab5980125e8da52e16d1ddc10e81 100644 (file)
@@ -17,15 +17,18 @@ import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
 import org.opendaylight.openflowplugin.api.openflow.md.ModelDrivenSwitch;
+import org.opendaylight.openflowplugin.api.openflow.md.ModelDrivenSwitchRegistration;
 import org.opendaylight.openflowplugin.api.openflow.md.core.NotificationQueueWrapper;
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionListener;
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionManager;
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SwitchSessionKeyOF;
+import org.opendaylight.openflowplugin.openflow.md.core.role.OfEntityManager;
 import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeUpdated;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeUpdatedBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
@@ -38,12 +41,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
-import org.opendaylight.yangtools.concepts.CompositeObjectRegistration;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.InstanceIdentifierBuilder;
-import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
-import org.opendaylight.openflowplugin.openflow.md.core.role.OfEntityManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -129,7 +129,7 @@ public class SalRegistrationManager implements SessionListener, AutoCloseable {
         unregOpenflowEntityOwnership(nodeId);
         NodeRemoved nodeRemoved = nodeRemoved(nodeRef);
 
-        CompositeObjectRegistration<ModelDrivenSwitch> registration = context.getProviderRegistration();
+        ModelDrivenSwitchRegistration registration = context.getProviderRegistration();
         if (null != registration) {
             registration.close();
             context.setProviderRegistration(null);
@@ -149,8 +149,9 @@ public class SalRegistrationManager implements SessionListener, AutoCloseable {
         FlowCapableNodeUpdatedBuilder builder2 = new FlowCapableNodeUpdatedBuilder();
         try {
             builder2.setIpAddress(getIpAddressOf(sw));
+            builder2.setPortNumber(getPortNumberOf(sw));
         } catch (Exception e) {
-            LOG.warn("IP address of the node {} cannot be obtained.", sw.getNodeId(), e);
+            LOG.warn("IP address/Port Number of the node {} cannot be obtained.", sw.getNodeId(), e);
         }
         builder2.setSwitchFeatures(swFeaturesUtil.buildSwitchFeatures(features));
         builder.addAugmentation(FlowCapableNodeUpdated.class, builder2.build());
@@ -184,6 +185,27 @@ public class SalRegistrationManager implements SessionListener, AutoCloseable {
         throw new IllegalArgumentException("Unsupported IP address type!");
     }
 
+    private static PortNumber getPortNumberOf(ModelDrivenSwitch sw) {
+        SessionContext sessionContext = sw.getSessionContext();
+
+        Preconditions.checkNotNull(sessionContext.getPrimaryConductor(),
+                "primary conductor must not be NULL -> " + sw.getNodeId());
+        Preconditions.checkNotNull(sessionContext.getPrimaryConductor().getConnectionAdapter(),
+                "connection adapter of primary conductor must not be NULL -> " + sw.getNodeId());
+        InetSocketAddress remoteAddress = sessionContext.getPrimaryConductor().getConnectionAdapter()
+                .getRemoteAddress();
+        if (remoteAddress == null) {
+            LOG.warn("Port Number of the node {} cannot be obtained. No connection with switch.", sw.getNodeId());
+            return null;
+        }
+        return resolvePortNumber(remoteAddress.getPort());
+    }
+
+    private static PortNumber resolvePortNumber(int port) {
+        PortNumber portNo = new PortNumber(port);
+        return portNo;
+    }
+
     private static NodeRemoved nodeRemoved(final NodeRef nodeRef) {
         NodeRemovedBuilder builder = new NodeRemovedBuilder();
         builder.setNodeRef(nodeRef);
index 899e1f66c5874d5fb61ff94b7d15fc758a7da6d9..803f41bd7dbda22fec30e2ab6bd7c2fb154e3774 100644 (file)
@@ -19,7 +19,7 @@ import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicLong;
 
-import org.opendaylight.openflowplugin.api.openflow.md.ModelDrivenSwitch;
+import org.opendaylight.openflowplugin.api.openflow.md.ModelDrivenSwitchRegistration;
 import org.opendaylight.openflowplugin.api.openflow.md.core.ConnectionConductor;
 import org.opendaylight.openflowplugin.api.openflow.md.core.NotificationEnqueuer;
 import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;
@@ -29,7 +29,6 @@ import org.opendaylight.openflowplugin.api.openflow.md.core.session.SwitchSessio
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ControllerRole;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortGrouping;
-import org.opendaylight.yangtools.concepts.CompositeObjectRegistration;
 
 /**
  * @author mirehak
@@ -46,7 +45,7 @@ public class SessionContextOFImpl implements SessionContext {
     private final AtomicLong xid;
     private final Map<Long, PortGrouping> physicalPorts;
     private final Map<Long, Boolean> portBandwidth;
-    private CompositeObjectRegistration<ModelDrivenSwitch> providerRegistration;
+    private ModelDrivenSwitchRegistration providerRegistration;
     private int seed;
     private ControllerRole roleOnDevice = ControllerRole.OFPCRROLEEQUAL;
 
@@ -212,13 +211,12 @@ public class SessionContextOFImpl implements SessionContext {
     }
 
     @Override
-    public void setProviderRegistration(
-            CompositeObjectRegistration<ModelDrivenSwitch> providerRegistration) {
-                this.providerRegistration = providerRegistration;
+    public void setProviderRegistration(ModelDrivenSwitchRegistration providerRegistration) {
+        this.providerRegistration = providerRegistration;
     }
 
     @Override
-    public CompositeObjectRegistration<ModelDrivenSwitch> getProviderRegistration() {
+    public ModelDrivenSwitchRegistration getProviderRegistration() {
         return providerRegistration;
     }
 
index e4cb1c0c85afb33e433384a4f49f9385acad6e2b..fa2b8a8177827c6b6f8f089e15bda6cb957cfeb7 100644 (file)
@@ -11,6 +11,8 @@ import com.google.common.base.Optional;
 import java.math.BigInteger;
 import java.util.List;
 import java.util.concurrent.ExecutionException;
+
+import com.google.common.base.Splitter;
 import org.apache.commons.lang3.StringUtils;
 import org.opendaylight.controller.md.sal.binding.api.ReadTransaction;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
@@ -37,6 +39,7 @@ import org.slf4j.LoggerFactory;
 
 public abstract class InventoryDataServiceUtil {
     public static final  String OF_URI_PREFIX = "openflow:";
+    private static final Splitter COLON_SPLITTER = Splitter.on(":");
     private static final Logger LOG = LoggerFactory.getLogger(InventoryDataServiceUtil.class);
 
     /*
@@ -132,13 +135,14 @@ public abstract class InventoryDataServiceUtil {
     }
 
     public static String portNoStringfromNodeConnectorID(final String ncID) {
-       String[] split = ncID.split(":");
+
+        List<String> splitStringList = COLON_SPLITTER.splitToList(ncID);
 
         // It can happen that token length will be just 1 i.e 2 or CONTROLLER
         // If the length is just one then this cannot be the new MD-SAL style node connector Id which
         // is of the form openflow:1:3.
 
-        return split[split.length - 1];
+        return splitStringList.get(splitStringList.size()-1);
     }
 
     public static Long portNumberfromNodeConnectorId(final OpenflowVersion ofVersion, final String ncId) {
index f335f11ebd1ea38859f3bedbbb3fae55d491bd2d..1189a2befafb5d4b160e255450c985ec67660de8 100644 (file)
@@ -9,10 +9,10 @@ package org.opendaylight.openflowplugin.openflow.md.util;
 
 import com.google.common.base.Function;
 import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.JdkFutureAdapters;
 import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.SettableFuture;
 import java.math.BigInteger;
 import java.util.concurrent.ExecutionException;
@@ -27,7 +27,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import java.util.Date;
 
 /**
  *
index 0c31a5821a0b1aa0c354ccede34f711f4a51a1b7..3fd3e045f0598fd8dacdf1b3e994475d9b9d6718 100644 (file)
@@ -9,16 +9,30 @@
 */
 package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.common.config.impl.rev140326;
 
-import com.google.common.base.MoreObjects;
-import javax.management.ObjectName;
+import java.util.Collection;
+import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
+import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
+import org.opendaylight.openflowplugin.api.openflow.statistics.MessageCountDumper;
+import org.opendaylight.openflowplugin.extension.api.ExtensionConverterRegistrator;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.OpenflowPluginProvider;
+import org.osgi.framework.BundleContext;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
-*
-*/
+ * @deprecated Replaced by blueprint wiring
+ */
+@Deprecated
 public final class ConfigurableOpenFlowProviderModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.common.config.impl.rev140326.AbstractConfigurableOpenFlowProviderModule {
 
-    private OpenflowPluginProvider pluginProvider;
+    private static final Logger LOG = LoggerFactory.getLogger(ConfigurableOpenFlowProviderModule.class);
+
+    private BundleContext bundleContext;
 
     /**
      * @param identifier module identifier
@@ -46,43 +60,84 @@ public final class ConfigurableOpenFlowProviderModule extends org.opendaylight.y
     }
 
     @Override
-    public java.lang.AutoCloseable createInstance() {
-        pluginProvider =  new OpenflowPluginProvider();
-        pluginProvider.setDataBroker(getDataBrokerDependency());
-        pluginProvider.setNotificationService(getNotificationServiceDependency());
-        pluginProvider.setRpcRegistry(getRpcRegistryDependency());
-        pluginProvider.setSwitchConnectionProviders(getOpenflowSwitchConnectionProviderDependency());
-        pluginProvider.setEntityOwnershipService(getOwnershipServiceDependency());
-        pluginProvider.setRole(getRole());
-        pluginProvider.initialization();
-        return pluginProvider;
+    public AutoCloseable createInstance() {
+        // The service is provided via blueprint so wait for and return it here for backwards compatibility.
+        String typeFilter = String.format("(type=%s)", getIdentifier().getInstanceName());
+        final WaitingServiceTracker<OpenflowPluginProvider> tracker = WaitingServiceTracker.create(
+                OpenflowPluginProvider.class, bundleContext, typeFilter);
+        final OpenflowPluginProvider actualService = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
+
+        return new OpenflowPluginProvider() {
+            @Override
+            public void close() {
+                // Don't close the actual service as its life cycle is controlled by blueprint.
+                tracker.close();
+            }
+
+            @Override
+            public void initialization() {
+                actualService.initialization();
+            }
+
+            @Override
+            public void setSwitchConnectionProviders(Collection<SwitchConnectionProvider> switchConnectionProvider) {
+                actualService.setSwitchConnectionProviders(switchConnectionProvider);
+            }
+
+            @Override
+            public MessageCountDumper getMessageCountDumper() {
+                return actualService.getMessageCountDumper();
+            }
+
+            @Override
+            public ExtensionConverterRegistrator getExtensionConverterRegistrator() {
+                return actualService.getExtensionConverterRegistrator();
+            }
+
+            @Override
+            public void setRole(OfpRole role) {
+                actualService.setRole(role);
+            }
+
+            @Override
+            public void setSkipTableFeatures(Boolean skipTableFeatures) {
+                actualService.setSkipTableFeatures(skipTableFeatures);
+            }
+
+            @Override
+            public void fireRoleChange(OfpRole newRole) {
+                actualService.fireRoleChange(newRole);
+            }
+
+            @Override
+            public void setDataBroker(DataBroker dataBroker) {
+                actualService.setDataBroker(dataBroker);
+            }
+
+            @Override
+            public void setNotificationService(NotificationProviderService notificationService) {
+                actualService.setNotificationService(notificationService);
+            }
+
+            @Override
+            public void setRpcRegistry(RpcProviderRegistry rpcRegistry) {
+                actualService.setRpcRegistry(rpcRegistry);
+            }
+
+            @Override
+            public void setEntityOwnershipService(EntityOwnershipService entityOwnershipService) {
+                actualService.setEntityOwnershipService(entityOwnershipService);
+            }
+        };
     }
 
-    @Override
-    public boolean canReuseInstance(
-            AbstractConfigurableOpenFlowProviderModule oldModule) {
-        // we can reuse if only the role field changed
-        boolean noChangeExceptRole = true;
-        noChangeExceptRole &= dependencyResolver.canReuseDependency(
-                getDataBroker(), dataBrokerJmxAttribute);
-        noChangeExceptRole &= dependencyResolver.canReuseDependency(
-                getNotificationService(), notificationServiceJmxAttribute);
-        noChangeExceptRole &= dependencyResolver.canReuseDependency(
-                getRpcRegistry(), rpcRegistryJmxAttribute);
-
-        for (ObjectName ofSwitchProvider : getOpenflowSwitchConnectionProvider()) {
-            noChangeExceptRole &= dependencyResolver.canReuseDependency(
-                    ofSwitchProvider, openflowSwitchConnectionProviderJmxAttribute);
-        }
-        return noChangeExceptRole;
+    public void setBundleContext(BundleContext bundleContext) {
+        this.bundleContext = bundleContext;
     }
 
     @Override
-    public AutoCloseable reuseInstance(AutoCloseable oldInstance) {
-        OpenflowPluginProvider recycled = (OpenflowPluginProvider) super.reuseInstance(oldInstance);
-        // change role if different
-        recycled.fireRoleChange(MoreObjects.firstNonNull(getRole(), getRole()));
-
-        return recycled;
+    public boolean canReuseInstance(AbstractConfigurableOpenFlowProviderModule oldModule) {
+        return true;
     }
+
 }
index dfa132202d5aa309c13967e47917d412d73bc21f..77f24c93ded99d08a5bc835d8072e529ae10212e 100644 (file)
@@ -9,11 +9,28 @@
 */
 package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.common.config.impl.rev140326;
 
+import org.opendaylight.controller.config.api.DependencyResolver;
+import org.osgi.framework.BundleContext;
 
 /**
- * the only purpose of this overwritings is to deliver bundleContext from osgi to module
+ * @deprecated Replaced by blueprint wiring
  */
-public class ConfigurableOpenFlowProviderModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.common.config.impl.rev140326.AbstractConfigurableOpenFlowProviderModuleFactory
-{
-    // nothing to override
+@Deprecated
+public class ConfigurableOpenFlowProviderModuleFactory extends AbstractConfigurableOpenFlowProviderModuleFactory {
+    @Override
+    public ConfigurableOpenFlowProviderModule instantiateModule(String instanceName, DependencyResolver dependencyResolver,
+            ConfigurableOpenFlowProviderModule oldModule, AutoCloseable oldInstance, BundleContext bundleContext) {
+        ConfigurableOpenFlowProviderModule module = super.instantiateModule(instanceName, dependencyResolver, oldModule,
+                oldInstance, bundleContext);
+        module.setBundleContext(bundleContext);
+        return module;
+    }
+
+    @Override
+    public ConfigurableOpenFlowProviderModule instantiateModule(String instanceName, DependencyResolver dependencyResolver,
+            BundleContext bundleContext) {
+        ConfigurableOpenFlowProviderModule module = super.instantiateModule(instanceName, dependencyResolver, bundleContext);
+        module.setBundleContext(bundleContext);
+        return module;
+    }
 }
index 0aa1eef2bc5b12c3eb2a3d3346fabe39a278fcf5..0f031c00e01d67ae2e2fd8e566739d35f1439f86 100644 (file)
@@ -107,6 +107,13 @@ module openflow-provider-impl {
                 type ofp-role;
                 default "NOCHANGE";
             }
+
+            leaf skip-table-features {
+                description "Ability to skip pulling and storing of large table features. These features are still
+                    available via rpc, so if use set it to true, it won't store table feature data in DataStore.";
+                type boolean;
+                default "false";
+            }
         }
 
         case msg-spy-service-impl {
index 2848c293ca34a812b3a44f9189213a1acc0a3d99..306638f2c1600892163f44af22c5245f720e4826 100644 (file)
@@ -16,5 +16,6 @@ module openflow-provider {
     identity openflow-provider{
         base config:service-type;
         config:java-class "org.opendaylight.openflowplugin.openflow.md.core.sal.OpenflowPluginProvider";
+        config:disable-osgi-service-registration;
     }
 }
\ No newline at end of file
index fd13ed0f6e4a250999547a86cf775ee50f236bee..3c21f40734afa74718a6753bfb51541f8baff54e 100644 (file)
@@ -26,6 +26,7 @@ import org.mockito.Mockito;
 import org.mockito.runners.MockitoJUnitRunner;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
+import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.openflowplugin.api.OFConstants;
@@ -154,8 +155,6 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
-import org.opendaylight.openflowplugin.openflow.md.core.role.OfEntityManager;
-import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
 
 /**
  * simple NPE smoke test
index 4bf473ac6c4d62b678750935a73f13660861660e..120107b547a497acf1392c50d58219ff9b039cf5 100644 (file)
@@ -10,11 +10,9 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListeningExecutorService;
 import java.math.BigInteger;
-import java.util.Collections;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -24,16 +22,20 @@ import org.mockito.Mock;
 import org.mockito.Mockito;
 import org.mockito.runners.MockitoJUnitRunner;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.api.openflow.md.AbstractModelDrivenSwitchRegistration;
 import org.opendaylight.openflowplugin.api.openflow.md.ModelDrivenSwitch;
+import org.opendaylight.openflowplugin.api.openflow.md.ModelDrivenSwitchRegistration;
 import org.opendaylight.openflowplugin.api.openflow.md.core.ConnectionConductor;
 import org.opendaylight.openflowplugin.api.openflow.md.core.NotificationEnqueuer;
 import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.IMessageDispatchService;
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SwitchSessionKeyOF;
+import org.opendaylight.openflowplugin.openflow.md.core.role.OfEntityManager;
 import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
 import org.opendaylight.openflowplugin.openflow.md.core.session.SessionContextOFImpl;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowOutput;
@@ -43,14 +45,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.N
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
-import org.opendaylight.yangtools.concepts.CompositeObjectRegistration;
-import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
-import org.opendaylight.openflowplugin.openflow.md.core.role.OfEntityManager;
-import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
 
 /**
  * Created by Martin Bobak mbobak@cisco.com on 8/26/14.
@@ -90,9 +88,7 @@ public class SalRegistrationManagerTest {
 
     private ModelDrivenSwitch mdSwitchOF13;
 
-
-    CompositeObjectRegistration<ModelDrivenSwitch> registration;
-
+    ModelDrivenSwitchRegistration registration;
 
     @Before
     public void setUp() {
@@ -106,9 +102,14 @@ public class SalRegistrationManagerTest {
         context.setFeatures(features);
         context.setNotificationEnqueuer(notificationEnqueuer);
 
-       OfEntityManager entManager = new OfEntityManager(entityOwnershipService);
+       OfEntityManager entManager = new OfEntityManager(entityOwnershipService,getConfig());
         mdSwitchOF13 = new ModelDrivenSwitchImpl(null, null, context);
-        registration = new CompositeObjectRegistration<>(mdSwitchOF13, Collections.<Registration>emptyList());
+        registration = new AbstractModelDrivenSwitchRegistration(mdSwitchOF13) {
+            @Override
+            protected void removeRegistration() {
+                // no-op
+            }
+        };
         context.setProviderRegistration(registration);
 
         UpdateFlowOutputBuilder updateFlowOutput = new UpdateFlowOutputBuilder();
@@ -193,5 +194,13 @@ public class SalRegistrationManagerTest {
         SwitchSessionKeyOF switchSessionKeyOF = new SwitchSessionKeyOF();
         salRegistrationManager.onSessionAdded(switchSessionKeyOF, context);
     }
+
+    public OpenflowPluginConfig getConfig(){
+        OpenflowPluginConfig.OpenflowPluginConfigBuilder cfgBuilder =
+                new OpenflowPluginConfig.OpenflowPluginConfigBuilder();
+        cfgBuilder.setSkipTableFeatures(true);
+        return cfgBuilder.build();
+
+    }
 }
 
index 383cd9c47b4f6355479023a7cbf94f4ec1fe1f18..6779145b00ffc9d45bdcf98c6be37d60b6b50023 100644 (file)
@@ -11,7 +11,6 @@ package org.opendaylight.openflowplugin.openflow.md.core.sal.convertor;
 import java.math.BigInteger;\r
 import java.util.ArrayList;\r
 import java.util.List;\r
-\r
 import org.junit.Assert;\r
 import org.junit.Test;\r
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
@@ -47,7 +46,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.WriteMetadataCase;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModCommand;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModFlags;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInput;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInputBuilder;\r
 \r
 /**\r
index 448fb45ac3d7849739636d116a00a926b0cc42c3..2db23adaaf1c8bc951cd491b1e9cef83d7d37a28 100644 (file)
@@ -24,7 +24,7 @@ import org.opendaylight.openflowjava.protocol.api.connection.ConnectionReadyList
 import org.opendaylight.openflowjava.protocol.api.connection.OutboundQueueHandler;
 import org.opendaylight.openflowjava.protocol.api.connection.OutboundQueueHandlerRegistration;
 import org.opendaylight.openflowplugin.api.OFConstants;
-import org.opendaylight.openflowplugin.api.openflow.md.ModelDrivenSwitch;
+import org.opendaylight.openflowplugin.api.openflow.md.ModelDrivenSwitchRegistration;
 import org.opendaylight.openflowplugin.api.openflow.md.core.ConnectionConductor;
 import org.opendaylight.openflowplugin.api.openflow.md.core.ErrorHandler;
 import org.opendaylight.openflowplugin.api.openflow.md.core.NotificationEnqueuer;
@@ -75,7 +75,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.TableModInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.TableModInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.SystemNotificationsListener;
-import org.opendaylight.yangtools.concepts.CompositeObjectRegistration;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.common.RpcError;
 import org.opendaylight.yangtools.yang.common.RpcResult;
@@ -323,7 +322,7 @@ class MockSessionContext implements SessionContext {
     private Map<SwitchConnectionDistinguisher, ConnectionConductor> map;
     private IMessageDispatchService messageService;
     private boolean isValid = true;
-    private CompositeObjectRegistration<ModelDrivenSwitch> registration;
+    private ModelDrivenSwitchRegistration registration;
     private int seed;
     private SwitchSessionKeyOF sessionKey;
 
@@ -450,13 +449,12 @@ class MockSessionContext implements SessionContext {
     }
 
     @Override
-    public CompositeObjectRegistration<ModelDrivenSwitch> getProviderRegistration() {
+    public ModelDrivenSwitchRegistration getProviderRegistration() {
         return registration;
     }
 
     @Override
-    public void setProviderRegistration(
-            CompositeObjectRegistration<ModelDrivenSwitch> registration) {
+    public void setProviderRegistration(ModelDrivenSwitchRegistration registration) {
         this.registration = registration;
     }
 
index f49db254ae36615c8155b76475298ddce8903d05..c1ff9bcfb83dd8d2416e344a36a419352bfac1a8 100644 (file)
@@ -10,8 +10,6 @@ package org.opendaylight.openflowplugin.openflow.md.core.session;
 import com.google.common.util.concurrent.Futures;
 import java.math.BigInteger;
 import java.util.Collections;
-import java.util.List;
-import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
index 1737475ab175dd8026bba2de52ded078bca4c2bd..6aff6c3f8324332ce145024bd9145b1a68a0e3b4 100644 (file)
@@ -194,13 +194,10 @@ public class OpenflowPortsUtilTest {
         portNumber = new PortNumberUni(OutputPortValues.FLOOD.toString());
         Assert.assertEquals("FLOOD", OpenflowPortsUtil.portNumberToString(portNumber));
 
-        try {
-            portNumber = new PortNumberUni((String) null);
-            Assert.fail("NPE was expected - due to value type");
-        } catch (Exception e) {
-            // expected
-            Assert.assertEquals(NullPointerException.class, e.getClass());
-        }
+
+        portNumber = new PortNumberUni((String) null);
+        Assert.assertNotNull(portNumber);
+
     }
 
 }
index 55d68f818b8a1bf8d15f87c72aa93cae3cb4d4d0..52abd0da085ef574423c37220d85046f4e0a9b76 100644 (file)
@@ -34,8 +34,8 @@
         <openflowjava.version>0.8.0-SNAPSHOT</openflowjava.version>
         <openflowplugin.version>0.3.0-SNAPSHOT</openflowplugin.version>
         <sal.api.version>0.11.0-SNAPSHOT</sal.api.version>
-        <jmxGeneratorPath>src/main/yang-gen-config</jmxGeneratorPath>
-        <salGeneratorPath>src/main/yang-gen-sal</salGeneratorPath>
+        <jmxGeneratorPath>target/generated-sources/config</jmxGeneratorPath>
+        <salGeneratorPath>target/generated-sources/sal</salGeneratorPath>
         <exi.nagasena.version>0000.0002.0053.0</exi.nagasena.version>
         <controller.distribution.version>0.4.0-SNAPSHOT</controller.distribution.version>
 
                                         <ignore/>
                                     </action>
                                 </pluginExecution>
-                                <pluginExecution>
-                                    <pluginExecutionFilter>
-                                        <groupId>org.opendaylight.yangtools</groupId>
-                                        <artifactId>yang-maven-plugin</artifactId>
-                                        <versionRange>[0.5,)</versionRange>
-                                        <goals>
-                                            <goal>generate-sources</goal>
-                                        </goals>
-                                    </pluginExecutionFilter>
-                                    <action>
-                                        <execute/>
-                                    </action>
-                                </pluginExecution>
                                 <pluginExecution>
                                     <pluginExecutionFilter>
                                         <groupId>org.codehaus.groovy.maven</groupId>
diff --git a/pom.xml b/pom.xml
index bfd108b2d85eaf8850f6af41f31bfe5d0d7d0f20..9547c0502c10ccc36d20c48361f5985d45aa51e0 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -31,6 +31,8 @@
       <module>extension</module>
       <module>distribution/karaf</module>
       <module>openflowplugin-controller-config</module>
+      <module>openflowplugin-blueprint-config-he</module>
+      <module>openflowplugin-blueprint-config</module>
       <!--
       <module>openflowplugin-it</module>
       -->
index 3a3e29ff4a3e10f88427aa14dd71e3f49a146c23..6bef0c1926ae316ffc1d8eb103cf8d60df327114 100644 (file)
@@ -13,14 +13,10 @@ import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
 import org.eclipse.osgi.framework.console.CommandInterpreter;
 import org.eclipse.osgi.framework.console.CommandProvider;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
-import org.opendaylight.controller.md.sal.common.api.data.DataModification;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
@@ -77,7 +73,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.N
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.osgi.framework.BundleContext;
 
 public class OpenflowpluginGroupTestCommandProvider implements CommandProvider {
index 3308b94b2199512327d18ba9d49309f7a99667b3..fb75736a36a0a4ac67ac9005dc97dd05f8771dc8 100644 (file)
@@ -24,8 +24,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
-import org.opendaylight.yangtools.concepts.CompositeObjectRegistration;
-import org.opendaylight.yangtools.concepts.CompositeObjectRegistration.CompositeObjectRegistrationBuilder;
+import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
+import org.opendaylight.yangtools.concepts.ObjectRegistration;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.InstanceIdentifierBuilder;
 import org.opendaylight.yangtools.yang.common.RpcResult;
@@ -147,13 +147,10 @@ public class OpenflowpluginGroupTestServiceProvider implements AutoCloseable,
 
     /**
      * @param ctx
-     * @return {@link CompositeObjectRegistrationBuilder #toInstance()}
+     * @return {@link ObjectRegistration}
      */
-    public CompositeObjectRegistration<OpenflowpluginGroupTestServiceProvider> register(
+    public ObjectRegistration<OpenflowpluginGroupTestServiceProvider> register(
             final ProviderContext ctx) {
-        CompositeObjectRegistrationBuilder<OpenflowpluginGroupTestServiceProvider> builder = CompositeObjectRegistration
-                .<OpenflowpluginGroupTestServiceProvider> builderFor(this);
-
         RoutedRpcRegistration<SalGroupService> addRoutedRpcImplementation = ctx
                 .<SalGroupService> addRoutedRpcImplementation(
                         SalGroupService.class, this);
@@ -171,8 +168,12 @@ public class OpenflowpluginGroupTestServiceProvider implements AutoCloseable,
         groupRegistration.registerPath(NodeContext.class, instance);
         RoutedRpcRegistration<SalGroupService> groupRegistration1 = this
                 .getGroupRegistration();
-        builder.add(groupRegistration1);
-        return builder.build();
+        return new AbstractObjectRegistration<OpenflowpluginGroupTestServiceProvider>(this) {
+            @Override
+            protected void removeRegistration() {
+                groupRegistration1.close();
+            }
+        };
     }
 
 }
index a560f657c7ee27aa09c92428fb158c94e31e0faf..b4b5438efaf206b7916c92120961529c66557597 100644 (file)
@@ -25,8 +25,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.Rem
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.SalMeterService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterOutput;
-import org.opendaylight.yangtools.concepts.CompositeObjectRegistration;
-import org.opendaylight.yangtools.concepts.CompositeObjectRegistration.CompositeObjectRegistrationBuilder;
+import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
+import org.opendaylight.yangtools.concepts.ObjectRegistration;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.InstanceIdentifierBuilder;
 import org.opendaylight.yangtools.yang.common.RpcResult;
@@ -162,12 +162,10 @@ public class OpenflowpluginMeterTestServiceProvider implements AutoCloseable,
 
     /**
      * @param ctx
-     * @return {@link CompositeObjectRegistrationBuilder #toInstance()}
+     * @return {@link ObjectRegistration}
      */
-    public CompositeObjectRegistration<OpenflowpluginMeterTestServiceProvider> register(
+    public ObjectRegistration<OpenflowpluginMeterTestServiceProvider> register(
             final ProviderContext ctx) {
-        CompositeObjectRegistrationBuilder<OpenflowpluginMeterTestServiceProvider> builder = CompositeObjectRegistration
-                .<OpenflowpluginMeterTestServiceProvider> builderFor(this);
 
         RoutedRpcRegistration<SalMeterService> addRoutedRpcImplementation = ctx
                 .<SalMeterService> addRoutedRpcImplementation(
@@ -191,9 +189,13 @@ public class OpenflowpluginMeterTestServiceProvider implements AutoCloseable,
         RoutedRpcRegistration<SalMeterService> meterRegistration1 = this
                 .getMeterRegistration();
 
-        builder.add(meterRegistration1);
+        return new AbstractObjectRegistration<OpenflowpluginMeterTestServiceProvider>(this) {
 
-        return builder.build();
+            @Override
+            protected void removeRegistration() {
+                meterRegistration1.close();
+            }
+        };
     }
 
 }
index b73ecc76282fb367ec855c05cabe60e47c305a83..f88053808dd32dc4ad769cd28da9a910e7f0e328 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.openflowplugin.test;
 
 import java.util.Iterator;
 import java.util.List;
-
 import org.eclipse.osgi.framework.console.CommandInterpreter;
 import org.eclipse.osgi.framework.console.CommandProvider;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
@@ -44,8 +43,6 @@ import org.osgi.framework.BundleContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.Preconditions;
-
 public class OpenflowpluginStatsTestCommandProvider implements CommandProvider {
 
  private static final Logger LOG = LoggerFactory
index 261a29cba84971be666fea8b31dc847cca1acbf3..9a0e554b6c746be8569fe917035ec0540afa0340 100644 (file)
@@ -20,8 +20,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.N
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.SalTableService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableOutput;
-import org.opendaylight.yangtools.concepts.CompositeObjectRegistration;
-import org.opendaylight.yangtools.concepts.CompositeObjectRegistration.CompositeObjectRegistrationBuilder;
+import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
+import org.opendaylight.yangtools.concepts.ObjectRegistration;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.InstanceIdentifierBuilder;
 import org.opendaylight.yangtools.yang.common.RpcResult;
@@ -110,13 +110,10 @@ public class OpenflowpluginTableFeaturesTestServiceProvider implements
 
     /**
      * @param ctx
-     * @return {@link CompositeObjectRegistrationBuilder #toInstance()}
+     * @return {@link ObjectRegistration}
      */
-    public CompositeObjectRegistration<OpenflowpluginTableFeaturesTestServiceProvider> register(
+    public ObjectRegistration<OpenflowpluginTableFeaturesTestServiceProvider> register(
             final ProviderContext ctx) {
-        CompositeObjectRegistrationBuilder<OpenflowpluginTableFeaturesTestServiceProvider> builder = CompositeObjectRegistration
-                .<OpenflowpluginTableFeaturesTestServiceProvider> builderFor(this);
-
         RoutedRpcRegistration<SalTableService> addRoutedRpcImplementation = ctx
                 .<SalTableService> addRoutedRpcImplementation(
                         SalTableService.class, this);
@@ -139,9 +136,12 @@ public class OpenflowpluginTableFeaturesTestServiceProvider implements
         RoutedRpcRegistration<SalTableService> tableRegistration1 = this
                 .getTableRegistration();
 
-        builder.add(tableRegistration1);
-
-        return builder.build();
+        return new AbstractObjectRegistration<OpenflowpluginTableFeaturesTestServiceProvider>(this) {
+            @Override
+            protected void removeRegistration() {
+                tableRegistration1.close();
+            }
+        };
     }
 
 }
index ec67835b82f8cc184188086fb601c415ed959000..1464509c06d7af4566394f1f4eb83b9b8dcf87e6 100644 (file)
@@ -25,8 +25,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
-import org.opendaylight.yangtools.concepts.CompositeObjectRegistration;
-import org.opendaylight.yangtools.concepts.CompositeObjectRegistration.CompositeObjectRegistrationBuilder;
+import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
+import org.opendaylight.yangtools.concepts.ObjectRegistration;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.InstanceIdentifierBuilder;
 import org.opendaylight.yangtools.yang.common.RpcResult;
@@ -166,13 +166,10 @@ public class OpenflowpluginTestServiceProvider implements AutoCloseable,
 
     /**
      * @param ctx
-     * @return {@link CompositeObjectRegistrationBuilder #toInstance()}
+     * @return {@link ObjectRegistration}
      */
-    public CompositeObjectRegistration<OpenflowpluginTestServiceProvider> register(
+    public ObjectRegistration<OpenflowpluginTestServiceProvider> register(
             final ProviderContext ctx) {
-        CompositeObjectRegistrationBuilder<OpenflowpluginTestServiceProvider> builder = CompositeObjectRegistration
-                .<OpenflowpluginTestServiceProvider> builderFor(this);
-
         RoutedRpcRegistration<SalFlowService> addRoutedRpcImplementation = ctx
                 .<SalFlowService> addRoutedRpcImplementation(
                         SalFlowService.class, this);
@@ -194,8 +191,11 @@ public class OpenflowpluginTestServiceProvider implements AutoCloseable,
 
         RoutedRpcRegistration<SalFlowService> flowRegistration2 = getFlowRegistration();
 
-        builder.add(flowRegistration2);
-
-        return builder.build();
+        return new AbstractObjectRegistration<OpenflowpluginTestServiceProvider>(this) {
+            @Override
+            protected void removeRegistration() {
+                flowRegistration2.close();
+            }
+        };
     }
 }
diff --git a/test-scripts/.gitignore b/test-scripts/.gitignore
deleted file mode 100644 (file)
index 129a6a7..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-*.pyc
-/.pydevproject
-*.log
-.tox/