Example #1
0
void SimpleController::addFlow(Channel *channel, const PacketIn *msg,
                               const EnetFrame *frame, UInt32 outPort) {
  MatchBuilder match;
  match.add(OFB_IN_PORT{msg->inPort()});
  match.add(OFB_ETH_DST{frame->dst});
  match.add(OFB_ETH_SRC{frame->src});

  ActionList actions;
  actions.add(AT_OUTPUT{outPort});

  InstructionList instructions;
  instructions.add(IT_APPLY_ACTIONS{&actions});

  FlowModBuilder flowMod;
  flowMod.setMatch(match);
  flowMod.setInstructions(instructions);
  flowMod.setIdleTimeout(10);
  flowMod.setHardTimeout(30);
  flowMod.setPriority(0x7FFF);
  flowMod.setBufferId(msg->bufferId());
  flowMod.send(channel);
}