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

How do I convert an existing consumer service to a dual consumer/provider service?

asked 2014-06-11 02:50:33 -0800

LispMappingService.java implements a binding aware consumer service. According to the MD-SAL FAQ A1 a plugin can be both a consumer and provider. I want to add provider capabilities to this service, in order to be able to add nodes into the data store based on current LISP registration data and send notifications when certain types of changes occur.

I tried adding provider capabilities to LispMappingService first by adding "extends AbstractBindingAwareProvider" to the class declaration. However, this gives me the error: "onSessionInitialized(ConsumerContext) in LispMappingService cannot override onSessionInitialized(ConsumerContext) in AbstractBindingAwareProvider". And I need both onSessionInitialized(ConsumerContext) and onSessionInitiated(ProviderContext).

Next I tried adding implements BindingAwareProvider. I get no errors here, but onSessionInitiated(ProviderContext) is not called, so I cannot get a session reference.

Right now I only see two potential solutions:

  1. Create a new bundle for the provider service part
  2. Use the southbound plugin, which already has a ProviderContext

I don't like these approaches, because most of the logic I need resides in the mapping service implementation, and the inventory service fits there best.

Anything I can do to get a ProviderContext properly in LispMappingService?

edit retag flag offensive close merge delete

Comments

Hi Lori, Just a piece of info - not really the solution to your problem: onSessionInitialized(ConsumerContext) in AbstractBindingAwareProviderConstraint is a deprecated method and should not be used. -Kanika

kanika28 ( 2014-06-11 04:22:34 -0800 )edit

@kanika28 I thought it was strange that a provider class has a consumer context init method... It's somewhat orthogonal, but maybe I wasn't clear in my post that I already have onSessionInitialized(ConsumerContext) implemented (from BindingAwareConsumer).

lori ( 2014-06-11 04:59:36 -0800 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-06-13 07:41:20 -0800

rgowrishankar gravatar image

updated 2014-06-23 13:46:22 -0800

You only need to implement the BindingAwareProvider. As per https://wiki.opendaylight.org/view/OpenDaylightController:MD-SAL:DeveloperFAQ https://wiki.opendaylight.org/view/OpenDaylightController:MD-SAL:SouthboundPluginDevelopmentGuide

If a plugin needs to be a provider and a consumer (Plugin A provides a notification consumed by plugin B and causes plugin B to generate a notification that is consumed by plugin C), then the plugin can extend the AbstractBindingAwareProvider. This is the easiest way to implement the functionality of a provider and a consumer in a single plugin. The ProviderContext extends the ConsumerContext and hence all the functionality provided by the ConsumerContext to the AbstractBindingAwareConsumer is also provided by the ProviderContext to AbstractBindingAwareProvider. Using the AbstractBindingAwareProvider gives you additional capability to modify datastores and generate notifications which is not available for the AbstractBindingAwareConsumer.

I modified the old answer to the correct one as per discussion on the MD-SAL weekly call.

edit flag offensive delete publish link more

Comments

Can you elaborate on this please?

krish7919 ( 2014-06-17 03:53:15 -0800 )edit
Login/Signup to Answer

Question Tools

Follow
1 follower

Stats

Asked: 2014-06-11 02:50:33 -0800

Seen: 293 times

Last updated: Jun 23 '14