Bug: 6930 Notiifcation-suppliers was broken 66/46866/10
authorGauravBhagwani <gaurav.bhagwani@ericsson.com>
Thu, 13 Oct 2016 08:09:34 +0000 (13:39 +0530)
committerShuva Jyoti Kar <shuva.jyoti.kar@ericsson.com>
Fri, 21 Oct 2016 09:17:18 +0000 (09:17 +0000)
Review contains changes required for making notification-supplier as per
Blueprint Injection method
- Removed Config Subsystem parts - Yang, Config XML, Modules/ModuleFactory
- Added Blueprint XML for notification-supplier
- Removed Config Dependency from features Pom
- Removed references to Config XML

Change-Id: Ifbdcb21140903a668ad0b8dd6e2df666b7e3e37f
Signed-off-by: GauravBhagwani <gaurav.bhagwani@ericsson.com>
applications/notification-supplier/pom.xml
applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/NotificationProvider.java
applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/NotificationProviderImpl.java [deleted file]
applications/notification-supplier/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/openflow/applications/notification/supplier/rev150820/NotifModule.java [deleted file]
applications/notification-supplier/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/openflow/applications/notification/supplier/rev150820/NotifModuleFactory.java [deleted file]
applications/notification-supplier/src/main/resources/initial/73-notification-supplier.xml [deleted file]
applications/notification-supplier/src/main/resources/org/opendaylight/blueprint/notification-supplier.xml [new file with mode: 0644]
applications/notification-supplier/src/main/yang/notification-supplier.yang [deleted file]
applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/NotificationProviderTest.java [moved from applications/notification-supplier/src/test/java/org/opendaylight/openflowplugin/applications/notification/supplier/NotificationProviderImplTest.java with 73% similarity]
features/pom.xml
features/src/main/features/features.xml

index bb05f4e414a4ef4641838cc66e0a2b7779b710a3..9f2ece2e9b8589b6a9c1ba0d1435d9a06a82d767 100644 (file)
             <groupId>org.opendaylight.openflowplugin.model</groupId>
             <artifactId>model-flow-base</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.opendaylight.controller</groupId>
-            <artifactId>config-api</artifactId>
-        </dependency>
-
         <dependency>
             <groupId>org.opendaylight.openflowplugin</groupId>
             <artifactId>openflowplugin-common</artifactId>
                 <groupId>org.opendaylight.yangtools</groupId>
                 <artifactId>yang-maven-plugin</artifactId>
             </plugin>
-
-            <plugin>
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>build-helper-maven-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>attach-artifacts</id>
-                        <goals>
-                            <goal>attach-artifact</goal>
-                        </goals>
-                        <phase>package</phase>
-                        <configuration>
-                            <artifacts>
-                                <artifact>
-                                    <file>${project.build.directory}/classes/initial/73-notification-supplier.xml</file>
-                                    <type>xml</type>
-                                    <classifier>config</classifier>
-                                </artifact>
-                            </artifacts>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
         </plugins>
     </build>
 </project>
index 7b650cdaef4a3bdb280603803ae3ef28e287aff9..9accc250e3a15e9c3fd630254b711249b3da7ae4 100644 (file)
 
 package org.opendaylight.openflowplugin.applications.notification.supplier;
 
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Preconditions;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.openflowplugin.applications.notification.supplier.impl.NodeConnectorNotificationSupplierImpl;
+import org.opendaylight.openflowplugin.applications.notification.supplier.impl.NodeNotificationSupplierImpl;
+import org.opendaylight.openflowplugin.applications.notification.supplier.impl.item.FlowNotificationSupplierImpl;
+import org.opendaylight.openflowplugin.applications.notification.supplier.impl.item.GroupNotificationSupplierImpl;
+import org.opendaylight.openflowplugin.applications.notification.supplier.impl.item.MeterNotificationSupplierImpl;
+import org.opendaylight.openflowplugin.applications.notification.supplier.impl.item.stat.FlowStatNotificationSupplierImpl;
+import org.opendaylight.openflowplugin.applications.notification.supplier.impl.item.stat.FlowTableStatNotificationSupplierImpl;
+import org.opendaylight.openflowplugin.applications.notification.supplier.impl.item.stat.GroupStatNotificationSupplierImpl;
+import org.opendaylight.openflowplugin.applications.notification.supplier.impl.item.stat.MeterStatNotificationSupplierImpl;
+import org.opendaylight.openflowplugin.applications.notification.supplier.impl.item.stat.NodeConnectorStatNotificationSupplierImpl;
+import org.opendaylight.openflowplugin.applications.notification.supplier.impl.item.stat.QueueStatNotificationSupplierImpl;
+import org.opendaylight.openflowplugin.applications.notification.supplier.tools.NotificationProviderConfig;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowAdded;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemoved;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowUpdated;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdate;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.statistics.FlowStatistics;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.FlowTableStatisticsUpdate;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.statistics.FlowTableStatistics;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.GroupAdded;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.GroupRemoved;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.GroupUpdated;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupStatisticsUpdated;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.group.statistics.GroupStatistics;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRemoved;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorUpdated;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRemoved;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeUpdated;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterAdded;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterRemoved;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterUpdated;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.MeterStatisticsUpdated;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.nodes.node.meter.MeterStatistics;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.NodeConnectorStatisticsUpdate;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.flow.capable.node.connector.statistics.FlowCapableNodeConnectorStatistics;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.FlowCapableNodeConnectorQueueStatisticsData;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.QueueStatisticsUpdate;
+
 /**
- * Project module provider interface representation
+ * Provider Implementation
  */
-public interface NotificationProvider extends AutoCloseable {
+public class NotificationProvider implements AutoCloseable {
+
+    private final DataBroker db;
+    private final NotificationProviderConfig config;
+    private final NotificationProviderService nps;
+
+    /* Supplier List property help for easy close method implementation and testing */
+    private List<NotificationSupplierDefinition<?>> supplierList;
+    private NotificationSupplierForItemRoot<FlowCapableNode, NodeUpdated, NodeRemoved> nodeSupp;
+    private NotificationSupplierForItemRoot<FlowCapableNodeConnector, NodeConnectorUpdated, NodeConnectorRemoved> connectorSupp;
+    private NotificationSupplierForItem<Flow, FlowAdded, FlowUpdated, FlowRemoved> flowSupp;
+    private NotificationSupplierForItem<Meter, MeterAdded, MeterUpdated, MeterRemoved> meterSupp;
+    private NotificationSupplierForItem<Group, GroupAdded, GroupUpdated, GroupRemoved> groupSupp;
+    private NotificationSupplierForItemStat<FlowCapableNodeConnectorStatistics, NodeConnectorStatisticsUpdate> connectorStatSupp;
+    private NotificationSupplierForItemStat<FlowStatistics, FlowsStatisticsUpdate> flowStatSupp;
+    private NotificationSupplierForItemStat<FlowTableStatistics, FlowTableStatisticsUpdate> flowTableStatSupp;
+    private NotificationSupplierForItemStat<MeterStatistics, MeterStatisticsUpdated> meterStatSupp;
+    private NotificationSupplierForItemStat<GroupStatistics, GroupStatisticsUpdated> groupStatSupp;
+    private NotificationSupplierForItemStat<FlowCapableNodeConnectorQueueStatisticsData, QueueStatisticsUpdate> queueStatSupp;
 
     /**
-     * Method is responsible for initialization and registration all Notification Suppliers
-     * followed by settings from ConfigSubsystem
+     * Provider constructor set all needed final parameters
+     * @param nps - notifProviderService
+     * @param db - dataBroker
+     * @param flowSupp - Flow Support Flag
+     * @param meterSupp - Meter Support Flag
+     * @param groupSupp - Group Support Flag
+     * @param connectorStatSupp - Connector Stat Support Flag
+     * @param flowStatSupp - Flow Stat Support Flag
+     * @param flowTableStatSupp - Flow Table Stat Support Flag
+     * @param meterStatSupp - Meter Stat Support Flag
+     * @param groupStatSupp - Group Stat Support Flag
+     * @param queueStatSupp - Queue Stat Support Flag
      */
-    void start();
+    public NotificationProvider(final NotificationProviderService nps, final DataBroker db,
+                                boolean flowSupp, boolean meterSupp, boolean groupSupp,
+                                boolean connectorStatSupp, boolean flowStatSupp, boolean flowTableStatSupp,
+                                boolean meterStatSupp, boolean groupStatSupp, boolean queueStatSupp) {
+        this.nps = Preconditions.checkNotNull(nps);
+        this.db = Preconditions.checkNotNull(db);
+        this.config = initializeNotificationProviderConfig(flowSupp, meterSupp, groupSupp, connectorStatSupp, flowStatSupp,
+                flowTableStatSupp, meterStatSupp, groupStatSupp, queueStatSupp);
+    }
+
+    /**
+     * Method to initialize NotificationProviderConfig
+     */
+    private NotificationProviderConfig initializeNotificationProviderConfig(boolean flowSupp, boolean meterSupp, boolean groupSupp,
+                                                      boolean connectorStatSupp, boolean flowStatSupp, boolean flowTableStatSupp,
+                                                      boolean meterStatSupp, boolean groupStatSupp, boolean queueStatSupp){
+        NotificationProviderConfig.NotificationProviderConfigBuilder  notif =
+                new NotificationProviderConfig.NotificationProviderConfigBuilder();
+        notif.setFlowSupport(flowSupp);
+        notif.setMeterSupport(meterSupp);
+        notif.setGroupSupport(groupSupp);
+        notif.setNodeConnectorStatSupport(connectorStatSupp);
+        notif.setFlowStatSupport(flowStatSupp);
+        notif.setFlowTableStatSupport(flowTableStatSupp);
+        notif.setMeterStatSupport(meterStatSupp);
+        notif.setGroupStatSupport(groupStatSupp);
+        notif.setQueueStatSupport(queueStatSupp);
+        return notif.build();
+    }
+
+    public void start() {
+        nodeSupp = new NodeNotificationSupplierImpl(nps, db);
+        connectorSupp = new NodeConnectorNotificationSupplierImpl(nps, db);
+        flowSupp = config.isFlowSupport() ? new FlowNotificationSupplierImpl(nps, db) : null;
+        meterSupp = config.isMeterSupport() ? new MeterNotificationSupplierImpl(nps, db) : null;
+        groupSupp = config.isGroupSupport() ? new GroupNotificationSupplierImpl(nps, db) : null;
+        connectorStatSupp = config.isNodeConnectorStatSupport() ? new NodeConnectorStatNotificationSupplierImpl(nps, db) : null;
+        flowStatSupp = config.isFlowStatSupport() ? new FlowStatNotificationSupplierImpl(nps, db) : null;
+        flowTableStatSupp = config.isFlowTableStatSupport() ? new FlowTableStatNotificationSupplierImpl(nps, db) : null;
+        meterStatSupp = config.isMeterStatSupport() ? new MeterStatNotificationSupplierImpl(nps, db) : null;
+        groupStatSupp = config.isGroupStatSupport() ? new GroupStatNotificationSupplierImpl(nps, db) : null;
+        queueStatSupp = config.isQueueStatSupport() ? new QueueStatNotificationSupplierImpl(nps, db) : null;
+
+        supplierList = new ArrayList<>(Arrays.asList(nodeSupp, connectorSupp, flowSupp, meterSupp, groupSupp,
+                connectorStatSupp, flowStatSupp, flowTableStatSupp, meterStatSupp, groupStatSupp, queueStatSupp));
+    }
+
+    @Override
+    public void close() throws Exception {
+        for (NotificationSupplierDefinition<?> supplier : supplierList) {
+            if (supplier != null) {
+                supplier.close();
+                supplier = null;
+            }
+        }
+    }
 
+    @VisibleForTesting
+    List<NotificationSupplierDefinition<?>> getSupplierList() {
+        return supplierList;
+    }
 }
 
diff --git a/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/NotificationProviderImpl.java b/applications/notification-supplier/src/main/java/org/opendaylight/openflowplugin/applications/notification/supplier/NotificationProviderImpl.java
deleted file mode 100644 (file)
index de2a34f..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) 2015 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.applications.notification.supplier;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import org.opendaylight.controller.md.sal.binding.api.DataBroker;
-import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
-import org.opendaylight.openflowplugin.applications.notification.supplier.impl.NodeConnectorNotificationSupplierImpl;
-import org.opendaylight.openflowplugin.applications.notification.supplier.impl.NodeNotificationSupplierImpl;
-import org.opendaylight.openflowplugin.applications.notification.supplier.impl.item.FlowNotificationSupplierImpl;
-import org.opendaylight.openflowplugin.applications.notification.supplier.impl.item.GroupNotificationSupplierImpl;
-import org.opendaylight.openflowplugin.applications.notification.supplier.impl.item.MeterNotificationSupplierImpl;
-import org.opendaylight.openflowplugin.applications.notification.supplier.impl.item.stat.FlowStatNotificationSupplierImpl;
-import org.opendaylight.openflowplugin.applications.notification.supplier.impl.item.stat.FlowTableStatNotificationSupplierImpl;
-import org.opendaylight.openflowplugin.applications.notification.supplier.impl.item.stat.GroupStatNotificationSupplierImpl;
-import org.opendaylight.openflowplugin.applications.notification.supplier.impl.item.stat.MeterStatNotificationSupplierImpl;
-import org.opendaylight.openflowplugin.applications.notification.supplier.impl.item.stat.NodeConnectorStatNotificationSupplierImpl;
-import org.opendaylight.openflowplugin.applications.notification.supplier.impl.item.stat.QueueStatNotificationSupplierImpl;
-import org.opendaylight.openflowplugin.applications.notification.supplier.tools.NotificationProviderConfig;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowAdded;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemoved;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowUpdated;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdate;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.statistics.FlowStatistics;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.FlowTableStatisticsUpdate;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.statistics.FlowTableStatistics;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.GroupAdded;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.GroupRemoved;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.GroupUpdated;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupStatisticsUpdated;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.group.statistics.GroupStatistics;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRemoved;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorUpdated;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRemoved;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeUpdated;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterAdded;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterRemoved;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterUpdated;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.MeterStatisticsUpdated;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.nodes.node.meter.MeterStatistics;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.NodeConnectorStatisticsUpdate;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.flow.capable.node.connector.statistics.FlowCapableNodeConnectorStatistics;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.FlowCapableNodeConnectorQueueStatisticsData;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.QueueStatisticsUpdate;
-
-/**
- * Provider Implementation
- */
-public class NotificationProviderImpl implements NotificationProvider {
-
-    private final DataBroker db;
-    private final NotificationProviderConfig config;
-    private final NotificationProviderService nps;
-
-    /* Supplier List property help for easy close method implementation and testing */
-    private List<NotificationSupplierDefinition<?>> supplierList;
-    private NotificationSupplierForItemRoot<FlowCapableNode, NodeUpdated, NodeRemoved> nodeSupp;
-    private NotificationSupplierForItemRoot<FlowCapableNodeConnector, NodeConnectorUpdated, NodeConnectorRemoved> connectorSupp;
-    private NotificationSupplierForItem<Flow, FlowAdded, FlowUpdated, FlowRemoved> flowSupp;
-    private NotificationSupplierForItem<Meter, MeterAdded, MeterUpdated, MeterRemoved> meterSupp;
-    private NotificationSupplierForItem<Group, GroupAdded, GroupUpdated, GroupRemoved> groupSupp;
-    private NotificationSupplierForItemStat<FlowCapableNodeConnectorStatistics, NodeConnectorStatisticsUpdate> connectorStatSupp;
-    private NotificationSupplierForItemStat<FlowStatistics, FlowsStatisticsUpdate> flowStatSupp;
-    private NotificationSupplierForItemStat<FlowTableStatistics, FlowTableStatisticsUpdate> flowTableStatSupp;
-    private NotificationSupplierForItemStat<MeterStatistics, MeterStatisticsUpdated> meterStatSupp;
-    private NotificationSupplierForItemStat<GroupStatistics, GroupStatisticsUpdated> groupStatSupp;
-    private NotificationSupplierForItemStat<FlowCapableNodeConnectorQueueStatisticsData, QueueStatisticsUpdate> queueStatSupp;
-
-    /**
-     * Provider constructor set all needed final parameters
-     *
-     * @param config - Configuration Object
-     * @param nps - notifProviderService
-     * @param db - dataBroker
-     */
-    public NotificationProviderImpl(final NotificationProviderConfig config,
-            final NotificationProviderService nps, final DataBroker db) {
-        this.config = Preconditions.checkNotNull(config);
-        this.db = Preconditions.checkNotNull(db);
-        this.nps = Preconditions.checkNotNull(nps);
-    }
-
-    @Override
-    public void start() {
-        nodeSupp = new NodeNotificationSupplierImpl(nps, db);
-        connectorSupp = new NodeConnectorNotificationSupplierImpl(nps, db);
-        flowSupp = config.isFlowSupport() ? new FlowNotificationSupplierImpl(nps, db) : null;
-        meterSupp = config.isMeterSupport() ? new MeterNotificationSupplierImpl(nps, db) : null;
-        groupSupp = config.isGroupSupport() ? new GroupNotificationSupplierImpl(nps, db) : null;
-        connectorStatSupp = config.isNodeConnectorStatSupport() ? new NodeConnectorStatNotificationSupplierImpl(nps, db) : null;
-        flowStatSupp = config.isFlowStatSupport() ? new FlowStatNotificationSupplierImpl(nps, db) : null;
-        flowTableStatSupp = config.isFlowTableStatSupport() ? new FlowTableStatNotificationSupplierImpl(nps, db) : null;
-        meterStatSupp = config.isMeterStatSupport() ? new MeterStatNotificationSupplierImpl(nps, db) : null;
-        groupStatSupp = config.isGroupStatSupport() ? new GroupStatNotificationSupplierImpl(nps, db) : null;
-        queueStatSupp = config.isQueueStatSupport() ? new QueueStatNotificationSupplierImpl(nps, db) : null;
-
-        supplierList = new ArrayList<>(Arrays.asList(nodeSupp, connectorSupp, flowSupp, meterSupp, groupSupp,
-                connectorStatSupp, flowStatSupp, flowTableStatSupp, meterStatSupp, groupStatSupp, queueStatSupp));
-    }
-
-    @Override
-    public void close() throws Exception {
-        for (NotificationSupplierDefinition<?> supplier : supplierList) {
-            if (supplier != null) {
-                supplier.close();
-                supplier = null;
-            }
-        }
-    }
-
-    @VisibleForTesting
-    List<NotificationSupplierDefinition<?>> getSupplierList() {
-        return supplierList;
-    }
-}
-
diff --git a/applications/notification-supplier/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/openflow/applications/notification/supplier/rev150820/NotifModule.java b/applications/notification-supplier/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/openflow/applications/notification/supplier/rev150820/NotifModule.java
deleted file mode 100644 (file)
index 00c774c..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.applications.notification.supplier.rev150820;
-public class NotifModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.applications.notification.supplier.rev150820.AbstractNotifModule {
-    public NotifModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
-        super(identifier, dependencyResolver);
-    }
-
-    public NotifModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.applications.notification.supplier.rev150820.NotifModule oldModule, java.lang.AutoCloseable oldInstance) {
-        super(identifier, dependencyResolver, oldModule, oldInstance);
-    }
-
-    @Override
-    public void customValidation() {
-        // add custom validation form module attributes here.
-    }
-
-    @Override
-    public java.lang.AutoCloseable createInstance() {
-        // TODO:implement
-        throw new java.lang.UnsupportedOperationException();
-    }
-
-}
diff --git a/applications/notification-supplier/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/openflow/applications/notification/supplier/rev150820/NotifModuleFactory.java b/applications/notification-supplier/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/openflow/applications/notification/supplier/rev150820/NotifModuleFactory.java
deleted file mode 100644 (file)
index fcb8094..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
-* Generated file
-*
-* Generated from: yang module name: notification-supplier yang module local name: notification-supplier
-* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
-* Generated at: Sun May 22 10:45:47 IST 2016
-*
-* 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.openflow.applications.notification.supplier.rev150820;
-public class NotifModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.applications.notification.supplier.rev150820.AbstractNotifModuleFactory {
-
-}
diff --git a/applications/notification-supplier/src/main/resources/initial/73-notification-supplier.xml b/applications/notification-supplier/src/main/resources/initial/73-notification-supplier.xml
deleted file mode 100644 (file)
index 5b47dc9..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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
--->
-
-<snapshot>
-    <configuration>
-        <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
-            <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
-
-                <module>
-                    <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:openflow:applications:notification-supplier">prefix:notification-supplier</type>
-                    <name>notification-supplier</name>
-                    <data-broker>
-                        <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type>
-                        <name>binding-data-broker</name>
-                    </data-broker>
-                    <notification-service>
-                        <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>
-
-                    <notification-supplier-settings>
-                        <!--<port-support>true</port-support>-->
-                        <!--<flow-support>true</flow-support>-->
-                        <meter-support>true</meter-support>
-                        <group-support>true</group-support>
-                        <node-connector-stat-support>false</node-connector-stat-support>
-                        <flow-table-stat-support>false</flow-table-stat-support>
-                        <group-stat-support>false</group-stat-support>
-                        <meter-stat-support>false</meter-stat-support>
-                        <queue-stat-support>false</queue-stat-support>
-                        <flow-stat-support>false</flow-stat-support>
-                    </notification-supplier-settings>
-
-                </module>
-
-            </modules>
-        </data>
-    </configuration>
-
-    <required-capabilities>
-        <capability>urn:opendaylight:params:xml:ns:yang:openflow:applications:notification-supplier?module=notification-supplier&amp;revision=2015-08-20</capability>
-        <capability>urn:opendaylight:flow:inventory?module=flow-node-inventory&amp;revision=2013-08-19</capability>
-        <capability>urn:opendaylight:inventory?module=opendaylight-inventory&amp;revision=2013-08-19</capability>
-        <capability>urn:opendaylight:flow:types?module=opendaylight-flow-types&amp;revision=2013-10-26</capability>
-    </required-capabilities>
-</snapshot>
diff --git a/applications/notification-supplier/src/main/resources/org/opendaylight/blueprint/notification-supplier.xml b/applications/notification-supplier/src/main/resources/org/opendaylight/blueprint/notification-supplier.xml
new file mode 100644 (file)
index 0000000..2cad558
--- /dev/null
@@ -0,0 +1,34 @@
+<?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"/>
+
+  <reference id="NotificationProviderService" interface="org.opendaylight.controller.sal.binding.api.NotificationProviderService"/>
+
+  <bean id="NotificationProvider" class="org.opendaylight.openflowplugin.applications.notification.supplier.NotificationProvider"
+          init-method="start" destroy-method="close">
+    <argument ref="NotificationProviderService"/>
+    <argument ref="dataBroker"/>
+    <!-- Flow Support Flag, default is false -->
+    <argument value="false"/>
+    <!-- Meter Support Flag, default is true -->
+    <argument value="true"/>
+    <!-- Group Support Flag, default is true -->
+    <argument value="true"/>
+    <!-- Connector Stat Support Flag, default is false -->
+    <argument value="false"/>
+    <!-- Flow Stat Support Flag, default is false -->
+    <argument value="false"/>
+    <!-- Flow Table Stat Support Flag, default is false -->
+    <argument value="false"/>
+    <!-- Meter Stat Support Flag, default is false -->
+    <argument value="false"/>
+    <!-- Group Stat Support Flag, default is false -->
+    <argument value="false"/>
+    <!-- Queue Stat Support Flag, default is false -->
+    <argument value="false"/>
+
+  </bean>
+</blueprint>
\ No newline at end of file
diff --git a/applications/notification-supplier/src/main/yang/notification-supplier.yang b/applications/notification-supplier/src/main/yang/notification-supplier.yang
deleted file mode 100644 (file)
index 1508456..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-module notification-supplier {
-    yang-version 1;
-    namespace "urn:opendaylight:params:xml:ns:yang:openflow:applications:notification-supplier";
-    prefix "notification";
-    import config {prefix config; revision-date 2013-04-05;}
-    import opendaylight-md-sal-binding { prefix mdsal; revision-date 2013-10-28;}
-
-    description
-        "Translator tool for relevant wildcard path DataTreeModification to Notifications.";
-
-    revision "2015-08-20" {
-        description
-            "Initial revision";
-    }
-
-    identity notification-supplier {
-        base "config:module-type";
-        config:java-name-prefix Notif;
-    }
-
-    augment "/config:modules/config:module/config:configuration" {
-        case notification-supplier {
-            when "/config:modules/config:module/config:type = 'notification-supplier'";
-
-            container notification-service {
-                uses config:service-ref {
-                    refine type {
-                        mandatory true;
-                        config:required-identity mdsal:binding-notification-service;
-                    }
-                }
-            }
-
-            container data-broker {
-                uses config:service-ref {
-                    refine type {
-                        mandatory false;
-                        config:required-identity mdsal:binding-async-data-broker;
-                    }
-                }
-            }
-
-            container notification-supplier-settings {
-                leaf flow-support {
-                    type boolean;
-                    default true;
-                }
-                leaf meter-support {
-                    type boolean;
-                    default true;
-                }
-                leaf group-support {
-                    type boolean;
-                    default true;
-                }
-                leaf node-connector-stat-support {
-                    type boolean;
-                    default false;
-                }
-                leaf flow-table-stat-support {
-                    type boolean;
-                    default false;
-                }
-                leaf group-stat-support {
-                    type boolean;
-                    default false;
-                }
-                leaf meter-stat-support {
-                    type boolean;
-                    default false;
-                }
-                leaf queue-stat-support {
-                    type boolean;
-                    default false;
-                }
-                leaf flow-stat-support {
-                    type boolean;
-                    default false;
-                }
-            }
-        }
-    }
-}
@@ -18,7 +18,7 @@ import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
 import org.opendaylight.openflowplugin.applications.notification.supplier.tools.NotificationProviderConfig;
 import org.opendaylight.openflowplugin.applications.notification.supplier.tools.NotificationProviderConfig.NotificationProviderConfigBuilder;
 
-public class NotificationProviderImplTest {
+public class NotificationProviderTest {
 
     private NotificationProviderService notificationProviderService;
     private NotificationProviderConfig config;
@@ -33,7 +33,10 @@ public class NotificationProviderImplTest {
     @Test
     public void testCreateAllSuppliers() {
         final NotificationProviderConfig config = createAllConfigSupplier();
-        final NotificationProviderImpl provider = new NotificationProviderImpl(config, notificationProviderService, dataBroker);
+        final NotificationProvider provider = new NotificationProvider(notificationProviderService, dataBroker, config.isFlowSupport(), config.isMeterSupport(),
+                                                                               config.isGroupSupport(), config.isNodeConnectorStatSupport(), config.isFlowStatSupport(),
+                                                                               config.isFlowTableStatSupport(), config.isMeterStatSupport(), config.isGroupStatSupport(),
+                                                                               config.isQueueStatSupport());
         provider.start();
         final List<NotificationSupplierDefinition<?>> listSuppliers = provider.getSupplierList();
         int nrOfSuppliers = 0;
@@ -48,7 +51,10 @@ public class NotificationProviderImplTest {
     @Test
     public void testCreateRootSuppliersOnly() {
         final NotificationProviderConfig config = createNonConfigSupplier();
-        final NotificationProviderImpl provider = new NotificationProviderImpl(config, notificationProviderService, dataBroker);
+        final NotificationProvider provider = new NotificationProvider(notificationProviderService, dataBroker, config.isFlowSupport(), config.isMeterSupport(),
+                                                                               config.isGroupSupport(), config.isNodeConnectorStatSupport(), config.isFlowStatSupport(),
+                                                                               config.isFlowTableStatSupport(), config.isMeterStatSupport(), config.isGroupStatSupport(),
+                                                                               config.isQueueStatSupport());
         provider.start();
         final List<NotificationSupplierDefinition<?>> listSuppliers = provider.getSupplierList();
         int nrOfSuppliers = 0;
index 258d360ceae9dd4e9f0466bc9a34e4e29aaf8451..0481b82f241c822d9c802c575f3ceecc1a65c59b 100644 (file)
             <groupId>org.opendaylight.openflowplugin.applications</groupId>
             <artifactId>bulk-o-matic</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.opendaylight.openflowplugin.applications</groupId>
-            <artifactId>notification-supplier</artifactId>
-            <type>xml</type>
-            <classifier>config</classifier>
-        </dependency>
         <dependency>
             <groupId>org.opendaylight.openflowplugin.applications</groupId>
             <artifactId>notification-supplier</artifactId>
index 4a17a37b372b8e030a10c7d85778b4b7ba630a64..759b551dc8f9168aeb6770446a39fa6399e4210f 100644 (file)
@@ -97,7 +97,6 @@
     <feature name='odl-openflowplugin-app-notifications' description="OpenDaylight :: Openflow Plugin :: Application - notifications supplier" version='${project.version}'>
         <feature version="${project.version}">odl-openflowplugin-southbound</feature>
         <bundle>mvn:org.opendaylight.openflowplugin.applications/notification-supplier/{{VERSION}}</bundle>
-        <configfile finalname="etc/opendaylight/karaf/73-notification-supplier.xml">mvn:org.opendaylight.openflowplugin.applications/notification-supplier/{{VERSION}}/xml/config</configfile>
     </feature>
 
     <feature name='odl-openflowplugin-app-forwardingrules-manager' description="OpenDaylight :: Openflow Plugin :: Application - FRM" version='${project.version}'>