中文版本这里: http://www.sdnlab.com/18092.html
How to send raw packet data from Opendaylight controller to network datapath
Abstract
Opendaylight(ODL) controller project contains Service Abstraction Layer(AD-SAL/MD-SAL), UI, other components etc. Sending packet to network is the basic functionality for network devices. Two methods are giving to demonstrate how to deliver raw packet-data to network from ODL controller, it works fine with ODL version Boron(+) and Beryllium(+).
1 Introduction
ODL provides flexible and powerful REST API for custom business logic. In yang model “packet-processing(2013-07-09)”it is provided to sending packet out through openflow device from controller with RPC interface transmit-packet.
Also service “PacketProcessingService” can be used to deliver packet data from controller through a specific switch to network.
1.1 packet-processing(2013-07-09)
The yang model file is located in directory “model/model-flow-service/src/main/yang/packet-processing.yang”with ODL project “openflowplugin”.
RPC interface transmit-packet as follows:
rpc transmit-packet{
description "Sending packet out through openflow device.";
input {
uses inv:node-context-ref;
leaf connection-cookie {
type connection-cookie;
}
leaf egress {
type inv:node-connector-ref;
}
leaf buffer-id {
type uint32;
}
uses raw-packet;
uses action-type:action-list;
}
Fields needed are:
- egress: switch’s egress port. ODL’s connector reference format. For example,“/opendaylight-inventory:nodes/opendaylight-inventory:node[opendaylight-inventory:id='NODE-ID']/opendaylight-inventory:node-connector[opendaylight-inventory:id='PORT-ID']”
- node: which switch to send from. ODL’s node reference format. For example, “/opendaylight-inventory:nodes/opendaylight-inventory:node[opendaylight-inventory:id='NODE-ID']”
- raw-packet: raw packet data to send. Base64 Encoding scheme must be applied to binary raw data when calling the API.
1.2 PacketProcessingService Interface
The service is provided in model-flow-service from bundle of openflowplugin. Only one method available:
/**
* Sending packet out through openflow device.
*
*/
Future<RpcResult<java.lang.Void>> transmitPacket(TransmitPacketInput input);
2 Topology
We use following topology to test above method.
Network device and its corresponding ref inODL is :
3 packet-processing(2013-07-09)
We want to send raw packet from switch’s eth2 to network.
3.1 Java example code
Java sample code with