test(java-oracle): NatRun records the home router's NAT as Java FILIUS runs it
ScenarioNetwork builds home routers (their first card the WAN port) and their port forwarding (portForwarding, through GatewayFirmware.setStaticNAT). NatRun plays six stories on nat-home's network and writes the frames, the calls and the router's NAT table: a ping, a UDP exchange, the same socket to a second server (whose answer never reaches the LAN: Java keeps one entry per LAN endpoint, for the first remote only), a TCP connection out, a forwarded one in, and pings at the WAN address and past it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,7 @@ import filius.gui.GUIContainer;
|
||||
import filius.hardware.Kabel;
|
||||
import filius.hardware.NetzwerkInterface;
|
||||
import filius.hardware.Port;
|
||||
import filius.hardware.knoten.Gateway;
|
||||
import filius.hardware.knoten.InternetKnoten;
|
||||
import filius.hardware.knoten.Knoten;
|
||||
import filius.hardware.knoten.LokalerKnoten;
|
||||
@@ -21,6 +22,7 @@ import filius.rahmenprogramm.nachrichten.Lauscher;
|
||||
import filius.software.dhcp.DHCPServer;
|
||||
import filius.software.dns.DNSServer;
|
||||
import filius.software.netzzugangsschicht.EthernetFrame;
|
||||
import filius.software.system.GatewayFirmware;
|
||||
import filius.software.system.InternetKnotenBetriebssystem;
|
||||
import filius.software.system.VermittlungsrechnerBetriebssystem;
|
||||
import filius.software.transportschicht.Segment;
|
||||
@@ -90,6 +92,10 @@ public class ScenarioNetwork {
|
||||
knoten = new Vermittlungsrechner();
|
||||
((InternetKnoten) knoten).setzeAnzahlAnschluesse(nodePorts.size());
|
||||
break;
|
||||
case "gateway":
|
||||
// Its first card is the WAN port, its second the LAN port.
|
||||
knoten = new Gateway();
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("node kind " + kind + " is not built by this tool");
|
||||
}
|
||||
@@ -165,6 +171,12 @@ public class ScenarioNetwork {
|
||||
for (Object each : list(scenario.getOrDefault("dhcpClients", new ArrayList<>()))) {
|
||||
system(nodes.get((String) each)).setDHCPKonfiguration(true);
|
||||
}
|
||||
// A home router's port forwarding: rows of protocol, public port, LAN address, LAN port.
|
||||
for (Map.Entry<String, Object> entry : map(scenario.getOrDefault("portForwarding", new HashMap<>())).entrySet()) {
|
||||
LinkedList<String[]> rows = new LinkedList<>();
|
||||
for (Object row : list(entry.getValue())) rows.add(list(row).stream().map(String::valueOf).toArray(String[]::new));
|
||||
((GatewayFirmware) system(nodes.get(entry.getKey()))).setStaticNAT(rows);
|
||||
}
|
||||
for (Object each : list(scenario.getOrDefault("rip", new ArrayList<>()))) {
|
||||
((VermittlungsrechnerBetriebssystem) system(nodes.get((String) each))).setRipEnabled(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user