261. flow classify

This document provides test plan for flow classify feature.

Flow Classify provides flow record information with some measured properties.

DPDK provides a Flow Classification library that provides the ability to classify an input packet by matching it against a set of Flow rules. The implementation supports counting of IPv4 5-tuple packets which match a particular Flow rule only.

example/flow_classify is the tool to call flow_classify lib for group of packets, just after receiving them or before transmitting them. It is intended as a demonstration of the basic components of a DPDK forwarding application which uses the Flow Classify library API’s.

DPDK technical doc refer to:

dpdk/doc/guides/sample_app_ug/flow_classify.rst
dpdk/doc/guides/prog_guide/flow_classify_lib.rst

261.1. Prerequisites

2xNICs (2 full duplex optical ports per NIC) Flow Classify should run on 2 pair link peer at least.

i40e driver nic: Ethernet Controller X710 for 10GbE SFP+ 1572 Ethernet Controller XXV710 for 25GbE SFP28 158b Ethernet Controller XL710 for 40GbE QSFP+ 1583

ixgbe driver nic: 82599ES 10-Gigabit SFI/SFP+ Network Connection 10fb

261.2. HW configuration

link peer topology:

  Tester                          DUT
.-------.                      .-------.
| port0 | <------------------> | port0 |
| port1 | <------------------> | port1 |
'-------'                      '-------'

261.3. Stream configuration

five valid streams(as examples/flow_classify/ipv4_rules_file.txt), three invalid streams are the streams beyond config file.

UDP_1:

Frame Data/Protocols: Ethernet 2 0800, IPv4,UDP/IP, Fixed 64.
IPv4 Header Page: Dest Address: 2.2.2.7 Src  Address: 2.2.2.3
UDP Header: Src Port: 32  Dest Port: 33
Ether()/IP (proto='udp', src='2.2.2.3', dst='2.2.2.7')/UDP(sport=32, dport=33)/Raw()

UDP_2:

Frame Data/Protocols: Ethernet 2 0800, IPv4,UDP/IP, Fixed 64.
IPv4 Header Page: Dest Address: 9.9.9.7 Src  Address: 9.9.9.3
UDP Header: Src Port: 32  Dest Port: 33
Ether()/IP (proto='udp', src='9.9.9.3', dst='9.9.9.7')/UDP(sport=32, dport=33)/Raw()

UDP_invalid:

Frame Data/Protocols: Ethernet 2 0800, IPv4,UDP/IP, Fixed 64.
IPv4 Header Page: Dest Address: 9.8.7.6 Src  Address: 192.168.0.36
UDP Header: Src Port: 10  Dest Port: 11
Ether()/IP (proto='udp', src='9.8.7.6', dst='192.168.0.36')/UDP(sport=10, dport=11)/Raw()

TCP_1:

Frame Data/Protocols: Ethernet 2 0800, IPv4,TCP/IP, Fixed 64.
IPv4 Header Page: Dest Address: 9.9.9.7 Src  Address: 9.9.9.3
TCP Header: Src Port: 32  Dest Port: 33
Ether()/IP (proto='tcp', src='9.9.9.3', dst='9.9.9.7')/TCP(sport=32, dport=33)/Raw()

TCP_2:

Frame Data/Protocols: Ethernet 2 0800, IPv4,TCP/IP, Fixed 64.
IPv4 Header Page: Dest Address: 9.9.8.7 Src  Address: 9.9.8.3
TCP Header: Src Port: 32  Dest Port: 33
Ether()/IP (proto='tcp', src='9.9.8.3', dst='9.9.8.7')/TCP(sport=32, dport=33)/Raw()

TCP_invalid:

Frame Data/Protocols: Ethernet 2 0800, IPv4,TCP/IP, Fixed 64.
IPv4 Header Page: Dest Address: 9.8.7.6 Src  Address: 192.168.0.36
TCP Header: Src Port: 10  Dest Port: 11
Ether()/IP (proto='tcp', src='9.8.7.6', dst='192.168.0.36')/TCP(sport=10, dport=11)/Raw()

SCTP_1:

Frame Data/Protocols: Ethernet 2 0800, IPv4, None, Fixed 256.
IPv4 Header Page: Dest Address: 2.3.4.5 Src  Address: 6.7.8.9
SCTP Header: Src Port: 32  Dest Port: 33
Protocol: 132-SCTP
Ether()/IP (proto='sctp', src='6.7.8.9', dst='2.3.4.5')/SCTP(sport=32, dport=33)/Raw()

SCTP_invalid:

Frame Data/Protocols: Ethernet 2 0800, IPv4, None, Fixed 256.
IPv4 Header Page: Dest Address: 9.8.7.6 Src  Address: 192.168.0.36
SCTP Header: Src Port: 10  Dest Port: 11
Protocol: 132-SCTP
Ether()/IP (proto='sctp', src='9.8.7.6', dst='192.168.0.36')/SCTP(sport=10, dport=11)/Raw()

261.4. Compilation:

steps:

cd $DPDK_PATH
export RTE_TARGET=$DPDK_PATH
export RTE_SDK=`pwd`
make -C examples/flow_classify

Flow classify bin file under:

$DPDK_PATH/examples/flow_classify/build/flow_classify

rule config file(default):

$DPDK_PATH/examples/flow_classify/ipv4_rules_file.txt

261.5. Test cases

The idea behind the testing process is to compare packet count sending by ixia packet generator with packet count filtered by flow_classify. Valid packets should be in flow_classify output and invalid packets should be ignored. The rules are configured in a txt file. Testing content includes single udp/tcp/sctp stream and multiple streams.

261.5.1. Test Case : check valid rule with udp stream

Send 32 packets of valid stream(as UDP_1 or UDP_2 in Stream configuration), then check the total received packets in flow_classify’s output message.

steps:

  1. boot up flow_classify:

    ./flow_classify -c 4 -n 4 -- --rule_ipv4=<rule config file>
    
  2. send stream by packet generator(e.g. scapy or ixia):

    scapy> sendp(UDP_1, iface='xxxxx', count=32)
    
  3. check flow_classify output contain the following message:

    rule[0] count=1
    or
    rule[1] count=1
    

261.5.2. Test Case : check invalid rule with udp stream

Send 32 packets of invalid stream(as UDP_invalid in Stream configuration), then check flow_classify’s output message has no count message

steps:

  1. boot up flow_classify:

    ./flow_classify -c 4 -n 4 -- --rule_ipv4=<rule config file>
    
  2. send stream by packet generator(e.g. scapy or ixia):

    scapy> sendp(UDP_invalid, iface='xxxxx', count=32)
    
  3. check flow_classify output has no message as “rule[xxx] count=xxx”, such as:

    rule[0] count=1
    

261.5.3. Test Case : check valid rule with tcp stream

Send 32 packets of valid stream(as TCP_1 or TCP_2 in Stream configuration), then check the total received packets in flow_classify’s output message.

steps:

  1. boot up flow_classify:

    ./flow_classify -c 4 -n 4 -- --rule_ipv4=<rule config file>
    
  2. send stream by packet generator(e.g. scapy or ixia):

    scapy> sendp(TCP_1, iface='xxxxx', count=32)
    
  3. check flow_classify output contain the following message:

    rule[2] count=1
    or
    rule[3] count=1
    

261.5.4. Test Case : check invalid rule with tcp stream

Send 32 packets of invalid stream(as TCP_invalid in Stream configuration), then check flow_classify’s output message has no count message.

steps:

  1. boot up flow_classify:

    ./flow_classify -c 4 -n 4 -- --rule_ipv4=<rule config file>
    
  2. send stream by packet generator(e.g. scapy or ixia):

    scapy> sendp(TCP_invalid, iface='xxxxx', count=32)
    
  3. check flow_classify output has no message as “rule[xxx] count=xxx”, such as:

    rule[2] count=1
    

261.5.5. Test Case : check valid rule with sctp stream

Send 32 packets of valid stream(as SCTP_1 in Stream configuration), then check the total received packets in flow_classify’s output message.

steps:

  1. boot up flow_classify:

    ./flow_classify -c 4 -n 4 -- --rule_ipv4=<rule config file>
    
  2. send stream by packet generator(e.g. scapy or ixia):

    scapy> sendp(SCTP_1, iface='xxxxx', count=32)
    
  3. check flow_classify output contain the following message:

    rule[4] count=1
    

261.5.6. Test Case : check invalid rule with sctp stream

Send 32 packets of invalid stream(as SCTP_invalid in Stream configuration), then check flow_classify’s output message has no count message.

steps:

  1. boot up flow_classify:

    ./flow_classify -c 4 -n 4 -- --rule_ipv4=<rule config file>
    
  2. send stream by packet generator(e.g. scapy or ixia):

    scapy> sendp(SCTP_invalid, iface='xxxxx', count=32)
    
  3. check flow_classify output has no “rule[xxx] count=xxx” message, such as:

    rule[4] count=1
    

261.5.7. Test Case: check valid/invalid rule with multiple streams

Send multiple streams, 32 packets/each stream type(all stream types in Stream configuration), then check if they are filtered/captured by flow_classify.

steps:

  1. boot up flow_classify:

    ./flow_classify -c 4 -n 4 -- --rule_ipv4=<rule config file>
    
  2. send multiple stream by packet generator(e.g. scapy or ixia), include SCTP_1/SCTP_invalid/TCP_invalid/TCP_1/TCP_2/UDP_invalid/UDP_1/UDP_2:

    scapy> multiple_stream = [SCTP_1, SCTP_invalid, TCP_invalid, TCP_1, TCP_2, UDP_invalid, UDP_1, UDP_2]
    scapy> sendp(multiple_stream, iface='xxxx', count=32)
    
  3. check flow_classify output only contain the following count message:

    rule[0] count=1
    rule[1] count=1
    rule[2] count=1
    rule[3] count=1
    rule[4] count=1