1 # Copyright (c) 2018 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
6 # http://www.apache.org/licenses/LICENSE-2.0
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
17 from resources.libraries.python.VatExecutor import VatTerminal
20 class TCPUtils(object):
21 """Implementation of the TCP utilities.
28 def start_http_server(node):
29 """Start HTTP server on the given node.
31 :param node: Node to start HTTP server on.
35 with VatTerminal(node) as vat:
36 vat.vat_terminal_exec_cmd_from_template(
37 "start_http_server.vat")
40 def start_http_server_params(node, prealloc_fifos, fifo_size,
41 private_segment_size):
42 """Start HTTP server on the given node.
44 test http server static prealloc-fifos <N> fifo-size <size in kB>
45 private-segment-size <seg_size expressed as number + unit, e.g. 100m>
47 Where N is the max number of connections you expect to handle at one
48 time and <size> should be small if you test for CPS and exchange few
49 bytes, say 4, if each connection just exchanges few packets. Or it
50 should be much larger, up to 1024/4096 (i.e. 1-4MB) if you have only
51 one connection and exchange a lot of packets, i.e., when you test for
52 RPS. If you need to allocate lots of FIFOs, so you test for CPS, make
53 private-segment-size something like 4g.
58 test http server static prealloc-fifos 10000 fifo-size 64
59 private-segment-size 4000m
62 test http server static prealloc-fifos 500000 fifo-size 4
63 test http server static prealloc-fifos 500000 fifo-size 4
64 private-segment-size 4000m
66 :param node: Node to start HTTP server on.
67 :param prealloc_fifos: Max number of connections you expect to handle at
69 :param fifo_size: FIFO size in kB.
70 :param private_segment_size: Private segment size. Number + unit.
72 :type prealloc_fifos: str
74 :type private_segment_size: str
77 with VatTerminal(node, json_param=False) as vat:
78 vat.vat_terminal_exec_cmd_from_template(
79 "start_http_server_params.vat",
80 prealloc_fifos=prealloc_fifos,
82 private_segment_size=private_segment_size)