1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. SPDX-License-Identifier: CC-BY-4.0
3 .. (c) Cisco Systems, Inc
5 NFVbench Server mode and NFVbench client API
6 ============================================
15 This request simply returns whatever content is sent in the body of the request (body should be in json format, only used for testing)
21 curl -XGET '127.0.0.1:7555/echo' -H "Content-Type: application/json" -d '{"nfvbench": "test"}'
28 <http-url>/status (GET)
29 ^^^^^^^^^^^^^^^^^^^^^^^
31 This request fetches the status of an asynchronous run. It will return in json format:
33 - a request pending reply (if the run is still not completed)
34 - an error reply if there is no run pending
35 - or the complete result of the run
37 The client can keep polling until the run completes.
39 Example of return when the run is still pending:
44 "error_message": "nfvbench run still pending",
48 Example of return when the run completes:
58 <http-url>/start_run (POST)
59 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
61 This request starts an NFVBench run with passed configurations. If no configuration is passed, a run with default configurations will be executed.
63 Example request: curl -XPOST 'localhost:7556/start_run' -H "Content-Type: application/json" -d @nfvbenchconfig.json
65 See "NFVbench configuration JSON parameter" below for details on how to format this parameter.
67 The request returns immediately with a json content indicating if there was an error (status=ERROR) or if the request was submitted successfully (status=PENDING).
68 Example of return when the submission is successful:
73 "error_message": "NFVbench run still pending",
74 "request_id": "42cccb7effdc43caa47f722f0ca8ec96",
78 If there is already an NFVBench running then it will return:
83 "error_message": "there is already an NFVbench request running",
88 NFVbench configuration JSON parameter
89 -------------------------------------
90 The NFVbench configuration describes the parameters of an NFVbench run and can be passed to the NFVbench server as a JSON document.
95 The simplest JSON document is the empty dictionary "{}" which indicates to use the default NFVbench configuration:
100 - 1 flow per direction
102 The entire default configuration can be viewed using the --show-json-config option on the cli:
106 # nfvbench --show-config
108 "availability_zone": null,
109 "compute_node_user": "root",
110 "compute_nodes": null,
116 "hw:cpu_policy": "dedicated",
117 "hw:mem_page_size": 2048
122 "flavor_type": "nfv.medium",
124 "generic_poll_sec": 2,
125 "generic_retry_count": 100,
127 "internal_networks": {
129 "name": "nfvbench-net0",
130 "subnet": "nfvbench-subnet0",
131 "cidr": "192.168.1.0/24",
134 "name": "nfvbench-net1",
135 "subnet": "nfvbench-subnet1",
136 "cidr": "192.168.2.0/24",
139 "name": "nfvbench-net2",
140 "subnet": "nfvbench-subnet2",
141 "cidr": "192.168.3.0/24",
146 "loop_vm_name": "nfvbench-loop-vm",
152 "name": "(built-in default config)",
155 "openrc_file": "/tmp/nfvbench/openstack/openrc",
157 "service_chain": "PVP",
158 "service_chain_count": 1,
162 "bidirectional": true,
163 "profile": "traffic_profile_64B"
165 "traffic_generator": {
166 "default_profile": "trex-local",
167 "gateway_ip_addrs": [
171 "gateway_ip_addrs_step": "0.0.0.1",
172 "generator_profile": [
179 "switch_port": "Ethernet1/33",
185 "switch_port": "Ethernet1/34",
191 "name": "trex-local",
195 "host_name": "nfvbench_tg",
200 "ip_addrs_step": "0.0.0.1",
206 "tg_gateway_ip_addrs": [
210 "tg_gateway_ip_addrs_step": "0.0.0.1"
217 "name": "traffic_profile_64B"
223 "name": "traffic_profile_IMIX"
229 "name": "traffic_profile_1518B"
237 "name": "traffic_profile_3sizes"
240 "unidir_reverse_traffic_pps": 1,
241 "vlan_tagging": true,
245 Common examples of JSON configuration
246 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
248 Use the default configuration but use 10000 flows per direction (instead of 1):
252 { "flow_count": 10000 }
255 Use default confguration but with 10000 flows, "EXT" chain and IMIX packet size:
261 "service_chain": "EXT",
263 "profile": "traffic_profile_IMIX"
267 A short run of 5 seconds at a fixed rate of 1Mpps (and everything else same as the default configuration):
276 Use the default configuration but force TRex restart:
285 Example of interaction with the NFVbench server using HTTP and curl
286 -------------------------------------------------------------------
287 HTTP requests can be sent directly to the NFVbench server from CLI using curl from any host that can connect to the server (here we run it from the local host).
289 This is a POST request to start a run using the default NFVbench configuration but with traffic generation disabled ("no_traffic" property is set to true):
293 [root@sjc04-pod3-mgmt ~]# curl -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"no_traffic":true}' http://127.0.0.1:7555/start_run
295 "error_message": "nfvbench run still pending",
298 [root@sjc04-pod3-mgmt ~]#
300 This request will return immediately with status set to "PENDING" if the request was started successfully.
302 The status can be polled until the run completes. Here the poll returns a "PENDING" status, indicating the run is still not completed:
306 [root@sjc04-pod3-mgmt ~]# curl -G http://127.0.0.1:7555/status
308 "error_message": "nfvbench run still pending",
311 [root@sjc04-pod3-mgmt ~]#
313 Finally, the status request returns a "OK" status along with the full results (truncated here):
317 [root@sjc04-pod3-mgmt ~]# curl -G http://127.0.0.1:7555/status
325 "bidirectional": true,
327 "nova:sjc04-pod3-compute-4": {
329 "Adjacent Cache Line Prefetcher": "Disabled",
330 "All Onboard LOM Ports": "Enabled",
331 "All PCIe Slots OptionROM": "Enabled",
335 "date": "2017-03-31 22:15:41",
336 "nfvbench_version": "0.3.5",
344 [root@sjc04-pod3-mgmt ~]#
348 Example of interaction with the NFVbench server using a python CLI app (nfvbench_client)
349 ----------------------------------------------------------------------------------------
350 The module client/client.py contains an example of python class that can be used to control the NFVbench server from a python app using HTTP.
352 The module client/nfvbench_client.py has a simple main application to control the NFVbench server from CLI.
353 The "nfvbench_client" wrapper script can be used to invoke the client front end (this wrapper is pre-installed in the NFVbench container)
355 Example of invocation of the nfvbench_client front end, from the host (assume the name of the NFVbench container is "nfvbench"),
356 use the default NFVbench configuration but do not generate traffic (no_traffic property set to true, the full json result is truncated here):
360 [root@sjc04-pod3-mgmt ~]# docker exec -it nfvbench nfvbench_client -c '{"no_traffic":true}' http://127.0.0.1:7555
361 {u'status': u'PENDING', u'error_message': u'nfvbench run still pending'}
362 {u'status': u'PENDING', u'error_message': u'nfvbench run still pending'}
363 {u'status': u'PENDING', u'error_message': u'nfvbench run still pending'}
365 {u'status': u'OK', u'result': {u'date': u'2017-03-31 22:04:59', u'nfvbench_version': u'0.3.5',
366 u'config': {u'compute_nodes': None, u'compute_node_user': u'root', u'traffic_generator': {u'tg_gateway_ip_addrs': [u'1.1.0.100', u'2.2.0.100'], u'ip_addrs_step': u'0.0.0.1',
367 u'step_mac': None, u'generator_profile': [{u'intf_speed': u'', u'interfaces': [{u'pci': u'0a:00.0', u'port': 0, u'vlan': 1998, u'switch_port': None},
371 [root@sjc04-pod3-mgmt ~]#