[英]Opendaylight openflow plugin: multiple notifications on switch
I copied some code from the openflow samples (learning switch) to get notified when a switch connects but now, alas, I get many notifications. 我从openflow示例(学习开关)中复制了一些代码,以便在连接开关时得到通知,但是现在,我收到了很多通知。 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 兰加
You are listening for OpenFlow table updates, which will get you a notification every time an openflow event affects a table on a switch. 您正在侦听OpenFlow表更新,每次openflow事件影响交换机上的表时,它都会向您发送通知。 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. 如果您已停在
InstanceIdentifier.builder(Nodes.class).child(Node.class)
,则每次更新,添加或删除开关时都会收到通知。 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; 由于此通知(
Node.class
)更通用,因此您可能不得不忽略很多“更新”通知; this is normal, since this will include all 'Update' notifications from the class you are currently listening to (Table is contained within Node). 这是正常现象,因为这将包括您当前正在收听的类的所有“更新”通知(表包含在Node中)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.