Search in sources :

Example 1 with PacketProcessingListener

use of org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingListener in project openflowplugin by opendaylight.

the class PacketInDispatcherImpl method onPacketReceived.

@Override
public void onPacketReceived(PacketReceived notification) {
    // find corresponding handler
    /*
         * Notification contains reference to ingress port
         * in a form of path in inventory: /nodes/node/node-connector
         *
         * In order to get path we shorten path to the first node reference
         * by using firstIdentifierOf helper method provided by InstanceIdentifier,
         * this will effectively shorten the path to /nodes/node.
         */
    InstanceIdentifier<?> ingressPort = notification.getIngress().getValue();
    InstanceIdentifier<Node> nodeOfPacket = ingressPort.firstIdentifierOf(Node.class);
    /**
     * We lookup up the the packet-in listener for this node.
     */
    PacketProcessingListener nodeHandler = handlerMapping.get(nodeOfPacket);
    /**
     * If we have packet-processing listener, we delegate notification.
     */
    if (nodeHandler != null) {
        nodeHandler.onPacketReceived(notification);
    }
}
Also used : Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) PacketProcessingListener(org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingListener)

Aggregations

Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)1 PacketProcessingListener (org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingListener)1