- command = f"sh -c \"" \
- f"{Constants.REMOTE_FW_DIR}/resources/tools/trex/" \
- f"trex_stateless_profile.py " \
- f"--profile {Constants.REMOTE_FW_DIR}/resources/" \
- f"traffic_profiles/trex/{traffic_profile}.py " \
- f"--duration {duration!r} --frame_size {frame_size} " \
- f"--rate {rate!r} --warmup_time {warmup_time!r} " \
- f"--port_0 {p_0} --port_1 {p_1} " \
- f"--traffic_directions {traffic_directions}"
- if async_call:
- command += u" --async_start"
- if latency:
- command += u" --latency"
- if Constants.TREX_SEND_FORCE:
- command += u" --force"
- command += u"\""
+
+ command_line = OptionString().add(u"python3")
+ dirname = f"{Constants.REMOTE_FW_DIR}/GPL/tools/trex"
+ command_line.add(f"'{dirname}/trex_stateless_profile.py'")
+ command_line.change_prefix(u"--")
+ dirname = f"{Constants.REMOTE_FW_DIR}/GPL/traffic_profiles/trex"
+ quoted_path = f"'{dirname}/{traffic_profile}.py'"
+ command_line.add_with_value(u"profile", quoted_path)
+ command_line.add_with_value(u"duration", f"{duration!r}")
+ command_line.add_with_value(u"frame_size", frame_size)
+ command_line.add_with_value(u"rate", f"{rate!r}")
+ command_line.add_with_value(u"warmup_time", f"{warmup_time!r}")
+ command_line.add_with_value(u"port_0", p_0)
+ command_line.add_with_value(u"port_1", p_1)
+ command_line.add_with_value(u"traffic_directions", traffic_directions)
+ command_line.add_if(u"async_start", async_call)
+ command_line.add_if(u"latency", latency)
+ command_line.add_if(u"force", Constants.TREX_SEND_FORCE)