1 .. Copyright 2016 - 2023, Cisco Systems, Inc. and the NFVbench project contributors
2 .. SPDX-License-Identifier: CC-BY-4.0
4 NFVBENCH VM IMAGES FOR OPENSTACK
5 ++++++++++++++++++++++++++++++++
7 This repo will build two centos 7 images with:
8 - testpmd and VPP installed for loop VM use case
9 - NFVbench and TRex installed for generator VM use case
11 These VMs will come with a pre-canned user/password: nfvbench/nfvbench
19 - the following packages must be installed prior to using this script:
20 - python3 (+ python3-venv on Ubuntu)
23 - qemu-img (CentOs) or qemu-utils (Ubuntu)
26 .. note:: The image build process is based on `diskimage-builder
27 <https://docs.openstack.org/diskimage-builder/latest/index.html>`_
28 that will be installed in a Python virtual environment by nfvbenchvm
29 build script build-image.sh.
31 .. note:: build-image.sh uses the `gsutil <https://pypi.org/project/gsutil/>`_
32 tool to interact with Google cloud storage (to check if the images
33 exist and to upload the images). This is normally only needed in the
34 context of OPNFV build infrastructure, and build-image.sh can be used
35 without that tool in development environments.
40 - update the version number for the image (if needed) by modifying __version__ in build-image.sh
41 - setup your http_proxy if needed
42 - run ``build-image.sh`` to build the images. A few examples:
44 - to build all the images and publish the code to Google cloud storage:
45 - ``bash build-image.sh``
46 - to build and publish only the loop VM:
47 - ``bash build-image.sh -l``
48 - to build and publish only the generator VM:
49 - ``bash build-image.sh -g``
50 - to build the generator VM without publishing it:
51 - ``bash build-image.sh -gv``
53 .. note:: Run ``bash build-image.sh`` -h to see all options available.
55 .. note:: By default, the generator VM image embeds the latest nfvbench code
56 found at the time of the build on the master branch of NFVbench Git
57 repository on OPNFV Gerrit instance (latest commit).
59 During development phases, it is also possible to build the image with
60 all the committed changes found in the current working copy of
61 nfvbench (local code). To do that, run the image build with the ``-s``
62 option, for instance: ``bash build-image.sh -gvs``.
64 In that case, the version of the generator VM image will be extended
65 with nfvbench development version number to be able to distinguish the
66 development images from the latest published image.
68 LOOP VM IMAGE INSTANCE AND CONFIG
69 =================================
71 Interface Requirements
72 ----------------------
73 The instance must be launched using OpenStack with 2 network interfaces.
74 For best performance, it should use a flavor with:
78 - cpu pinning set to exclusive
82 nfvbench VM will automatically find the two virtual interfaces to use, and use the forwarder specifed in the config file.
84 In the case testpmd is used, testpmd will be launched with mac forwarding mode where the destination macs rewritten according to the config file.
86 In the case VPP is used, VPP will set up a L3 router, and forwarding traffic from one port to the other.
90 nfvbenchvm config file is located at ``/etc/nfvbenchvm.conf``.
95 INTF_MAC1=FA:16:3E:A2:30:41
96 INTF_MAC2=FA:16:3E:10:DA:10
97 TG_MAC1=00:10:94:00:0A:00
98 TG_MAC2=00:11:94:00:0A:00
99 VNF_GATEWAY1_CIDR=1.1.0.2/8
100 VNF_GATEWAY2_CIDR=2.2.0.2/8
103 TG_GATEWAY1_IP=1.1.0.100
104 TG_GATEWAY2_IP=2.2.0.100
107 Launching nfvbenchvm VM
108 -----------------------
110 Normally this image will be used together with NFVBench, and the required configurations will be automatically generated and pushed to VM by NFVBench. If launched manually, no forwarder will be run. Users will have the full control to run either testpmd or VPP via VNC console.
112 To check if testpmd is running, you can run this command in VNC console:
116 sudo screen -r testpmd
118 To check if VPP is running, you can run this command in VNC console:
125 Hardcoded Username and Password
126 --------------------------------
131 GENERATOR IMAGE INSTANCE AND CONFIG
132 ===================================
136 To use openstack APIs, NFVbench generator VM will use `clouds.yaml` file as openstack configuration.
137 The OpenStack clouds configuration from clouds.yaml file to use.
138 clouds.yaml file must be in one of the following paths:
139 - ~/.config/openstack
142 Example of `clouds.yaml`:
149 auth_url: http://192.168.122.10:35357/
153 region_name: RegionOne
155 .. note:: Add `CLOUD_DETAIL` property with the accurate value for your openstack configuration (`devstack` in the above example) in ``/etc/nfvbenchvm.conf``
157 Interface Requirements
158 ----------------------
159 The instance must be launched using OpenStack with 2 network interfaces for dataplane traffic (using SR-IOV function) and 1 management interface to control nfvbench.
160 For best performance, it should use network interfaces for dataplane traffic with a `vnic_type` to `direct-physical` (or `direct` if physical function is not possible)
165 - cpu pinning set to exclusive
167 .. note:: For the management interface: any interface type can be used. This interface required a routable IP (through floating IP or direct) and an access to the openstack APIs.
168 .. note:: CPU pinning: 1 core dedicated for guest OS and NFVbench process, other provided cores are used by TRex
170 Template of a genarator profile using CPU pinning:
178 zmq_pub_port: {{zmq_pub_port}}
179 zmq_rpc_port: {{zmq_rpc_port}}
180 software_mode: {{software_mode}}
183 master_thread_id: '0'
184 latency_thread_id: '1'
187 threads: [{{CORE_THREADS}}]
191 pci: "{{PCI_ADDRESS_1}}"
194 pci: "{{PCI_ADDRESS_2}}"
198 .. note:: `CORE_THREADS` value is determined automatically based on the cores available on the VM starting from 2 to last worker core available.
202 nfvbench VM will automatically find the two virtual interfaces to use for dataplane based on MAC addresses or openstack port name (see config part below).
203 This applies to the management interface as well.
207 nfvbenchvm config file is located at ``/etc/nfvbenchvm.conf``.
209 Example of configuration:
214 LOOPBACK_INTF_MAC1=FA:16:3E:A2:30:41
215 LOOPBACK_INTF_MAC2=FA:16:3E:10:DA:10
216 E2E_INTF_MAC1=FA:16:3E:B0:E2:43
217 E2E_INTF_MAC2=FA:16:3E:D3:6A:FC
219 .. note:: `ACTION` parameter is not mandatory but will permit to start NFVbench with the accurate ports (loopback or e2e).
220 .. note:: Set of MAC parameters cannot be used in parallel as only one NFVbench/TRex process is running.
221 .. note:: Switching from `loopback` to `e2e` action can be done manually using `/nfvbench/start-nfvbench.sh <action>` with the accurate keyword for `action` parameter. This script will restart NFVbench with the good set of MAC.
223 nfvbenchvm config file with management interface:
228 LOOPBACK_INTF_MAC1=FA:16:3E:A2:30:41
229 LOOPBACK_INTF_MAC2=FA:16:3E:10:DA:10
230 INTF_MAC_MGMT=FA:16:3E:06:11:8A
231 INTF_MGMT_CIDR=172.20.56.228/2
232 INTF_MGMT_IP_GW=172.20.56.225
235 .. note:: `INTF_MGMT_IP_GW` and `INTF_MGMT_CIDR` parameters are used by the VM to automatically configure virtual interface and route to allow an external access through SSH.
237 .. note:: ``INTF_MGMT_MTU`` allows to specify the MTU of the management
240 If ``INTF_MGMT_MTU`` is not specified, the MTU will be configured to
241 the conservative value of 1500: this will reduce the risk to get an
244 ``INTF_MGMT_MTU`` can also be set to the special value ``auto``: in
245 that case, the MTU will not be configured and it will keep the value
246 set by the hypervisor (default nfvbench behavior up to version
249 Using pre-created direct-physical ports on openstack, mac addresses value are only known when VM is deployed. In this case, you can pass the port name in config:
253 LOOPBACK_PORT_NAME1=nfvbench-pf1
254 LOOPBACK_PORT_NAME2=nfvbench-pf2
255 E2E_PORT_NAME1=nfvbench-pf1
256 E2E_PORT_NAME1=nfvbench-pf3
257 INTF_MAC_MGMT=FA:16:3E:06:11:8A
258 INTF_MGMT_CIDR=172.20.56.228/2
259 INTF_MGMT_IP_GW=172.20.56.225
260 DNS_SERVERS=8.8.8.8,dns.server.com
262 .. note:: A management interface is required to automatically find the virtual interface to use according to the MAC address provided (see `INTF_MAC_MGMT` parameter).
263 .. note:: NFVbench VM will call openstack API through the management interface to retrieve mac address for these ports
264 .. note:: If openstack API required a host name resolution, add the parameter DNS_SERVERS to add IP or DNS server names (multiple servers can be added separated by a `,`)
266 Control nfvbenchvm VM and run test
267 ----------------------------------
269 By default, NFVbench will be started in server mode (`--server`) and will act as an API.
271 NFVbench VM will be accessible through SSH or HTTP using the management interface IP.
273 NFVbench API endpoint is : `http://<management_ip>:<port>`
275 .. note:: by default port value is 7555
280 To check NFVbench is up and running use REST request:
284 curl -XGET '<management_ip>:<port>/status'
291 "error_message": "nfvbench run still pending",
298 To start a test run using NFVbench API use this type of REST request:
302 curl -XPOST '<management_ip>:<port>/start_run' -H "Content-Type: application/json" -d @nfvbenchconfig.json
304 Example of return when the submission is successful:
309 "error_message": "NFVbench run still pending",
310 "request_id": "42cccb7effdc43caa47f722f0ca8ec96",
315 Start NFVbench test using Xtesting
316 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
318 To start a test run using Xtesting python library and NFVbench API use this type of command on the VM:
322 run_tests -t nfvbench-demo
324 .. note:: `-t` option determine which test case to be runned by Xtesting
325 (see `xtesting/testcases.yaml` file content to see available list of test cases)
328 Connect to the VM using SSH keypair
329 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
331 If a key is provided at VM creation you can use it to log on the VM using `cloud-user` username:
335 ssh -i key.pem cloud-user@<management_ip>
338 Connect to VM using SSH username/password
339 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
341 VM is accessible over SSH using the hardcoded username and password (see below):
345 ssh nfvbench@<management_ip>
348 Launching nfvbenchvm VM
349 -----------------------
351 Normally this image will be deployed using Ansible role, and the required configurations will be automatically generated and pushed to VM by Ansible.
352 If launched manually, users will have the full control to configure and run NFVbench via VNC console.
354 To check if NFVbench is running, you can run this command in VNC console:
358 sudo screen -r nfvbench
361 Hardcoded Username and Password
362 --------------------------------