package org.opendaylight.openflowplugin.openflow.ofswitch.config;
import java.util.Set;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
+import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
+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.module.config.rev141015.NodeConfigService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.module.config.rev141015.SetConfigInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.SwitchConfigFlag;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
*/
public class DefaultConfigPusher implements AutoCloseable, DataChangeListener {
- private NodeConfigService nodeConfigService;
+ private final NodeConfigService nodeConfigService;
+ private final DataBroker dataBroker;
+ private ListenerRegistration<DataChangeListener> dataChangeListenerRegistration;
- public DefaultConfigPusher(NodeConfigService nodeConfigService) {
+ public DefaultConfigPusher(NodeConfigService nodeConfigService, DataBroker dataBroker) {
this.nodeConfigService = nodeConfigService;
+ this.dataBroker = dataBroker;
}
- @Override
- public void close() throws Exception {
+ public void start() {
+ InstanceIdentifier<FlowCapableNode> path = InstanceIdentifier.create(Nodes.class).child(Node.class).
+ augmentation(FlowCapableNode.class);
+ dataChangeListenerRegistration = dataBroker.registerDataChangeListener(
+ LogicalDatastoreType.OPERATIONAL,
+ path, this, AsyncDataBroker.DataChangeScope.BASE);
+ }
+ @Override
+ public void close() {
+ if(dataChangeListenerRegistration != null) {
+ dataChangeListenerRegistration.close();
+ }
}
@Override
package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.applications.of._switch.config.pusher.rev141015;
-import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.openflowplugin.openflow.ofswitch.config.DefaultConfigPusher;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
-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.module.config.rev141015.NodeConfigService;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.controller.sal.common.util.NoopAutoCloseable;
-public class DefaultConfigPusherModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.applications.of._switch.config.pusher.rev141015.AbstractDefaultConfigPusherModule {
+/**
+ * @deprecated Replaced by blueprint wiring
+ */
+@Deprecated
+public class DefaultConfigPusherModule extends AbstractDefaultConfigPusherModule {
public DefaultConfigPusherModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
super(identifier, dependencyResolver);
}
super(identifier, dependencyResolver, oldModule, oldInstance);
}
- @Override
- public void customValidation() {
- // add custom validation form module attributes here.
- }
-
@Override
public java.lang.AutoCloseable createInstance() {
- InstanceIdentifier<FlowCapableNode> path = InstanceIdentifier.create(Nodes.class).child(Node.class).augmentation(FlowCapableNode.class);
- NodeConfigService nodeConfigService = getRpcRegistryDependency().getRpcService(NodeConfigService.class);
- return getDataBrokerDependency().registerDataChangeListener(
- LogicalDatastoreType.OPERATIONAL,
- path,
- new DefaultConfigPusher(nodeConfigService),
- AsyncDataBroker.DataChangeScope.BASE);
+ // DefaultConfigPusher instance is created via blueprint so this in a no-op.
+ return NoopAutoCloseable.INSTANCE;
}
-
}
* 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.of._switch.config.pusher.rev141015;
-public class DefaultConfigPusherModuleFactory extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.applications.of._switch.config.pusher.rev141015.AbstractDefaultConfigPusherModuleFactory {
+
+/**
+ * @deprecated Replaced by blueprint wiring
+ */
+@Deprecated
+public class DefaultConfigPusherModuleFactory extends AbstractDefaultConfigPusherModuleFactory {
}
~ 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.
-->
<!-- vi: set et smarttab sw=4 tabstop=4: -->
--- /dev/null
+<?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:rpc-service id="nodeConfigService" interface="org.opendaylight.yang.gen.v1.urn.opendaylight.module.config.rev141015.NodeConfigService"/>
+
+ <bean id="LLDPPacketPuntEnforcer" class="org.opendaylight.openflowplugin.openflow.ofswitch.config.DefaultConfigPusher"
+ init-method="start" destroy-method="close">
+ <argument ref="nodeConfigService"/>
+ <argument ref="dataBroker"/>
+ </bean>
+</blueprint>
\ No newline at end of file
identity of-switch-config-pusher {
base "config:module-type";
config:java-name-prefix DefaultConfigPusher;
+ status deprecated;
}
augment "/config:modules/config:module/config:configuration" {