NFVBENCH-158 Allow multiple UDP ports in traffic generation
[nfvbench.git] / docs / testing / user / userguide / advanced.rst
index 1d2ac36..5307bd0 100644 (file)
@@ -78,6 +78,22 @@ Used parameters:
 * ``--no-traffic`` or ``-0`` : sending traffic from traffic generator is skipped
 
 
+TRex force restart
+------------------------------------
+
+NFVbench allows to restart TRex traffic generator between runs.
+It runs the whole test, but restart TRex instance before generating new traffic.
+
+To force restart, use the --restart option:
+
+.. code-block:: bash
+
+    nfvbench --restart
+
+Used parameters:
+
+* ``--restart`` : restart traffic generator (TRex)
+
 
 Fixed Rate Run
 --------------
@@ -201,7 +217,7 @@ For example to run NFVbench with 3 PVP chains:
 
 It is not necessary to specify the service chain type (-sc) because PVP is set as default. The PVP service chains will have 3 VMs in 3 chains with this configuration.
 If ``-sc PVVP`` is specified instead, there would be 6 VMs in 3 chains as this service chain has 2 VMs per chain.
-Both **single run** or **NDR/PDR** can be run as multichain. Runnin multichain is a scenario closer to a real life situation than runs with a single chain.
+Both **single run** or **NDR/PDR** can be run as multichain. Running multichain is a scenario closer to a real life situation than runs with a single chain.
 
 
 Multiflow
@@ -247,6 +263,24 @@ These can also be written in CIDR notation to represent the subnet.
 The corresponding ``step`` is used for ranging the IP addresses from the `ip_addrs``, ``tg_gateway_ip_addrs`` and ``gateway_ip_addrs`` base addresses.
 0.0.0.1 is the default step for all IP ranges. In ``ip_addrs``, 'random' can be configured which tells NFVBench to generate random src/dst IP pairs in the traffic stream.
 
+UDP ports can be controlled with the following NFVbench configuration options:
+
+.. code-block:: bash
+
+    udp_src_port: ['1024', '65000']
+    udp_dst_port: 53
+    udp_port_step: 1
+
+``udp_src_port`` and ``udp_dst_port`` are the UDP port value used by the traffic generators.
+These can be written for unique port or range ports for all flow.
+
+The corresponding ``udp_port_step`` is used for ranging the UDP port.
+1 is the default step for all UDP ranges, 'random' can be configured which tells NFVBench to generate random src/dst UDP pairs in the traffic stream.
+
+NB:
+    Use of UDP range will increase possible values of flows (based on ip src/dst and port src/dst tuple).
+    NFVBench will calculate the least common multiple for this tuple to adapt flows generation to ``flow_count`` parameter.
+
 
 Traffic Configuration via CLI
 -----------------------------
@@ -276,6 +310,7 @@ MAC Addresses
 NFVbench will dicover the MAC addresses to use for generated frames using:
 - either OpenStack discovery (find the MAC of an existing VM) in the case of PVP and PVVP service chains
 - or using dynamic ARP discovery (find MAC from IP) in the case of external chains.
+- In case of L3 chain with SDN-GW or router between traffic generator and loop VM ARP is needed to discover SDN-GW mac addresses, use ``--loop-vm-arp`` flag or ``loop_vm_arp: true`` in config file.
 
 Status and Cleanup of NFVbench Resources
 ----------------------------------------
@@ -334,3 +369,79 @@ Example of run:
     #
 
 The --force-cleanup option will do the same but without prompting for confirmation.
+
+Service mode for TRex
+---------------------
+
+The ``--service-mode`` option allows you to capture traffic on a TRex window during the NFVBench test. Thus, you will be
+able to capture packets generated by TRex to observe many information on it.
+
+Example of use :
+
+.. code-block:: bash
+
+    nfvbench ``--service-mode``
+
+.. note:: It is preferable to define the minimum rate (2002 pps) to have a better capture
+
+In another bash window, you should connect to the TRex console doing :
+
+.. code-block:: bash
+
+    cd /opt/trex/vX.XX/ #use completion here to find your corresponding TRex version
+    ./trex-console -r
+    capture start monitor --rx [port number] -v
+
+Start this capture once you have started the NFVBench test, and you will observe packets on the TRex console :
+
+.. code-block:: bash
+
+    #26342 Port: 0 ◀── RX
+
+    trex(read-only)>
+
+        Type: UDP, Size: 66 B, TS: 26.30 [sec]
+
+    trex(read-only)>
+        ###[ Ethernet ]###
+            dst       = a0:36:9f:7a:58:8e
+            src       = fa:16:3e:57:8f:df
+            type      = 0x8100
+        ###[ 802.1Q ]###
+            prio      = 0
+            id        = 0
+            vlan      = 1093
+            type      = 0x800
+        ###[ IP ]###
+            version   = 4
+            ihl       = 5
+            tos       = 0x1
+            len       = 46
+            id        = 65535
+            flags     =
+            frag      = 0
+            ttl       = 63
+            proto     = udp
+            chksum    = 0x8425
+            src       = 120.0.0.0
+            dst       = 110.0.17.153
+            \options   \
+        ###[ UDP ]###
+            sport     = 53
+            dport     = 53
+            len       = 26
+            chksum    = 0xfd83
+        ###[ Raw ]###
+            load      = "xx\xab'\x01\x00?s\x00\x00\xbci\xf0_{U~\x00"
+        ###[ Padding ]###
+            load      = '6\x85'
+
+Check on the NFVBench window that the following log appears just before the testing phase :
+
+.. code-block:: bash
+
+    2019-10-21 09:38:51,532 INFO Starting to generate traffic...
+    2019-10-21 09:38:51,532 INFO Running traffic generator
+    2019-10-21 09:38:51,541 INFO ``Service mode is enabled``
+    2019-10-21 09:38:52,552 INFO TX: 2004; RX: 2003; Est. Dropped: 1; Est. Drop rate: 0.0499%
+    2019-10-21 09:38:53,559 INFO TX: 4013; RX: 4011; Est. Dropped: 2; Est. Drop rate: 0.0498%
\ No newline at end of file