}
@Override
protected void packetIn(SwitchRef swRef, OFMessagePacketInRef packetIn) {
super.packetIn(swRef, packetIn);
IOFMessageProvider provider = swRef.getProvider();
OFMessageFlowModRef flowMod = provider.buildFlowModMsg();
if (packetIn.existMatchInPort()) {
flowMod.addMatchInPort(packetIn.getMatchInPort().getMatch());
} else if (packetIn.existMatchEthDst()) {
flowMod.addMatchEthDst(packetIn.getMatchEthDst().getMatch());
} else if (packetIn.existMatchEthSrc()) {
flowMod.addMatchEthSrc(packetIn.getMatchEthSrc().getMatch());
}
OFStructureInstructionRef instruction = provider.buildInstructionApplyActions();
instruction.addActionOutput("2");
flowMod.addInstruction("apply_actions", instruction);
sendFlowModMessage(swRef, flowMod);
}