test(java-oracle): ArpRun records ARP as Java FILIUS runs it

Sends to addresses no card has on the new arp-routed network (ping on the
LAN and behind a router, two UDP datagrams, one behind a failing one):
frames and calls. ScenarioNetwork builds routers and their interfaces.

Measured: ARP asks twice, a round trip each, then host unreachable; the
thread that waits is the ping's caller, the router's IP thread, or the
node's transport thread per protocol, which blocks the next send.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-30 17:01:39 +00:00
co-authored by Claude Opus 5.5
parent 8869c865b1
commit 67fb608412
9 changed files with 651 additions and 8 deletions
+23 -7
View File
@@ -16,6 +16,7 @@ import filius.hardware.knoten.LokalerKnoten;
import filius.hardware.knoten.Notebook;
import filius.hardware.knoten.Rechner;
import filius.hardware.knoten.Switch;
import filius.hardware.knoten.Vermittlungsrechner;
import filius.rahmenprogramm.nachrichten.Lauscher;
import filius.software.dhcp.DHCPServer;
import filius.software.dns.DNSServer;
@@ -59,6 +60,7 @@ public class ScenarioNetwork {
private void build(Map<String, Object> scenario) {
Map<String, Port> ports = new HashMap<>();
Map<String, NetzwerkInterface> nicsByPort = new HashMap<>();
for (Object each : list(scenario.get("nodes"))) {
Map<String, Object> node = map(each);
String id = (String) node.get("id");
@@ -75,18 +77,25 @@ public class ScenarioNetwork {
case "networkSwitch":
knoten = new Switch();
break;
case "router":
knoten = new Vermittlungsrechner();
((InternetKnoten) knoten).setzeAnzahlAnschluesse(nodePorts.size());
break;
default:
throw new IllegalArgumentException("node kind " + kind + " is not built by this tool");
}
knoten.setName(id);
if (knoten instanceof InternetKnoten) {
if (nodePorts.size() != 1) throw new IllegalArgumentException("a host has one port here");
Map<String, Object> port = map(nodePorts.get(0));
NetzwerkInterface nic = ((InternetKnoten) knoten).getNetzwerkInterfaces().get(0);
String mac = port.containsKey("mac") ? (String) port.get("mac") : stableMac((String) port.get("id"));
nic.setMac(mac);
ports.put((String) port.get("id"), nic.getPort());
macByNode.put(id, mac);
List<NetzwerkInterface> nics = ((InternetKnoten) knoten).getNetzwerkInterfaces();
for (int index = 0; index < nodePorts.size(); index++) {
Map<String, Object> port = map(nodePorts.get(index));
NetzwerkInterface nic = nics.get(index);
String mac = port.containsKey("mac") ? (String) port.get("mac") : stableMac((String) port.get("id"));
nic.setMac(mac);
ports.put((String) port.get("id"), nic.getPort());
nicsByPort.put((String) port.get("id"), nic);
if (index == 0) macByNode.put(id, mac);
}
} else {
LinkedList<Port> switchPorts = ((LokalerKnoten) knoten).getAnschluesse();
for (int index = 0; index < nodePorts.size(); index++) {
@@ -103,6 +112,13 @@ public class ScenarioNetwork {
nic.setGateway((String) device.getOrDefault("gateway", ""));
nic.setDns((String) device.getOrDefault("dns", ""));
}
// A router's other cards: `interfaces` names them by port.
for (Object each : list(scenario.getOrDefault("interfaces", new ArrayList<>()))) {
Map<String, Object> item = map(each);
NetzwerkInterface nic = nicsByPort.get(item.get("port"));
nic.setIp((String) item.get("ip"));
nic.setSubnetzMaske((String) item.get("mask"));
}
for (Object each : list(scenario.get("links"))) {
Map<String, Object> link = map(each);
Kabel cable = new Kabel();