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

Revision history [back]

You can follow the following steps:

1) get the PacketProcessingService instance:

session.getRpcService(PacketProcessingService.class);

2) use the PacketProcessingService instance to send the packet. Following is example for sending the packet:

     /**
     * This method sends the packet on given output port
     * @param nodeIID SwithID
     * @param ncIID Node connector (ouput port)
     * @param data packet to transmit
     */
    private void sendPacket(InstanceIdentifier<Node> nodeIID,
            InstanceIdentifier<NodeConnector> ncIID,
            byte[] data) {

        TransmitPacketInputBuilder txBuilder = new TransmitPacketInputBuilder();
        txBuilder.setPayload(data)
        .setNode(new NodeRef(nodeIID))
        .setEgress(new NodeConnectorRef(ncIID));

        packetProcessingService.transmitPacket(txBuilder.build());
    }

You can follow the following steps:

1) get the PacketProcessingService instance:

session.getRpcService(PacketProcessingService.class);

2) use the PacketProcessingService instance to send the packet. Following is example for sending the packet:

     /**
     * This method sends the packet on given output port
     * @param nodeIID SwithID
     * @param ncIID Node connector (ouput port)
     * @param data packet to transmit
     */
    private void sendPacket(InstanceIdentifier<Node> nodeIID,
            InstanceIdentifier<NodeConnector> ncIID,
            byte[] data) {

        TransmitPacketInputBuilder txBuilder = new TransmitPacketInputBuilder();
        txBuilder.setPayload(data)
        .setNode(new NodeRef(nodeIID))
        .setEgress(new NodeConnectorRef(ncIID));

        packetProcessingService.transmitPacket(txBuilder.build());
    }

For reference you can take a look into my repo (router-on-stick)[https://github.com/subh007/router-on-stick/blob/master/router-impl/src/main/java/org/opendaylight/proxyarp/ProxyArp.java#L202-L219].

You can follow the following steps:

1) get the PacketProcessingService instance:

session.getRpcService(PacketProcessingService.class);

2) use the PacketProcessingService instance to send the packet. Following is example for sending the packet:

     /**
     * This method sends the packet on given output port
     * @param nodeIID SwithID
     * @param ncIID Node connector (ouput port)
     * @param data packet to transmit
     */
    private void sendPacket(InstanceIdentifier<Node> nodeIID,
            InstanceIdentifier<NodeConnector> ncIID,
            byte[] data) {

        TransmitPacketInputBuilder txBuilder = new TransmitPacketInputBuilder();
        txBuilder.setPayload(data)
        .setNode(new NodeRef(nodeIID))
        .setEgress(new NodeConnectorRef(ncIID));

        packetProcessingService.transmitPacket(txBuilder.build());
    }

For reference you can take a look into my repo (router-on-stick)[https://github.com/subh007/router-on-stick/blob/master/router-impl/src/main/java/org/opendaylight/proxyarp/ProxyArp.java#L202-L219].

router-on-stick .