X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2Ftcp.py;h=62cff2f4ff3b4a043ade552ff0865d57074b504e;hp=f3a24cbd06e7bbd5ab11f2e964f229f1dea15fc7;hb=d68951ac245150eeefa6e0f4156e4c1b5c9e9325;hpb=ed0258a440cfad7023d643f717ab78ac568dc59b 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)