Search in sources :

Example 46 with UDP

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;
}
Also used : UDP(org.onlab.packet.UDP) Ethernet(org.onlab.packet.Ethernet) IPv4(org.onlab.packet.IPv4) DHCP(org.onlab.packet.DHCP)

Aggregations

UDP (org.onlab.packet.UDP)46 Ethernet (org.onlab.packet.Ethernet)36 IPv4 (org.onlab.packet.IPv4)24 DHCP (org.onlab.packet.DHCP)19 IPv6 (org.onlab.packet.IPv6)17 DHCP6 (org.onlab.packet.DHCP6)16 ConnectPoint (org.onosproject.net.ConnectPoint)12 ArrayList (java.util.ArrayList)10 Test (org.junit.Test)10 MacAddress (org.onlab.packet.MacAddress)10 Interface (org.onosproject.net.intf.Interface)9 VlanId (org.onlab.packet.VlanId)8 DhcpOption (org.onlab.packet.dhcp.DhcpOption)8 DhcpServerInfo (org.onosproject.dhcprelay.api.DhcpServerInfo)8 DefaultTrafficTreatment (org.onosproject.net.flow.DefaultTrafficTreatment)8 TrafficTreatment (org.onosproject.net.flow.TrafficTreatment)8 IpAddress (org.onlab.packet.IpAddress)7 DeviceId (org.onosproject.net.DeviceId)7 DefaultTrafficSelector (org.onosproject.net.flow.DefaultTrafficSelector)7 TrafficSelector (org.onosproject.net.flow.TrafficSelector)7