ReactiveFlowWriter implements ArpPacketListener { @Override public void onArpPacketReceived(ArpPacketReceived packetReceived) { if (packetReceived == null || packetReceived.getPacketChain() == null) { return; } RawPacket rawPacket = null; EthernetPacket ethernetPacket = null; ArpPacket arpPacket = null; for (PacketChain packetChain : packetReceived.getPacketChain()) { if (packetChain.getPacket() instanceof RawPacket) { rawPacket = (RawPacket) packetChain.getPacket(); } else if (packetChain.getPacket() instanceof EthernetPacket) { ethernetPacket = (EthernetPacket) packetChain.getPacket(); } else if (packetChain.getPacket() instanceof ArpPacket) { arpPacket = (ArpPacket) packetChain.getPacket(); } } if (rawPacket == null || ethernetPacket == null || arpPacket == null) { return; } MacAddress destMac = ethernetPacket.getDestinationMac(); if (!ignoreThisMac(destMac)) { writeFlows(rawPacket.getIngress(), ethernetPacket.getSourceMac(), ethernetPacket.getDestinationMac()); } } ReactiveFlowWriter(InventoryReader inventoryReader, FlowWriterService flowWriterService); @Override void onArpPacketReceived(ArpPacketReceived packetReceived); void writeFlows(NodeConnectorRef ingress, MacAddress srcMac, MacAddress destMac);  }
@Test public void onArpPacketReceivedTest() { ArpPacketReceived arpPacketReceived = new ArpPacketReceivedBuilder().setPacketChain(packetChainList).build(); reactiveFlowWriter.onArpPacketReceived(arpPacketReceived); }