summaryrefslogtreecommitdiffstats
path: root/kernel/samples/pktgen/parameters.sh
blob: 33b70fdd5a4a33c843a123d5c0e3fd7347bbb463 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#
# Common parameter parsing for pktgen scripts
#

function usage() {
    echo ""
    echo "Usage: $0 [-vx] -i ethX"
    echo "  -i : (\$DEV)       output interface/device (required)"
    echo "  -s : (\$PKT_SIZE)  packet size"
    echo "  -d : (\$DEST_IP)   destination IP"
    echo "  -m : (\$DST_MAC)   destination MAC-addr"
    echo "  -t : (\$THREADS)   threads to start"
    echo "  -c : (\$SKB_CLONE) SKB clones send before alloc new SKB"
    echo "  -b : (\$BURST)     HW level bursting of SKBs"
    echo "  -v : (\$VERBOSE)   verbose"
    echo "  -x : (\$DEBUG)     debug"
    echo ""
}

##  --- Parse command line arguments / parameters ---
## echo "Commandline options:"
while getopts "s:i:d:m:t:c:b:vxh" option; do
    case $option in
        i) # interface
          export DEV=$OPTARG
	  info "Output device set to: DEV=$DEV"
          ;;
        s)
          export PKT_SIZE=$OPTARG
	  info "Packet size set to: PKT_SIZE=$PKT_SIZE bytes"
          ;;
        d) # destination IP
          export DEST_IP=$OPTARG
	  info "Destination IP set to: DEST_IP=$DEST_IP"
          ;;
        m) # MAC
          export DST_MAC=$OPTARG
	  info "Destination MAC set to: DST_MAC=$DST_MAC"
          ;;
        t)
	  export THREADS=$OPTARG
          export CPU_THREADS=$OPTARG
	  let "CPU_THREADS -= 1"
	  info "Number of threads to start: $THREADS (0 to $CPU_THREADS)"
          ;;
        c)
	  export CLONE_SKB=$OPTARG
	  info "CLONE_SKB=$CLONE_SKB"
          ;;
        b)
	  export BURST=$OPTARG
	  info "SKB bursting: BURST=$BURST"
          ;;
        v)
          export VERBOSE=yes
          info "Verbose mode: VERBOSE=$VERBOSE"
          ;;
        x)
          export DEBUG=yes
          info "Debug mode: DEBUG=$DEBUG"
          ;;
        h|?|*)
          usage;
          err 2 "[ERROR] Unknown parameters!!!"
    esac
done
shift $(( $OPTIND - 1 ))

if [ -z "$PKT_SIZE" ]; then
    # NIC adds 4 bytes CRC
    export PKT_SIZE=60
    info "Default packet size set to: set to: $PKT_SIZE bytes"
fi

if [ -z "$THREADS" ]; then
    # Zero CPU threads means one thread, because CPU numbers are zero indexed
    export CPU_THREADS=0
    export THREADS=1
fi

if [ -z "$DEV" ]; then
    usage
    err 2 "Please specify output device"
fi

if [ -z "$DST_MAC" ]; then
    warn "Missing destination MAC address"
fi

if [ -z "$DEST_IP" ]; then
    warn "Missing destination IP address"
fi

if [ ! -d /proc/net/pktgen ]; then
    info "Loading kernel module: pktgen"
    modprobe pktgen
fi
to install vswitchperf inside vloop-vnf image. As vswitchperf will be run in trafficgen mode, it is possible to skip installation and compilation of OVS, QEMU and DPDK to keep image size smaller. In case, that selected traffic generator requires installation of additional client software, please follow appropriate documentation. For example in case of IXIA, you would need to install IxOS and IxNetowrk TCL API. VM image usage ~~~~~~~~~~~~~~ Image with vswitchperf must be uploaded into the glance service and vswitchperf specific flavor configured, e.g.: .. code-block:: console $ glance --os-username admin --os-image-api-version 1 image-create --name \ vsperf --is-public true --disk-format qcow2 --container-format bare --file \ vsperf-yardstick-image.qcow2 $ nova --os-username admin flavor-create vsperf-flavor 100 2048 25 1 Testcase execution ^^^^^^^^^^^^^^^^^^ After installation, yardstick is available as python package within yardstick specific virtual environment. It means, that yardstick environment must be enabled before the test execution, e.g.: .. code-block:: console source ~/yardstick_venv/bin/activate Next step is configuration of OpenStack environment, e.g. in case of devstack: .. code-block:: console source /opt/openstack/devstack/openrc export EXTERNAL_NETWORK=public Vswitchperf testcases executable by yardstick are located at vswitchperf repository inside ``yardstick/tests`` directory. Example of their download and execution follows: .. code-block:: console git clone https://gerrit.opnfv.org/gerrit/vswitchperf cd vswitchperf yardstick -d task start yardstick/tests/rfc2544_throughput_dummy.yaml **NOTE:** Optional argument ``-d`` shows debug output. Testcase customization ^^^^^^^^^^^^^^^^^^^^^^ Yardstick testcases are described by YAML files. vswitchperf specific testcases are part of the vswitchperf repository and their yaml files can be found at ``yardstick/tests`` directory. For detailed description of yaml file structure, please see yardstick documentation and testcase samples. Only vswitchperf specific parts will be discussed here. Example of yaml file: .. code-block:: yaml ... scenarios: - type: Vsperf options: testname: 'p2p_rfc2544_throughput' trafficgen_port1: 'eth1' trafficgen_port2: 'eth3' external_bridge: 'br-ex' test_params: 'TRAFFICGEN_DURATION=30;TRAFFIC={'traffic_type':'rfc2544_throughput}' conf_file: '~/vsperf-yardstick.conf' host: vsperf.demo runner: type: Sequence scenario_option_name: frame_size sequence: - 64 - 128 - 512 - 1024 - 1518 sla: metrics: 'throughput_rx_fps' throughput_rx_fps: 500000 action: monitor context: ... Section option ~~~~~~~~~~~~~~ Section **option** defines details of vswitchperf test scenario. Lot of options are identical to the vswitchperf parameters passed through ``--test-params`` argument. Following options are supported: - **frame_size** - a packet size for which test should be executed; Multiple packet sizes can be tested by modification of Sequence runner section inside YAML definition. Default: '64' - **conf_file** - sets path to the vswitchperf configuration file, which will be uploaded to VM; Default: '~/vsperf-yardstick.conf' - **setup_script** - sets path to the setup script, which will be executed during setup and teardown phases - **trafficgen_port1** - specifies device name of 1st interface connected to the trafficgen - **trafficgen_port2** - specifies device name of 2nd interface connected to the trafficgen - **external_bridge** - specifies name of external bridge configured in OVS; Default: 'br-ex' - **test_params** - specifies a string with a list of vsperf configuration parameters, which will be passed to the ``--test-params`` CLI argument; Parameters should be stated in the form of ``param=value`` and separated by a semicolon. Configuration of traffic generator is driven by ``TRAFFIC`` dictionary, which can be also updated by values defined by ``test_params``. Please check VSPERF documentation for details about available configuration parameters and their data types. In case that both **test_params** and **conf_file** are specified, then values from **test_params** will override values defined in the configuration file. In case that **trafficgen_port1** and/or **trafficgen_port2** are defined, then these interfaces will be inserted into the **external_bridge** of OVS. It is expected, that OVS runs at the same node, where the testcase is executed. In case of more complex OpenStack installation or a need of additional OVS configuration, **setup_script** can be used. **NOTE** It is essential to specify a configuration for selected traffic generator. In case, that standalone testcase is created, then traffic generator can be selected and configured directly in YAML file by **test_params**. On the other hand, if multiple testcases should be executed with the same traffic generator settings, then a customized configuration file should be prepared and its name passed by **conf_file** option. Section runner ~~~~~~~~~~~~~~ Yardstick supports several `runner types <http://artifacts.opnfv.org/yardstick/docs/userguide/architecture.html#runner-types>`__. In case of vswitchperf specific TCs, **Sequence** runner type can be used to execute the testcase for given list of frame sizes. Section sla ~~~~~~~~~~~ In case that sla section is not defined, then testcase will be always considered as successful. On the other hand, it is possible to define a set of test metrics and their minimal values to evaluate test success. Any numeric value, reported by vswitchperf inside CSV result file, can be used. Multiple metrics can be defined as a coma separated list of items. Minimal value must be set separately for each metric. e.g.: .. code-block:: yaml sla: metrics: 'throughput_rx_fps,throughput_rx_mbps' throughput_rx_fps: 500000 throughput_rx_mbps: 1000 In case that any of defined metrics will be lower than defined value, then testcase will be marked as failed. Based on ``action`` policy, yardstick will either stop test execution (value ``assert``) or it will run next test (value ``monitor``). **NOTE** The throughput SLA (or any other SLA) cannot be set to a meaningful value without knowledge of the server and networking environment, possibly including prior testing in that environment to establish a baseline SLA level under well-understood circumstances.