test: F2 acceptance — five of FILIUS' examples run as Java FILIUS runs them
ExampleRun opens an example as FILIUS opens it (SzenarioVerwaltung.laden into the window's lists), starts it as the action mode does, plays a story and writes every card's frames and tables, the calls, the addresses and the RIP tables' changes. examplesJava.test.ts reads the same file with this package's reader and runs it in the core (projectSnapshot, new): routing (internetwork_komplett), DHCP (einfaches_rechnernetz_komplett), DNS (dns_server), NAT (nat_with_mapped_port) and firewall (Internet_Komplett_..._DE) match card by card. Found and fixed: a host's ipForwardingEnabled, which Java saves and obeys, was unknown to the reader, the model, the core, the writer, the export and FlsOracle; and Java's ARP learns only from a request for its own address or a reply. Named Java bugs: a ping without a gateway throws a NullPointerException; a home router drops the answer of a second remote end. Open: Java picks between equally long RIP routes by thread timing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
// DhcpRun and TcpRun.
|
||||
|
||||
import filius.gui.GUIContainer;
|
||||
import filius.gui.netzwerksicht.GUIKnotenItem;
|
||||
import filius.rahmenprogramm.SzenarioVerwaltung;
|
||||
import filius.hardware.Kabel;
|
||||
import filius.hardware.NetzwerkInterface;
|
||||
import filius.hardware.Port;
|
||||
@@ -54,8 +56,40 @@ public class ScenarioNetwork {
|
||||
/** Each card's MAC address, under its node's id (the first card) or `id#index` (the others). */
|
||||
final Map<String, String> macByNode = new LinkedHashMap<>();
|
||||
final List<String> servers = new ArrayList<>();
|
||||
/** Loaded from a .fls file (fromFile): started as the action mode starts it, in the file's order. */
|
||||
boolean fromFile;
|
||||
/** fromFile: each card's MAC address and its node's name with the card's index, `name/index`. */
|
||||
final Map<String, String> cardByMac = new LinkedHashMap<>();
|
||||
long start;
|
||||
|
||||
/**
|
||||
* A .fls file loaded as FILIUS opens it (SzenarioVerwaltung.laden into the
|
||||
* window's lists): the nodes under their names (a repeated name gets
|
||||
* `#2`, `#3`, …), each card's frames under its MAC address.
|
||||
*/
|
||||
static ScenarioNetwork fromFile(String path) throws Exception {
|
||||
GUIContainer gui = GUIContainer.getGUIContainer();
|
||||
if (!SzenarioVerwaltung.getInstance().laden(path, gui.getKnotenItems(), gui.getCableItems(), gui.getDocuItems())) {
|
||||
throw new IllegalStateException("FILIUS could not load " + path);
|
||||
}
|
||||
ScenarioNetwork network = new ScenarioNetwork();
|
||||
network.fromFile = true;
|
||||
for (GUIKnotenItem item : gui.getKnotenItems()) {
|
||||
Knoten knoten = item.getKnoten();
|
||||
String name = knoten.getName();
|
||||
for (int count = 2; network.nodes.containsKey(name); count++) name = knoten.getName() + "#" + count;
|
||||
network.nodes.put(name, knoten);
|
||||
if (knoten instanceof InternetKnoten) {
|
||||
List<NetzwerkInterface> nics = ((InternetKnoten) knoten).getNetzwerkInterfaces();
|
||||
for (int index = 0; index < nics.size(); index++) {
|
||||
network.macByNode.put(nics.get(index).getMac(), nics.get(index).getMac());
|
||||
network.cardByMac.put(nics.get(index).getMac(), name + "/" + index);
|
||||
}
|
||||
}
|
||||
}
|
||||
return network;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
static ScenarioNetwork read(String path) throws Exception {
|
||||
Map<String, Object> scenario = (Map<String, Object>) new JsonReader(
|
||||
@@ -204,6 +238,12 @@ public class ScenarioNetwork {
|
||||
|
||||
/** Starts the simulation; times in the log count from here. */
|
||||
void start() throws InterruptedException {
|
||||
if (fromFile) {
|
||||
// GUIMainMenu.selectMode(MODUS_AKTION): every node in the window's order.
|
||||
start = System.currentTimeMillis();
|
||||
for (GUIKnotenItem item : GUIContainer.getGUIContainer().getKnotenItems()) item.getKnoten().getSystemSoftware().starten();
|
||||
return;
|
||||
}
|
||||
// Switches and DHCP servers first: FILIUS' client waits for every active
|
||||
// server to have started (waitUntilDhcpServerStarted, through the GUI's
|
||||
// node list, which this tool has not got).
|
||||
@@ -244,6 +284,11 @@ public class ScenarioNetwork {
|
||||
out.close('}');
|
||||
writeRows(out, "rows", true);
|
||||
writeRows(out, "layeredRows", false);
|
||||
if (fromFile) {
|
||||
out.key("cards").open('{');
|
||||
for (Map.Entry<String, String> entry : cardByMac.entrySet()) out.key(entry.getKey()).string(entry.getValue());
|
||||
out.close('}');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user