Opendaylight openflow plugin: multiple notifications on switch

103 views Asked by At

I copied some code from the openflow samples (learning switch) to get notified when a switch connects but now, alas, I get many notifications. Here's my code to register a listener:

    WakeupOnNode wakeupListener = new WakeupOnNode(s);


    final InstanceIdentifier<Table> instanceIdentifier = InstanceIdentifier.builder(Nodes.class).child(Node.class).
        augmentation(FlowCapableNode.class).child(Table.class).build();


    final DataTreeIdentifier<Table> dataTreeIdentifier = 
            new DataTreeIdentifier(LogicalDatastoreType.OPERATIONAL, instanceIdentifier);

    this.dataTreeChangeListenerRegistration = this.dataBroker.registerDataTreeChangeListener(dataTreeIdentifier, wakeupListener);

I see multiple notifications in the listener. Not sure why this happens. Perhaps I need to listen on some other identifier (?)

Thanks in advance for any help.

Ranga

1

There are 1 answers

0
Tama Yoshi On

You are listening for OpenFlow table updates, which will get you a notification every time an openflow event affects a table on a switch. So you are not listening to the right kind of class.

If you had stopped at InstanceIdentifier.builder(Nodes.class).child(Node.class) you would have had a notification for every time a switch was updated, added or deleted. This sounds like the kind of notification you are looking for. Personally, this is the class I use to listen for new nodes on the topology.

Note, though, that you will still get many notifications.

Since this notification (Node.class) is more generic, you will probably have to ignore a lot of 'Update' notifications; this is normal, since this will include all 'Update' notifications from the class you are currently listening to (Table is contained within Node).