我正在使用项目 Floodlight 来了解我个人项目的软件定义网络。我的自定义模块使用 FloodlightProvider 控制器模块和 IOFMessageListener 来监听 openflow 消息。我可以成功收听 PACKET_IN openflow 消息,但是我无法收听任何同步的 openflow 消息(HELLO、EQHO_REQUEST 等)。我按照文档进行了操作,如果我没记错的话,可以使用 FloodlightProvider 控制器模块来监听 openflow 消息。任何人都可以帮助我,因为我很好奇。监听消息的程序在“如何编写模块”下的 Floodlight 教程中给出。但是,我正在编辑启动方法和接收方法。这些如下:
@Override
public void startUp(FloodlightModuleContext context) {
floodlightProvider.addOFMessageListener(OFType.PACKET_IN, this);
floodlightProvider.addOFMessageListener(OFType.HELLO, this);
}
@Override
public net.floodlightcontroller.core.IListener.Command receive(IOFSwitch sw, OFMessage msg, FloodlightContext cntx) {
switch(msg.getType()){
case PACKET_IN:
// print the openflow message in console
break;
case HELLO:
// print the openflow message in console
break;
default:
break;
}
return Command.CONTINUE;
}