@Override
 void processOFMessage(OFMessage m) throws IOException {
   if (m.getType().equals(OFType.PACKET_IN)) {
     log.warn(
         "Ignoring PACKET_IN message from {} during OpenFlow channel establishment.",
         channel.remoteAddress());
   } else {
     super.processOFMessage(m);
   }
 }
 @Override
 public void channelRead0(ChannelHandlerContext ctx, Iterable<OFMessage> msgList)
     throws Exception {
   for (OFMessage ofm : msgList) {
     try {
       // Do the actual packet processing
       state.processOFMessage(ofm);
     } catch (Exception ex) {
       // We are the last handler in the stream, so run the
       // exception through the channel again by passing in
       // ctx.getChannel().
       ctx.fireExceptionCaught(ex);
     }
   }
 }
Beispiel #3
0
 @Override
 public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
   if (e.getMessage() instanceof List) {
     @SuppressWarnings("unchecked")
     List<OFMessage> msglist = (List<OFMessage>) e.getMessage();
     for (OFMessage ofm : msglist) {
       try {
         // Do the actual packet processing
         state.processOFMessage(ofm);
       } catch (Exception ex) {
         // We are the last handler in the stream, so run the
         // exception through the channel again by passing in
         // ctx.getChannel().
         Channels.fireExceptionCaught(ctx.getChannel(), ex);
       }
     }
   } else {
     Channels.fireExceptionCaught(
         ctx.getChannel(), new AssertionError("Message received from channel is not a list"));
   }
 }