NFVBENCH-158 Allow multiple UDP ports in traffic generation
[nfvbench.git] / docs / testing / user / userguide / advanced.rst
index 896affb..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
 --------------
@@ -204,43 +220,6 @@ If ``-sc PVVP`` is specified instead, there would be 6 VMs in 3 chains as this s
 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.
 
 
-External Chain
---------------
-
-NFVbench can measure the performance of 1 or more L3 service chains that are setup externally. Instead of being setup by NFVbench,
-the complete environment (VMs and networks) has to be setup prior to running NFVbench.
-
-Each external chain is made of 1 or more VNFs and has exactly 2 end network interfaces (left and right network interfaces) that are connected to 2 neutron networks (left and right networks).
-The internal composition of a multi-VNF service chain can be arbitrary (usually linear) as far as NFVbench is concerned,
-the only requirement is that the service chain can route L3 packets properly between the left and right networks.
-
-To run NFVbench on such external service chains:
-
-- explicitly tell NFVbench to use external service chain by adding ``-sc EXT`` or ``--service-chain EXT`` to NFVbench CLI options
-- specify the number of external chains using the ``-scc`` option (defaults to 1 chain)
-- specify the 2 end point networks of your environment in ``external_networks`` inside the config file.
-    - The two networks specified there have to exist in Neutron and will be used as the end point networks by NFVbench ('napa' and 'marin' in the diagram below)
-- specify the router gateway IPs for the external service chains (1.1.0.2 and 2.2.0.2)
-- specify the traffic generator gateway IPs for the external service chains (1.1.0.102 and 2.2.0.102 in diagram below)
-- specify the packet source and destination IPs for the virtual devices that are simulated (10.0.0.0/8 and 20.0.0.0/8)
-
-
-.. image:: images/extchain-config.svg
-
-L3 routing must be enabled in the VNF and configured to:
-
-- reply to ARP requests to its public IP addresses on both left and right networks
-- route packets from each set of remote devices toward the appropriate dest gateway IP in the traffic generator using 2 static routes (as illustrated in the diagram)
-
-Upon start, NFVbench will:
-- first retrieve the properties of the left and right networks using Neutron APIs,
-- extract the underlying network ID (typically VLAN segmentation ID),
-- generate packets with the proper VLAN ID and measure traffic.
-
-Note that in the case of multiple chains, all chains end interfaces must be connected to the same two left and right networks.
-The traffic will be load balanced across the corresponding gateway IP of these external service chains.
-
-
 Multiflow
 ---------
 
@@ -284,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
 -----------------------------
@@ -313,47 +310,138 @@ 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.
 
-Cleanup Script
---------------
+Status and Cleanup of NFVbench Resources
+----------------------------------------
+
+The --status option will display the status of NFVbench and list any NFVbench resources. You need to pass the OpenStack RC
+file in order to connect to OpenStack.
+
+.. code-block:: none
+
+    # nfvbench --status -r /tmp/nfvbench/openrc
+    2018-04-09 17:05:48,682 INFO Version: 1.3.2.dev1
+    2018-04-09 17:05:48,683 INFO Status: idle
+    2018-04-09 17:05:48,757 INFO Discovering instances nfvbench-loop-vm...
+    2018-04-09 17:05:49,252 INFO Discovering flavor nfvbench.medium...
+    2018-04-09 17:05:49,281 INFO Discovering networks...
+    2018-04-09 17:05:49,365 INFO No matching NFVbench resources found
+    #
+
+The Status can be either "idle" or "busy (run pending)".
 
-The nfvbench_cleanup script will cleanup resources created by NFVbench. You need to pass the OpenStack RC file in order to connect to
-OpenStack.
+The --cleanup option will first discover resources created by NFVbench and prompt if you want to proceed with cleaning them up.
 Example of run:
 
 .. code-block:: none
 
-    # nfvbench_cleanup -r /tmp/nfvbench/openrc
-    Discovering Storage resources...
-    Discovering Compute resources...
-    Discovering Network resources...
-    Discovering Keystone resources...
-
-    SELECTED RESOURCES:
-    +-----------+-------------------+--------------------------------------+
-    | Type      | Name              | UUID                                 |
-    |-----------+-------------------+--------------------------------------|
-    | flavors   | nfvbench.medium   | 362b2215-89d1-4f46-8b89-8e58165ff5bc |
-    | instances | nfvbench-loop-vm0 | f78dfb74-1b8e-4c5c-8d83-652a7571da95 |
-    | networks  | nfvbench-net0     | 57d7e6c9-325f-4c13-9b1b-929344cc9c39 |
-    | networks  | nfvbench-net1     | 2d429bcd-33fa-4aa4-9f2e-299a735177c9 |
-    +-----------+-------------------+--------------------------------------+
-
-    Warning: You didn't specify a resource list file as the input. The script will delete all resources shown above.
+    # nfvbench --cleanup -r /tmp/nfvbench/openrc
+    2018-04-09 16:58:00,204 INFO Version: 1.3.2.dev1
+    2018-04-09 16:58:00,205 INFO Status: idle
+    2018-04-09 16:58:00,279 INFO Discovering instances nfvbench-loop-vm...
+    2018-04-09 16:58:00,829 INFO Discovering flavor nfvbench.medium...
+    2018-04-09 16:58:00,876 INFO Discovering networks...
+    2018-04-09 16:58:00,960 INFO Discovering ports...
+    2018-04-09 16:58:01,012 INFO Discovered 6 NFVbench resources:
+    +----------+-------------------+--------------------------------------+
+    | Type     | Name              | UUID                                 |
+    |----------+-------------------+--------------------------------------|
+    | Instance | nfvbench-loop-vm0 | b039b858-777e-467e-99fb-362f856f4a94 |
+    | Flavor   | nfvbench.medium   | a027003c-ad86-4f24-b676-2b05bb06adc0 |
+    | Network  | nfvbench-net0     | bca8d183-538e-4965-880e-fd92d48bfe0d |
+    | Network  | nfvbench-net1     | c582a201-8279-4309-8084-7edd6511092c |
+    | Port     |                   | 67740862-80ac-4371-b04e-58a0b0f05085 |
+    | Port     |                   | b5db95b9-e419-4725-951a-9a8f7841e66a |
+    +----------+-------------------+--------------------------------------+
+    2018-04-09 16:58:01,013 INFO NFVbench will delete all resources shown...
     Are you sure? (y/n) y
-    *** STORAGE cleanup
-    *** COMPUTE cleanup
-        . Waiting for 1 instances to be fully deleted...
-        . INSTANCE 1 left to be deleted, retries left=5...
-        . INSTANCE 1 left to be deleted, retries left=4...
-        + INSTANCE nfvbench-loop-vm0 is successfully deleted
-        + FLAVOR nfvbench.medium is successfully deleted
-    *** NETWORK cleanup
-        + Network port 075d91f3-fa6a-428c-bd3f-ebd40cd935e1 is successfully deleted
-        + Network port 3a7ccd8c-53a6-43d0-a823-4b5ca762d06e is successfully deleted
-        + NETWORK nfvbench-net0 is successfully deleted
-        + Network port 5b5a75bd-e0b5-4f81-91b9-9e216d194f48 is successfully deleted
-        + Network port cc2d8f1b-49fe-491e-9e44-6990fc57e891 is successfully deleted
-        + NETWORK nfvbench-net1 is successfully deleted
-    *** KEYSTONE cleanup
+    2018-04-09 16:58:01,865 INFO Deleting instance nfvbench-loop-vm0...
+    2018-04-09 16:58:02,058 INFO     Waiting for 1 instances to be fully deleted...
+    2018-04-09 16:58:02,182 INFO     1 yet to be deleted by Nova, retries left=6...
+    2018-04-09 16:58:04,506 INFO     1 yet to be deleted by Nova, retries left=5...
+    2018-04-09 16:58:06,636 INFO     1 yet to be deleted by Nova, retries left=4...
+    2018-04-09 16:58:08,701 INFO Deleting flavor nfvbench.medium...
+    2018-04-09 16:58:08,729 INFO Deleting port 67740862-80ac-4371-b04e-58a0b0f05085...
+    2018-04-09 16:58:09,102 INFO Deleting port b5db95b9-e419-4725-951a-9a8f7841e66a...
+    2018-04-09 16:58:09,620 INFO Deleting network nfvbench-net0...
+    2018-04-09 16:58:10,357 INFO Deleting network nfvbench-net1...
     #
+
+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