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;
}
Aggregations