aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/tcp.py
diff options
context:
space:
mode:
authorJan Gelety <jgelety@cisco.com>2019-11-12 05:27:43 +0100
committerJan Gelety <jgelety@cisco.com>2019-11-28 18:26:21 +0100
commitd68951ac245150eeefa6e0f4156e4c1b5c9e9325 (patch)
tree487554a7547218d27f0a61ec02b70502c32cdcb4 /resources/libraries/python/tcp.py
parented0258a440cfad7023d643f717ab78ac568dc59b (diff)
Python3: resources and libraries
Change-Id: I1392c06b1d64f62b141d24c0d42a8e36913b15e2 Signed-off-by: Jan Gelety <jgelety@cisco.com>
Diffstat (limited to 'resources/libraries/python/tcp.py')
-rw-r--r--resources/libraries/python/tcp.py40
1 files changed, 16 insertions, 24 deletions
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)