Recreate bench network after calibration to clear NAT and conntrack state
This commit is contained in:
1 parent
0766880a59
commit
5f1230f7fc
2 files changed
+11
-3
No files matched your search
@@ -57,13 +57,14 @@ class Network:
|
||||
self.namespaces = {}
|
||||
self.children = []
|
||||
self.serial = 0
|
||||
self.log = (self.directory / "network.jsonl").open("w", buffering=1)
|
||||
self.log = (self.directory / "network.jsonl").open("a", buffering=1)
|
||||
|
||||
def command(self, name, arguments, *, input=None, check=True):
|
||||
prefix = self.prefix(name)
|
||||
started = time.monotonic()
|
||||
result = subprocess.run(prefix + list(arguments), input=input, text=True, capture_output=True, timeout=20)
|
||||
self.log.write(json.dumps({"time": started, "namespace": name, "argv": list(arguments),
|
||||
inode = self.namespaces[name][1] if name else self.controller
|
||||
self.log.write(json.dumps({"time": started, "namespace": name, "inode": inode, "argv": list(arguments),
|
||||
"rc": result.returncode, "stdout": result.stdout, "stderr": result.stderr}) + "\n")
|
||||
if check and result.returncode:
|
||||
raise RuntimeError(f"{name}: {' '.join(arguments)}: {result.stderr.strip() or result.stdout.strip()}")
|
||||
|
||||
@@ -49,7 +49,7 @@ def inside(args):
|
||||
try:
|
||||
print("Creating 25 isolated network namespaces (16 nodes, 3 routers, 6 NAT gateways)", flush=True)
|
||||
network.build()
|
||||
network.snapshot("initial")
|
||||
network.snapshot("calibration-initial")
|
||||
print("Calibrating WAN RTT and all 10 NAT clients", flush=True)
|
||||
probes.start()
|
||||
calibration = probes.calibrate()
|
||||
@@ -59,6 +59,13 @@ def inside(args):
|
||||
if args.network_only:
|
||||
result["pass"] = True
|
||||
else:
|
||||
# Пробы не оставляют открытых mappings/conntrack для настоящих процессов uTun.
|
||||
network.snapshot("calibrated")
|
||||
network.close()
|
||||
print("Recreating network with empty NAT mappings and conntrack", flush=True)
|
||||
network = Network(directory, args.seed, args.host_netns)
|
||||
network.build()
|
||||
network.snapshot("initial")
|
||||
scenario = Scenario(network, args)
|
||||
result = scenario.run()
|
||||
except BaseException as error:
|
||||
|
||||
Reference in new issue
Block a user