From d68951ac245150eeefa6e0f4156e4c1b5c9e9325 Mon Sep 17 00:00:00 2001 From: Jan Gelety Date: Tue, 12 Nov 2019 05:27:43 +0100 Subject: Python3: resources and libraries Change-Id: I1392c06b1d64f62b141d24c0d42a8e36913b15e2 Signed-off-by: Jan Gelety --- resources/libraries/python/tcp.py | 40 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 24 deletions(-) (limited to 'resources/libraries/python/tcp.py') diff --git a/resources/libraries/python/tcp.py b/resources/libraries/python/tcp.py index f3a24cbd06..62cff2f4ff 100644 --- a/resources/libraries/python/tcp.py +++ b/resources/libraries/python/tcp.py @@ -11,27 +11,24 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""TCP util library. -""" +"""TCP util library.""" -from resources.libraries.python.PapiExecutor import PapiSocketExecutor from resources.libraries.python.Constants import Constants +from resources.libraries.python.PapiExecutor import PapiSocketExecutor -class TCPUtils(object): - """Implementation of the TCP utilities. - """ - www_root_dir = '{rmt_fw_dir}/{wrk_www}'\ - .format(rmt_fw_dir=Constants.REMOTE_FW_DIR, - wrk_www=Constants.RESOURCES_TP_WRK_WWW) +class TCPUtils: + """Implementation of the TCP utilities.""" + + www_root_dir = f"{Constants.REMOTE_FW_DIR}/{Constants.RESOURCES_TP_WRK_WWW}" def __init__(self): pass @classmethod - def start_vpp_http_server_params(cls, node, http_static_plugin, - prealloc_fifos, fifo_size, - private_segment_size): + def start_vpp_http_server_params( + cls, node, http_static_plugin, prealloc_fifos, fifo_size, + private_segment_size): """Start the test HTTP server internal application or the HTTP static server plugin internal applicatoin on the given node. @@ -73,16 +70,11 @@ class TCPUtils(object): :type fifo_size: str :type private_segment_size: str """ - if http_static_plugin: - cmd = 'http static server www-root {www_root} '\ - 'prealloc-fifos {prealloc_fifos} fifo-size {fifo_size}'\ - ' private-segment-size {pvt_seg_size}'\ - .format(www_root=cls.www_root_dir, - prealloc_fifos=prealloc_fifos, fifo_size=fifo_size, - pvt_seg_size=private_segment_size) - else: - cmd = 'test http server static prealloc-fifos {prealloc_fifos} '\ - 'fifo-size {fifo_size} private-segment-size {pvt_seg_size}'\ - .format(prealloc_fifos=prealloc_fifos, fifo_size=fifo_size, - pvt_seg_size=private_segment_size) + cmd = f"http static server www-root {cls.www_root_dir} " \ + f"prealloc-fifos {prealloc_fifos} fifo-size {fifo_size} " \ + f"private-segment-size {private_segment_size}" \ + if http_static_plugin \ + else f"test http server static prealloc-fifos {prealloc_fifos} " \ + f"fifo-size {fifo_size} private-segment-size {private_segment_size}" + PapiSocketExecutor.run_cli_cmd(node, cmd) -- cgit 1.2.3-korg