How can I use java code to know my controller received a packet with specify vlan ID ?

asked 2015-05-20 07:30:21 -0700

ShawLinLoveLife gravatar image

Suppose I have switches s1-s2-s3-s4 (linear topology)

Before I sent a packet to switch s4, s4 has a flow entry like this: npacket=0,priority=5,dlvlan=999,action=controller:65535

After I sent a packet to switch s4, it has a flow entry like this: npacket=1,priority=5,dlvlan=999,action=controller:65535

So I believe that this packet is sent back to the controller. But how could I use java code to let my controller know that this packet is received by my controller?

I guess I should use notification provided by odl, but I do not know which notification service should I register..

I see the code in packethandler, in project l2switch but it seems to be unhelpful... Because it seems that packethandler gets notification from itself ...

NotificationProviderService notificationService = getNotificationServiceDependency();

private void initiateDecoders(NotificationProviderService notificationProviderService) {
decoders = new ImmutableSet.Builder<AbstractPacketDecoder>()
  .add(new EthernetDecoder(notificationProviderService))
  .add(new ArpDecoder(notificationProviderService))
  .add(new Ipv4Decoder(notificationProviderService))
  .add(new Ipv6Decoder(notificationProviderService))

It would be quite grateful if anyone could help!

edit retag flag offensive close merge delete


I also have your questions.please help

wangruxun ( 2015-06-01 07:25:06 -0700 )edit