I have some more data on this and I believe there is a functionality regression 
in the API as of Boron-SR


I was able to configure the system to get a notification when a 
OFPT_FLOW_REMOVED message is received, but I believe its the wrong callback.


./model/model-flow-service/src/main/yang-gen-sal/org/opendaylight/yang/gen/v1/urn/opendaylight/flow/service/rev130819/SalFlowListener.java


is generated from the ./model/model-flow-service/src/main/yang/sal-flow.yang 
yang file.    It defines the following methods:


    void onNodeErrorNotification(NodeErrorNotification notification);
    void onFlowRemoved(FlowRemoved notification);
    void onSwitchFlowRemoved(SwitchFlowRemoved notification);
    void onNodeExperimenterErrorNotification(NodeExperimenterErrorNotification 
notification);
    void onFlowAdded(FlowAdded notification);
    void onFlowUpdated(FlowUpdated notification);


This class has existed at least since the Helium release.  In helium, when an 
OFPT_FLOW_REMOVED was received, the onSwitchFlowRemoved method of the listener 
was called.  As of Boron-SR2, the onFlowRemoved.  The problem is that the data 
contained in the SwitchFlowRemoved contains information that isn't in the 
FlowRemoved class.


As far as I can tell, the call flow is this:


    DeviceContextImpl.processFlowRemovedMessage(FlowRemoved)

  *   line 348 :  We call flowRemovedTranslator.translate(flowRemoved, 
deviceInfo, null);
     *   This is supposed to translate the 
org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemoved
 (from the openflowjava module) class into 
org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemoved
 (from the openflowplugin module).
        *   I believe rev130819.FlowRemoved is wrong and it should actually be 
org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SwitchFlowRemoved
     *   After line 348, we've lost the data from openflowjava about WHY the 
flow was removed.
     *   As a result of the translated class being rev130819.FlowRemoved, we 
call the 'onFlowRemoved' callback and NOT the 'onSwitchFlowRemoved' as we did 
in helium.

Can someone confirm or disprove my hypothesis?

  *   The code doesn't seem to use the 
org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SwitchFlowRemoved
 class.


Jim

________________________________
From: Jim West <[email protected]>
Sent: Friday, February 17, 2017 5:19 PM
To: [email protected]
Subject: What's the correct way to register for switch-flow-removed and 
node-error-notification in Boron?


Hi Everyone,


I developed some java code in ODL-Helium that registered a listener to get 
notified when the openflowplugin received a OFPT_FLOW_REMOVED message or an 
Open Flow error message.  I'm trying to move this code to ODL-Boron-SR2 and I'm 
having a problem where I'm not being notified when flows are removed on the 
switch.


In Helium, my code looked like this:

    final MyListener listener = new MyListener();  // MyListener implements 
org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowListener;

    final NotificationService notificationService = 
context.getSALService(org.opendaylight.controller.sal.binding.api.NotificationService.class);

    if (notificationService != null)

    {

        notificationService.registerNotificationListener(listener);

    }


This code has worked well in helium, but it doesn't work in Boron (the classes 
still appear to be available, but they've been deprecated)


In Helium, the notifications I'm interested in were defined in the controller 
project in the YANG file sal-flow.yang


By Boron,  the sal.flow.yang has been moved to the openflowplugin project and 
the switch-flow-removed notification has been deprecated.  What I'd like to 
understand is what's the best way to receive these events.


Here's what I've tried:


First attempt:

         final MyPktListener pktList = new MyPktListener(); // implements 
org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingListener

         final MyListener listener = MyListener();  // MyListener implements 
org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowListener;


         final NotificationService srvc = 
OsgiUtils.findOsgiService(org.opendaylight.controller.md.sal.binding.api.NotificationService);

         if (srvc != null)
         {

                  srvc.registerNotificationListener(pktList)

                  srvc.registerNotificationListener(listener)

         }


  *        I get packet in events, but I'm not getting events to indicate a 
flow as aged out on the switch (I can see the message come up from OpenFlow)


2nd attempt (use the old Helium class, but I still don't get the events):

         final MyPktListener pktList = new MyPktListener(); // implements 
org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingListener

         final MyListener listener = MyListener();  // MyListener implements 
org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowListener;


         final NotificationService srvc = 
OsgiUtils.findOsgiService(org.opendaylight.controller.sal.binding.api.NotificationService);

         if (srvc != null)
         {

                  srvc.registerNotificationListener(pktList)

                  srvc.registerNotificationListener(listener)

         }

I'm looked at the code in the samples directory in the openflowplugin (but no 
example for the flow-removed-on-switch event).  I've been unable to find a 
blueprint registration of a service that implements any of the 
NotificationService API's.

What am I missing.  This seems so basic I'm assuming I'm registering the wrong 
class/interface as a listener.

Does anyone have an example of Boron (or Beryllium) code that does this?

Thanks in advance,

Jim


_______________________________________________
openflowplugin-dev mailing list
[email protected]
https://lists.opendaylight.org/mailman/listinfo/openflowplugin-dev

Reply via email to