summaryrefslogtreecommitdiff
path: root/tests/topotests/lib/topogen.py
diff options
context:
space:
mode:
authorHiroki Shirokura <slank.dev@gmail.com>2021-09-07 03:55:01 +0000
committerHiroki Shirokura <slank.dev@gmail.com>2021-09-07 03:55:04 +0000
commite03862c34a31ad716d56cc90cd67446125d614e9 (patch)
tree5436a36fe6e474d38e5d30e19aaf61bdc22884df /tests/topotests/lib/topogen.py
parenta76cd3242acae4cb6e20724df92877d1f7348230 (diff)
topotests: to create pid file of topotest router
Create a pid file for the router created by topotest. By executing nsenter directly against this pid, developers can execute commands directly from outside the unet shell. This allows the developer to use script, tab completion, etc., and improves efficiency. Signed-off-by: Hiroki Shirokura <slank.dev@gmail.com>
Diffstat (limited to 'tests/topotests/lib/topogen.py')
-rw-r--r--tests/topotests/lib/topogen.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/topotests/lib/topogen.py b/tests/topotests/lib/topogen.py
index 325f65dd6f..a76ceaf16b 100644
--- a/tests/topotests/lib/topogen.py
+++ b/tests/topotests/lib/topogen.py
@@ -771,6 +771,10 @@ class TopoRouter(TopoGear):
# Mount gear log directory on a common path
self.net.bind_mount(self.gearlogdir, "/tmp/gearlogdir")
+ # Ensure pid file
+ with open(os.path.join(self.logdir, self.name + ".pid"), "w") as f:
+ f.write(str(tgen.net.hosts[self.name].pid))
+
def __str__(self):
gear = super(TopoRouter, self).__str__()
gear += " TopoRouter<>"