Ask Your Question
0

How does topology-manager create a node?

asked 2014-06-16 18:11:39 -0700

zedyuang gravatar image

updated 2014-06-17 10:58:46 -0700

Moderators

When there is a switch connecting to the controller, a session would be created and an onSessionAdded() function would be called in SalRegistrationManager. (For MD-SAL openflowplugin and openflowjava development)

In onSessionAdded(), it will publish the NodeUpdated in the end. However, how does topology-manager or other listeners takeover this notification? How can I know how many listeners on the NodeUpdated and what are they?

In topology-manager, how does it create a node and store it into database after receiving this notification?

I hope I can get some details about the logic.

Thanks

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-06-16 22:20:37 -0700

Moderators

updated 2014-06-18 01:59:56 -0700

In case of AD-SAL based stack -- Look for the class Inventory.java, it overrides the listener method updateNode() from IPluginOutInventoryService.java, that will be called by openflowplugin whenever new switch connects to the controller.

This method further calls all the listener application above the AD-SAL. To subscribe for this event notification, application needs to override methods in IListenInventoryUpdates.java and also need to set this class as a interface in the applications Activator.java class. As of now IListenInveotryUpdates.java is being implemented by ConnectionManager,StatisticsManager and SwitchManager, you can explore the Activator.java file of any of these module to get more details.


In case of MD-SAL based stack - Every module who wants to subscribe for notification events from plugin should register its listener implementation with notification service. For example lets have a look at inventory-manager (MD-SAL) module. In start() method of FlowCapableInventoryProvider.java it's registering NodeChangeCommiter class instance to the notification service.

this.listenerRegistration = this.notificationService.registerNotificationListener(this.changeCommiter);

NodeChangeCommiter implements all the notification methods of OpendaylightInventoryListener. So whenever plugin publish any DTO to SAL using NotificationService, it will invoke the related notification method of the concern subscriber/s. I believe which notification will be invoked is dependent on what DTO is being published to SAL notification service. As you mentioned in your question, In case of node add event, plugin publishes NodeUpdate DTO to the notification service,

        publishService.publish(nodeAdded(ofSwitch, features,nodeRef));

nodeAdded returns

private NodeUpdated nodeAdded(ModelDrivenSwitch sw, GetFeaturesOutput features, NodeRef nodeRef) {

So notification service will invoke following notification listener method of OpendaylightInventoryListener

void onNodeUpdated(NodeUpdated notification);
edit flag offensive delete publish link more

Comments

Thank you for your answer. I look into InventoryService.java, but it seems that this service is for openflow 1.0 plugin on AD-SAL. Actually, I am working on the MD-SAL openflowplugin and library. What about this case?

zedyuang ( 2014-06-17 10:26:05 -0700 )edit

@zedyuang, I updated my answer with details of how it works in case of MD-SAL.

Anil Vishnoi ( 2014-06-18 02:00:57 -0700 )edit

I really appreciate it. But, how does MD-SAL relate the "publishService.publish(NodeUpdated nodeAdded)" to OpendaylightInventoryListener?

zedyuang ( 2014-06-18 17:40:56 -0700 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

Follow
2 followers

Stats

Asked: 2014-06-16 18:11:39 -0700

Seen: 543 times

Last updated: Jun 18 '14