OpenDaylight实战手记(七)添加网元流程(South -To- North)

来源:互联网 发布:中国影响力 知乎 编辑:程序博客网 时间:2024/06/04 18:14

1org.opendaylight.controller.protocol_plugin.openflow.core.internal.ControllerIO

controllerIOThread线程的runnabble接口中接收设备的连接请求

2org.opendaylight.controller.protocol_plugin.openflow.core.internal.Controller

public void handleNewConnection(Selector selector, SelectionKey serverSelectionKey)

每个连接请求对应一个switchnew一个SwitchHandler,然后调用SwitchHandlerstart()方法

3org.opendaylight.controller.protocol_plugin.openflow.core.internal.SwitchHandler

start()方法启动收发线程和消息通道。

4org.opendaylight.controller.protocol_plugin.openflow.core.internal.SwitchHandler

接收线程switchHandlerThread,接受消息、处理消息:主要从IMessageReadWrite msgReadWriteService这个接口获取接受到的消息,判断OFMessage类型消息的用途,对应不同通途进行处理。

5org.opendaylight.controller.protocol_plugin.openflow.core.internal.Controller

如果是对交换机进行处理(增加、删除、更新),调用public void takeSwitchEventMsg(ISwitch sw, OFMessage msg)方法,然后生成交换机事件SwitchEvent,放到交换机时间处理队列,PriorityBlockingQueue<SwitchEvent> switchEventsswitchEventThread线程中run方法对SwitchEvent进行处理。如果是增加是事件,那么ConcurrentHashMap<Long, ISwitch> switches中增加该switch。最后通知ISwitchStateListener监听器,这里ISwitchStateListener监听器只有一个:InventoryServiceShim

6org.opendaylight.controller.protocol_plugin.openflow.internal.InventoryServiceShim

InventoryServiceShim中通过private void notifyInventoryShimListener(NodeConnector nodeConnector, UpdateType type, Set<Property> props)通知,这个方法中遍历所有Container,通知IInventoryShimInternalListener,然后通知plugin listenersnotifyInventoryShimExternalListener(NodeConnector nodeConnector, UpdateType type, Set<Property> props)

注:交换机的删除和更新也是类似

0 0
原创粉丝点击