Search in sources :

Example 6 with IPv4

use of org.opendaylight.genius.mdsalutil.packet.IPv4 in project netvirt by opendaylight.

the class NaptEventHandler method buildNaptPacketOut.

@SuppressFBWarnings("PZLA_PREFER_ZERO_LENGTH_ARRAYS")
protected byte[] buildNaptPacketOut(Ethernet etherPkt) {
    LOG.debug("removeNatFlows : About to build Napt Packet Out");
    if (etherPkt.getPayload() instanceof IPv4) {
        byte[] rawPkt;
        IPv4 ipPkt = (IPv4) etherPkt.getPayload();
        if (ipPkt.getPayload() instanceof TCP || ipPkt.getPayload() instanceof UDP) {
            try {
                rawPkt = etherPkt.serialize();
                return rawPkt;
            } catch (PacketException e2) {
                LOG.error("failed to build NAPT Packet out ", e2);
                return null;
            }
        } else {
            LOG.error("removeNatFlows : Unable to build NaptPacketOut since its neither TCP nor UDP");
            return null;
        }
    }
    LOG.error("removeNatFlows : Unable to build NaptPacketOut since its not IPv4 packet");
    return null;
}
Also used : TCP(org.opendaylight.genius.mdsalutil.packet.TCP) UDP(org.opendaylight.genius.mdsalutil.packet.UDP) IPv4(org.opendaylight.genius.mdsalutil.packet.IPv4) PacketException(org.opendaylight.openflowplugin.libraries.liblldp.PacketException) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings)

Aggregations

IPv4 (org.opendaylight.genius.mdsalutil.packet.IPv4)6 Ethernet (org.opendaylight.genius.mdsalutil.packet.Ethernet)4 UDP (org.opendaylight.genius.mdsalutil.packet.UDP)4 PacketException (org.opendaylight.openflowplugin.libraries.liblldp.PacketException)4 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)2 BigInteger (java.math.BigInteger)2 TCP (org.opendaylight.genius.mdsalutil.packet.TCP)2 InetAddress (java.net.InetAddress)1 UnknownHostException (java.net.UnknownHostException)1 ExecutionException (java.util.concurrent.ExecutionException)1 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)1 ARP (org.opendaylight.genius.mdsalutil.packet.ARP)1 IEEE8021Q (org.opendaylight.genius.mdsalutil.packet.IEEE8021Q)1 DHCP (org.opendaylight.netvirt.dhcpservice.api.DHCP)1 Packet (org.opendaylight.openflowplugin.libraries.liblldp.Packet)1 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)1 VpnIds (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.id.to.vpn.instance.VpnIds)1