@Test public void testSingleForwardFromTransportLayer() { ForwarderSwitch device = new ForwarderSwitch(0, null, 5, new IdentityFlowletIntermediary()); device.addConnection(topology.getPort(0, 1)); device.setDestinationToNextSwitch(1, 1); device.setDestinationToNextSwitch(2, 1); device.setDestinationToNextSwitch(3, 1); device.setDestinationToNextSwitch(4, 1); when(packet.getDestinationId()).thenReturn(4); device.receiveFromTransportLayer(packet); verify(topology.getPort(0, 1), times(1)).enqueue(packet); }
void setDestinationToNextSwitch(int destinationId, int nextHopId) { if (!connectedTo.contains(nextHopId)) { throw new IllegalArgumentException("Cannot add hop to a network device to which it is not connected (" + nextHopId + ")"); } this.destinationToNextSwitch[destinationId] = nextHopId; }
ForwarderSwitch extends NetworkDevice { void setDestinationToNextSwitch(int destinationId, int nextHopId) { if (!connectedTo.contains(nextHopId)) { throw new IllegalArgumentException("Cannot add hop to a network device to which it is not connected (" + nextHopId + ")"); } this.destinationToNextSwitch[destinationId] = nextHopId; } }
ForwarderSwitch extends NetworkDevice { void setDestinationToNextSwitch(int destinationId, int nextHopId) { if (!connectedTo.contains(nextHopId)) { throw new IllegalArgumentException("Cannot add hop to a network device to which it is not connected (" + nextHopId + ")"); } this.destinationToNextSwitch[destinationId] = nextHopId; } ForwarderSwitch(int identifier, TransportLayer transportLayer, int n, Intermediary intermediary); }
ForwarderSwitch extends NetworkDevice { void setDestinationToNextSwitch(int destinationId, int nextHopId) { if (!connectedTo.contains(nextHopId)) { throw new IllegalArgumentException("Cannot add hop to a network device to which it is not connected (" + nextHopId + ")"); } this.destinationToNextSwitch[destinationId] = nextHopId; } ForwarderSwitch(int identifier, TransportLayer transportLayer, int n, Intermediary intermediary); @Override void receive(Packet genericPacket); @Override void receiveFromIntermediary(Packet genericPacket); @Override String toString(); }
ForwarderSwitch extends NetworkDevice { void setDestinationToNextSwitch(int destinationId, int nextHopId) { if (!connectedTo.contains(nextHopId)) { throw new IllegalArgumentException("Cannot add hop to a network device to which it is not connected (" + nextHopId + ")"); } this.destinationToNextSwitch[destinationId] = nextHopId; } ForwarderSwitch(int identifier, TransportLayer transportLayer, int n, Intermediary intermediary); @Override void receive(Packet genericPacket); @Override void receiveFromIntermediary(Packet genericPacket); @Override String toString();  }