@Test public void testForwardToHost() { Host host1 = new DefaultHost(PID, HID1, MAC1, VLAN1, LOC1, Collections.singleton(IP1)); Host host2 = new DefaultHost(PID, HID2, MAC2, VLAN1, LOC2, Collections.singleton(IP2)); expect(hostService.getHost(HID1)).andReturn(host1); expect(hostService.getHost(HID2)).andReturn(host2); replay(hostService); replay(interfaceService); Ethernet arpRequest = buildArp(ARP.OP_REPLY, VLAN1, MAC2, MAC1, IP2, IP1); proxyArp.forward(arpRequest, LOC2); assertEquals(1, packetService.packets.size()); OutboundPacket packet = packetService.packets.get(0); verifyPacketOut(arpRequest, LOC1, packet); }
@Override public void forward(Ethernet eth, ConnectPoint inPort) { checkPermission(PACKET_WRITE); checkNotNull(eth, REQUEST_NULL); Host h = hostService.getHost(hostId(eth.getDestinationMAC(), vlanId(eth.getVlanID()))); if (h == null) { flood(eth, inPort); } else { Host subject = hostService.getHost(hostId(eth.getSourceMAC(), vlanId(eth.getVlanID()))); store.forward(h.location(), subject, ByteBuffer.wrap(eth.serialize())); } }
ProxyArpManager implements ProxyArpService { @Override public void forward(Ethernet eth, ConnectPoint inPort) { checkPermission(PACKET_WRITE); checkNotNull(eth, REQUEST_NULL); Host h = hostService.getHost(hostId(eth.getDestinationMAC(), vlanId(eth.getVlanID()))); if (h == null) { flood(eth, inPort); } else { Host subject = hostService.getHost(hostId(eth.getSourceMAC(), vlanId(eth.getVlanID()))); store.forward(h.location(), subject, ByteBuffer.wrap(eth.serialize())); } } }
ProxyArpManager implements ProxyArpService { @Override public void forward(Ethernet eth, ConnectPoint inPort) { checkPermission(PACKET_WRITE); checkNotNull(eth, REQUEST_NULL); Host h = hostService.getHost(hostId(eth.getDestinationMAC(), vlanId(eth.getVlanID()))); if (h == null) { flood(eth, inPort); } else { Host subject = hostService.getHost(hostId(eth.getSourceMAC(), vlanId(eth.getVlanID()))); store.forward(h.location(), subject, ByteBuffer.wrap(eth.serialize())); } }  }
ProxyArpManager implements ProxyArpService { @Override public void forward(Ethernet eth, ConnectPoint inPort) { checkPermission(PACKET_WRITE); checkNotNull(eth, REQUEST_NULL); Host h = hostService.getHost(hostId(eth.getDestinationMAC(), vlanId(eth.getVlanID()))); if (h == null) { flood(eth, inPort); } else { Host subject = hostService.getHost(hostId(eth.getSourceMAC(), vlanId(eth.getVlanID()))); store.forward(h.location(), subject, ByteBuffer.wrap(eth.serialize())); } }  @Activate void activate(); @Deactivate void deactivate(); @Override boolean isKnown(IpAddress addr); @Override void reply(Ethernet eth, ConnectPoint inPort); @Override void forward(Ethernet eth, ConnectPoint inPort); @Override boolean handlePacket(PacketContext context); }
ProxyArpManager implements ProxyArpService { @Override public void forward(Ethernet eth, ConnectPoint inPort) { checkPermission(PACKET_WRITE); checkNotNull(eth, REQUEST_NULL); Host h = hostService.getHost(hostId(eth.getDestinationMAC(), vlanId(eth.getVlanID()))); if (h == null) { flood(eth, inPort); } else { Host subject = hostService.getHost(hostId(eth.getSourceMAC(), vlanId(eth.getVlanID()))); store.forward(h.location(), subject, ByteBuffer.wrap(eth.serialize())); } }  @Activate void activate(); @Deactivate void deactivate(); @Override boolean isKnown(IpAddress addr); @Override void reply(Ethernet eth, ConnectPoint inPort); @Override void forward(Ethernet eth, ConnectPoint inPort); @Override boolean handlePacket(PacketContext context);  }