@Test public void testSendPacketOut_NullEgress() throws Exception { packetDispatcher.sendPacketOut(null, new NodeConnectorRef(InstanceIdentifier.create(NodeConnector.class)), null); verify(packetProcessingService, times(0)).transmitPacket(any(TransmitPacketInput.class)); }
public void sendPacketOut(byte[] payload, NodeConnectorRef ingress, NodeConnectorRef egress) { if (ingress == null || egress == null) { return; } InstanceIdentifier<Node> egressNodePath = getNodePath(egress.getValue()); TransmitPacketInput input = new TransmitPacketInputBuilder() .setPayload(payload) .setNode(new NodeRef(egressNodePath)) .setEgress(egress) .setIngress(ingress) .build(); Futures.addCallback(JdkFutureAdapters.listenInPoolThread(packetProcessingService.transmitPacket(input)), new FutureCallback<RpcResult<Void>>() { @Override public void onSuccess(RpcResult<Void> result) { LOG.debug("transmitPacket was successful"); } @Override public void onFailure(Throwable failure) { LOG.debug("transmitPacket for {} failed", input, failure); } }, MoreExecutors.directExecutor()); }
PacketDispatcher { public void sendPacketOut(byte[] payload, NodeConnectorRef ingress, NodeConnectorRef egress) { if (ingress == null || egress == null) { return; } InstanceIdentifier<Node> egressNodePath = getNodePath(egress.getValue()); TransmitPacketInput input = new TransmitPacketInputBuilder() .setPayload(payload) .setNode(new NodeRef(egressNodePath)) .setEgress(egress) .setIngress(ingress) .build(); Futures.addCallback(JdkFutureAdapters.listenInPoolThread(packetProcessingService.transmitPacket(input)), new FutureCallback<RpcResult<Void>>() { @Override public void onSuccess(RpcResult<Void> result) { LOG.debug("transmitPacket was successful"); } @Override public void onFailure(Throwable failure) { LOG.debug("transmitPacket for {} failed", input, failure); } }, MoreExecutors.directExecutor()); } }
PacketDispatcher { public void sendPacketOut(byte[] payload, NodeConnectorRef ingress, NodeConnectorRef egress) { if (ingress == null || egress == null) { return; } InstanceIdentifier<Node> egressNodePath = getNodePath(egress.getValue()); TransmitPacketInput input = new TransmitPacketInputBuilder() .setPayload(payload) .setNode(new NodeRef(egressNodePath)) .setEgress(egress) .setIngress(ingress) .build(); Futures.addCallback(JdkFutureAdapters.listenInPoolThread(packetProcessingService.transmitPacket(input)), new FutureCallback<RpcResult<Void>>() { @Override public void onSuccess(RpcResult<Void> result) { LOG.debug("transmitPacket was successful"); } @Override public void onFailure(Throwable failure) { LOG.debug("transmitPacket for {} failed", input, failure); } }, MoreExecutors.directExecutor()); }  }
PacketDispatcher { public void sendPacketOut(byte[] payload, NodeConnectorRef ingress, NodeConnectorRef egress) { if (ingress == null || egress == null) { return; } InstanceIdentifier<Node> egressNodePath = getNodePath(egress.getValue()); TransmitPacketInput input = new TransmitPacketInputBuilder() .setPayload(payload) .setNode(new NodeRef(egressNodePath)) .setEgress(egress) .setIngress(ingress) .build(); Futures.addCallback(JdkFutureAdapters.listenInPoolThread(packetProcessingService.transmitPacket(input)), new FutureCallback<RpcResult<Void>>() { @Override public void onSuccess(RpcResult<Void> result) { LOG.debug("transmitPacket was successful"); } @Override public void onFailure(Throwable failure) { LOG.debug("transmitPacket for {} failed", input, failure); } }, MoreExecutors.directExecutor()); }  void setPacketProcessingService(PacketProcessingService packetProcessingService); void setInventoryReader(InventoryReader inventoryReader); void dispatchPacket(byte[] payload, NodeConnectorRef ingress, MacAddress srcMac, MacAddress destMac); void floodPacket(String nodeId, byte[] payload, NodeConnectorRef origIngress,
            NodeConnectorRef controllerNodeConnector); void sendPacketOut(byte[] payload, NodeConnectorRef ingress, NodeConnectorRef egress); }
PacketDispatcher { public void sendPacketOut(byte[] payload, NodeConnectorRef ingress, NodeConnectorRef egress) { if (ingress == null || egress == null) { return; } InstanceIdentifier<Node> egressNodePath = getNodePath(egress.getValue()); TransmitPacketInput input = new TransmitPacketInputBuilder() .setPayload(payload) .setNode(new NodeRef(egressNodePath)) .setEgress(egress) .setIngress(ingress) .build(); Futures.addCallback(JdkFutureAdapters.listenInPoolThread(packetProcessingService.transmitPacket(input)), new FutureCallback<RpcResult<Void>>() { @Override public void onSuccess(RpcResult<Void> result) { LOG.debug("transmitPacket was successful"); } @Override public void onFailure(Throwable failure) { LOG.debug("transmitPacket for {} failed", input, failure); } }, MoreExecutors.directExecutor()); }  void setPacketProcessingService(PacketProcessingService packetProcessingService); void setInventoryReader(InventoryReader inventoryReader); void dispatchPacket(byte[] payload, NodeConnectorRef ingress, MacAddress srcMac, MacAddress destMac); void floodPacket(String nodeId, byte[] payload, NodeConnectorRef origIngress,
            NodeConnectorRef controllerNodeConnector); void sendPacketOut(byte[] payload, NodeConnectorRef ingress, NodeConnectorRef egress);  }