Hi there,
we would like to implement a simple DHCP server module in our controller (v2.7.18). Since DHCP is not part of OpenFlow protocol, we have to inspect the payload to get the relevant data to form DHCP offer/ack messages. Here's the workflow we are following:
1. Create a rule that matches on UDP_SRC/DST 67/68 and send it to the controller (DONE)
2. Use OfmPacketIn.getData() to extract payload and access the byte[] to get relevant data (like XID, Hardware Address, etc). Not my favorite task, but doable. (DONE -- but it would be nice to be able to create a DHCP object from the raw data, and then use a static class to access the fields).
3. Create a packetout that contains the DHCP response. VAN's API has a DHCP and DHCP.Builder classes that I assume are target to this case. I am able to create a DHCP instance but I cannot figure out how to add it to the payload of the packetout message I am building.
Do I need to use Java's built-in libraries to serialize objects like::
public static byte[] serialize(Dhcp pkt) throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
ObjectOutputStream os = new ObjectOutputStream(out); os.writeObject(pkt);
return out.toByteArray();
}
Is there a different way to do it?
Thanks in advance for your suggestions!
#DHCP#VAN