1
votes

I am writing a Java ODL application. I am following the general pattern of L2-Switch. I have a PacketIn dispatcher where I would like to know the port of connected switch where a packet was received. How can I do this? Thanks.

1

1 Answers

1
votes

You can get the in_port like this :

 @Override
 public void onPacketReceived(PacketReceived packetReceived) {
        Match match = packetReceived.getMatch();
        String inPort = match.getInPort().getValue();
}

Supposing that this method belongs to a class you have created implementing the PacketProcessingListener:

public class PacketProcessing implements PacketProcessingListener{
    ...
}