use of org.onlab.packet.UDP in project dhcpl2relay by opencord.
the class DhcpL2RelayTestBase method constructDhcpDeclinePacket.
/**
* Constructs DHCP Decline Packet.
*
* @return Ethernet packet
*/
Ethernet constructDhcpDeclinePacket(MacAddress clientMac) {
Ethernet pkt = construcEthernetPacket(clientMac, MacAddress.BROADCAST, "255.255.255.255", DHCP.OPCODE_REQUEST, clientMac, Ip4Address.valueOf("0.0.0.0"));
IPv4 ipv4Packet = (IPv4) pkt.getPayload();
UDP udpPacket = (UDP) ipv4Packet.getPayload();
DHCP dhcpPacket = (DHCP) udpPacket.getPayload();
dhcpPacket.setOptions(constructDhcpOptions(DHCP.MsgType.DHCPDECLINE));
return pkt;
}
Aggregations