Ask is moving to Stack Overflow and! Please use the "opendaylight" tag on either of these sites. This site is now in Read-Only mode

Revision history [back]

click to hide/show revision 1
initial version

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

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!