diff options
author | Louis Scalbert <louis.scalbert@6wind.com> | 2023-12-26 14:33:58 +0100 |
---|---|---|
committer | Louis Scalbert <louis.scalbert@6wind.com> | 2024-01-11 14:13:46 +0100 |
commit | 1b3b4833421a9cf522330f7bd546f9e1daa0932a (patch) | |
tree | 99ed726e5f4b12ccfdc28652bb03babf4a501c5f /tests/topotests/bgp_rpki_topo1 | |
parent | topotests: add bgp_rpki_topo1 (diff) | |
download | frr-1b3b4833421a9cf522330f7bd546f9e1daa0932a.tar.xz frr-1b3b4833421a9cf522330f7bd546f9e1daa0932a.zip |
topotests: log bgp_rpki_topo1 pyrtr output
Log bgp_rpki_topo1 pyrtr output
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
Diffstat (limited to 'tests/topotests/bgp_rpki_topo1')
-rwxr-xr-x | tests/topotests/bgp_rpki_topo1/r1/rtrd.py | 8 | ||||
-rw-r--r-- | tests/topotests/bgp_rpki_topo1/test_bgp_rpki_topo1.py | 12 |
2 files changed, 16 insertions, 4 deletions
diff --git a/tests/topotests/bgp_rpki_topo1/r1/rtrd.py b/tests/topotests/bgp_rpki_topo1/r1/rtrd.py index f8277b475..d34539a8f 100755 --- a/tests/topotests/bgp_rpki_topo1/r1/rtrd.py +++ b/tests/topotests/bgp_rpki_topo1/r1/rtrd.py @@ -19,6 +19,7 @@ VRPS_FILE = os.path.join(sys.path[0], "vrps.csv") def dbg(m: str): print(m) + sys.stdout.flush() class RTRDatabase(object): @@ -316,4 +317,11 @@ def main(): if __name__ == "__main__": + if len(sys.argv) > 1: + f = open(sys.argv[1], "w") + sys.__stdout__ = f + sys.stdout = f + sys.__stderr__ = f + sys.stderr = f + main() diff --git a/tests/topotests/bgp_rpki_topo1/test_bgp_rpki_topo1.py b/tests/topotests/bgp_rpki_topo1/test_bgp_rpki_topo1.py index 5221b6963..e6b2c4c4f 100644 --- a/tests/topotests/bgp_rpki_topo1/test_bgp_rpki_topo1.py +++ b/tests/topotests/bgp_rpki_topo1/test_bgp_rpki_topo1.py @@ -51,12 +51,16 @@ def setup_module(mod): tgen.start_router() - r1_path = os.path.join(CWD, "r1") - global rtrd_process - tgen.gears["r1"].cmd("chmod u+x {}/rtrd.py".format(r1_path)) - rtrd_process = tgen.gears["r1"].popen("python3 {}/rtrd.py".format(r1_path)) + rname = "r1" + + rtr_path = os.path.join(CWD, rname) + log_dir = os.path.join(tgen.logdir, rname) + log_file = os.path.join(log_dir, "rtrd.log") + + tgen.gears[rname].cmd("chmod u+x {}/rtrd.py".format(rtr_path)) + rtrd_process = tgen.gears[rname].popen("{}/rtrd.py {}".format(rtr_path, log_file)) def teardown_module(mod): |