Ask is moving to Stack Overflow and Serverfault.com! Please use the "opendaylight" tag on either of these sites. This site is now in Read-Only mode

0

opeflow plugin: How to get notification when switch connects

asked 2017-09-05 12:14:25 -0800

Hello,

I am writing my first ODL application with the openflow plugin. I am working with carbon. I want to get a notification when a switch connects. I am trying the following code in the provider :

               WakeupOnNode wakeupListener = new WakeupOnNode();
    // final InstanceIdentifier<Table> instanceIdentifier = InstanceIdentifier.create(Node.class).augmentation(FlowCapableNode.class).child(Table.class);


    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.dataBroker.registerDataTreeChangeListener(dataTreeIdentifier, wakeupListener);

But alas I see no notification appear in my WakeupOnNode listener.

( I took this code from the openflowplugin samples.) Where can I find some documentation on how to do this?

Thank you in advance for your help.

Ranga

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-09-05 19:33:57 -0800

updated 2017-09-16 17:23:37 -0800

Actually this does work as advertised. I Had previously made a mistake. I have to build the project from the root.

   mvn clean install

Does it. I would like to know why I get MULTIPLE notifications when mininet connects.

To get rid of the MULTIPLE notifications issue :

     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);
    final DataTreeIdentifier<FlowCapableNode> dataTreeIdentifier = new DataTreeIdentifier(LogicalDatastoreType.OPERATIONAL, getWildcardPath());


    this.dataTreeChangeListenerRegistration = this.dataBroker.registerDataTreeChangeListener(dataTreeIdentifier,
            wakeupListener);
edit flag offensive delete publish link more
Login/Signup to Answer

Question Tools

Follow
1 follower

Stats

Asked: 2017-09-05 12:14:25 -0800

Seen: 42 times

Last updated: Sep 16