public FlowCapableNodeDataChangeListener (DataBroker dataBroker) {
LOG.info("Registering FlowCapableNodeChangeListener");
- registration = dataBroker.registerDataChangeListener(LogicalDatastoreType.OPERATIONAL,
+ registration = dataBroker.registerDataChangeListener(LogicalDatastoreType.CONFIGURATION,
createFlowCapableNodePath(), this, AsyncDataBroker.DataChangeScope.ONE);
}
@Override
public void onDataChanged (AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> changes) {
- checkMemberInitialization();
-
LOG.debug(">>>> onDataChanged: {}", changes);
+ checkMemberInitialization();
for (InstanceIdentifier instanceIdentifier : changes.getRemovedPaths()) {
DataObject originalDataObject = changes.getOriginalData().get(instanceIdentifier);
for (Map.Entry<InstanceIdentifier<?>, DataObject> created : changes.getCreatedData().entrySet()) {
InstanceIdentifier<?> iID = created.getKey();
String openflowId = iID.firstKeyOf(Node.class, NodeKey.class).getId().getValue();
- LOG.debug(">>>>> created iiD: {} - first: {} - NodeKey: {}",
+ LOG.info(">>>>> created iiD: {} - first: {} - NodeKey: {}",
iID, iID.firstIdentifierOf(Node.class), openflowId);
Node openFlowNode = NodeUtils.getOpenFlowNode(openflowId);
if (nodeCache.contains(openFlowNode)) {
for (Map.Entry<InstanceIdentifier<?>, DataObject> updated : changes.getUpdatedData().entrySet()) {
InstanceIdentifier<?> iID = updated.getKey();
String openflowId = iID.firstKeyOf(Node.class, NodeKey.class).getId().getValue();
- LOG.debug(">>>>> updated iiD: {} - first: {} - NodeKey: {}",
+ LOG.trace(">>>>> updated iiD: {} - first: {} - NodeKey: {}",
iID, iID.firstIdentifierOf(Node.class), openflowId);
Node openFlowNode = NodeUtils.getOpenFlowNode(openflowId);
if (nodeCache.contains(openFlowNode)) {
nodeCache.add(openFlowNode);
- if (networkingProviderManager != null) {
- networkingProviderManager.getProvider(openFlowNode).initializeOFFlowRules(openFlowNode);
- }
if (pipelineOrchestrator != null) {
pipelineOrchestrator.enqueue(openflowId);
}
* Obtain local ref to members, if needed. Having these local saves us from calling getGlobalInstance
* upon every event.
*/
- if (networkingProviderManager == null) {
- networkingProviderManager =
- (NetworkingProviderManager) ServiceHelper.getGlobalInstance(NetworkingProviderManager.class, this);
- }
if (pipelineOrchestrator == null) {
pipelineOrchestrator =
(PipelineOrchestrator) ServiceHelper.getGlobalInstance(PipelineOrchestrator.class, this);
manager.add(createComponent()
.setInterface(new String[]{OvsdbInventoryListener.class.getName(),
+ NodeCacheListener.class.getName(),
AbstractHandler.class.getName()},
southboundHandlerProperties)
.setImplementation(SouthboundHandler.class)
.add(createServiceDependency().setService(OvsdbConfigurationService.class).setRequired(true))
.add(createServiceDependency().setService(OvsdbConnectionService.class).setRequired(true))
.add(createServiceDependency().setService(EventDispatcher.class).setRequired(true))
- .add(createServiceDependency().setService(NeutronL3Adapter.class).setRequired(true)));
+ .add(createServiceDependency().setService(NeutronL3Adapter.class).setRequired(true))
+ .add(createServiceDependency().setService(NodeCacheManager.class).setRequired(true)));
Dictionary<String, Object> lbaasHandlerProperties = new Hashtable<>();
lbaasHandlerProperties.put(Constants.EVENT_HANDLER_TYPE_PROPERTY,
import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager;
import org.opendaylight.ovsdb.openstack.netvirt.api.ConfigurationService;
import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProviderManager;
+import org.opendaylight.ovsdb.openstack.netvirt.api.NodeCacheListener;
import org.opendaylight.ovsdb.openstack.netvirt.api.TenantNetworkManager;
import org.opendaylight.ovsdb.openstack.netvirt.impl.NeutronL3Adapter;
import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
import java.util.Set;
import java.util.concurrent.ConcurrentMap;
-public class SouthboundHandler extends AbstractHandler implements OvsdbInventoryListener {
+public class SouthboundHandler extends AbstractHandler
+ implements NodeCacheListener, OvsdbInventoryListener {
static final Logger logger = LoggerFactory.getLogger(SouthboundHandler.class);
//private Thread eventThread;
return;
}
SouthboundEvent ev = (SouthboundEvent) abstractEvent;
+ //logger.info("processEvent: {}", ev);
switch (ev.getType()) {
case NODE:
try {
break;
}
}
+
+ /**
+ * Notification about an OpenFlow Node
+ *
+ * @param openFlowNode the {@link org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node Node} of interest in the notification
+ * @param action the {@link Action}
+ * @see NodeCacheListener#notifyNode
+ */
+ @Override
+ public void notifyNode (Node openFlowNode, Action action) {
+ logger.info("notifyNode: Node {} update {} from Controller's inventory Service",
+ openFlowNode, action);
+
+ if (action.equals(Action.ADD)) {
+ networkingProviderManager.getProvider(openFlowNode).initializeOFFlowRules(openFlowNode);
+ }
+ }
}