Data Tests

Reference Documentation

product_line_custom
Intel® PAC
Napatech SmartNIC
category
Reference Information
Napatech Software Suite: Data Tests

This section specifies the syntax and semantics for the data tests.

Supported Options Per Feature Set

Supported Feature Sets
N-ANL4
N-ANL5
N-ANL6
N-ANL7
N-ANL8
N-ANL9
N-ANL10
  X
Options DynamicOffset   X
DynamicOffset
Tunnels
  X

The syntax for the data tests is shown below.

<DataTest>              ::= 'Data' '[' <DataTestOptionSpec> ']'
                            ( ( <CompareOperator> <SimpleValue> ) |
                              ( <EqualNotEqualTest> <DataValueSpec> ) )
<DataTestOptionSpec>    ::= <DataTestOption> [';' <DataTestOptionSpec>]
<DataTestOption>        ::= ( 'DynOffset' '=' <DynamicOffset> ) | ( 'Offset' '=' <OffsetValue> ) |
                            ( 'ProtOffset' '=' <ProtocolLocation11> ) | ( 'DataType' '=' <DataSpec> ) |
                            ( 'DataMask' '=' <DataMaskSpec> )
<DynamicOffset>         ::= 'DynOffRaw' | 'DynOffLayer2Frame'| 'DynOffLayer2Data'| 'DynOffEtherTypeLen' |
                            'DynOffEtherType' | 'DynOffIPv4Frame' | 'DynOffIPv4Data' | 'DynOffIPv6Frame' |
                            'DynOffIPv6Data' | 'DynOffTcpFrame' | 'DynOffTcpData' |
                            'DynOffUdpFrame' | 'DynOffUdpData' | 'DynOffIcmpFrame' | 'DynOffIcmpData' |
                            'DynOffSctpFrame' | 'DynOffSctpData'
<DynamicOffsetTunnels>  ::= 'DynOffInnerIPv4Frame' | 'DynOffInnerIPv4Data' | 'DynOffInnerIPv6Frame' |
                            'DynOffInnerIPv6Data' | 'DynOffInnerTcpFrame' | 'DynOffInnerTcpData' |
                            'DynOffInnerUdpFrame' | 'DynOffInnerUdpData' | 'DynOffInnerIcmpFrame' | 'DynOffInnerIcmpData' |
                            'DynOffInnerSctpFrame' | 'DynOffInnerSctpData'
<OffsetValue>           ::= '-1024' | '-1023' | ... | '-1' | '0' | '1' | ... | '1023'
<DataSpec>              ::= 'ByteStr1' | 'ByteStr2' | 'ByteStr4' | 'MacAddr' | 'IPv4Addr' | 'IPv6Addr'
<DataMaskSpec>          ::= '[' <BitStartOffset> ':' <BitEndOffset> ']'
<BitStartOffset>        ::= <BitOffset>
<BitEndOffset>          ::= <BitOffset>
<BitOffset>             ::= '0' | '1' | '2' | ... | '31' | '0x0' | '0x1' | '0x2' | ... | '0x1f'
<DataValueSpec>         ::= <DataValueList> | <DataValueRange> | <DataValueMask>
<DataValueList>         ::= <DataValue> { ',' <DataValue> }
<DataValueRange>        ::= '(' <DataValue> '..' <DataValue> ')'
<DataValueMask>         ::= '{' <DataMask> ':' <DataValue> '}'
<DataValue>             ::= <SimpleValue> | <IPv4AddrValue> | <IPv6AddrValue> | <MacAddrValue>
<MacAddrValue>          ::= '[' <8-bit hex value> ':' <8-bit hex value> ':'
                                <8-bit hex value> ':' <8-bit hex value> ':'
                                <8-bit hex value> ':' <8-bit hex value> ']'
<SimpleValue>           ::= <8-bit value> | <16-bit value> | <32-bit value>
<DataMask>              ::= <8-bit hex value> | <8-bit hex value without 0x> |
                            <16-bit hex value> | <16-bit hex value without 0x> |
                            <32-bit hex value> | <32-bit hex value without 0x> |
                            <MacAddrValue> | <IPv4AddrMask> | <IPv6AddrMask>

A data test can be a test on one-byte, two-byte or four-byte values at any combination of static and dynamic offsets. This data can be compared to:

  • Specific values
  • Ranges of values
  • Lists of up to 32 values

In addition, wider values such as MAC and IPv6 addresses are also supported.

For a given data value specification (<DataValueSpec>), all data values specified must be of the same type. For instance, if a ByteStr1 range is specified, all specified values must be byte values (0..255).

For a given range specification (<DataValueRange>) with simple values (<SimpleValue>), all values are considered to be of the same size (equal to the largest number of bytes), that is either 1, 2, or 4 bytes. Example: (0xF .. 0x1FF) is interpreted as (0x000F .. 0x01FF).

One and only one static offset (<OffsetValue>) must be specified. The maximum static offset is 1024 minus the size of the target data value to compare to. For example, if the DataType is ByteStr4, the maximum static offset is 1020. The maximum static offset is independent from the dynamic offset.

When using the 'DynOffset' option, additional protocol filters are implicitly configured, to ensure that only packet types matching the dynamic offset value are considered (e.g. when 'DynOffTcpFrame' is used, a 'Layer4Protocol <EqualNotEqualTest> TCP' filter is implicitly configured).

The offset can also be specified with the 'ProtOffset' option. This option takes a <ProtocolLocation11> which incorporates both a static and dynamic part. The static offset can range from -1023 to 1024 minus the size of the target data value. This option excludes the use of the 'DynOffset' and 'Offset' options. When this option is used no implicit protocol filters are configured.

Data type (<DataSpecification>) and dynamic offset are optional.

The data mask specification F0:0x50 can be specified as one of the following:

  • [0xF0:0x50]
  • [F0:0x50]

This means that the data mask specification bytes are always interpreted as hexadecimal values.

Data Test Examples

This section describes some examples of filters for data testing.

Data Tests on Frame Types and MAC Addresses

This section describes an example of a filter for data testing. The example illustrates how to set up a filter that captures IP and ARP frames that are sent by the device with this MAC address: 00:0F:3D:53:48:2D.

The filter NTPL example is shown below.

Assign[StreamId = 1] = (Data[Offset = 6; DataType=MacAddr] == [00:0F:3D:53:48:2D] AND (Data[DynOffset = DynOffEtherTypeLen; DataType = ByteStr2] == 0x0800, 0x0806))

Data Tests on IPv4 Subnets and Port Numbers

This example shows a filter that matches frames originating from the 172.16.0.0/16 subnet, destined for the 192.168.1.0/24 subnet and where one of the TCP ports is 80:

Assign[StreamId=1] = Data[DynOffset=DynOffIPv4Frame; Offset=12; DataType=IPv4Addr] == {[FF.FF.00.00]:[172.16.0.0]} AND Data[DynOffset=DynOffIPv4Frame; Offset=16; DataType=IPv4Addr] == {[FF.FF.FF.00]:[192.168.1.0]} AND (Data[DynOffset=DynOffTcpFrame; DataType=ByteStr4; DataMask=[31:16]] == 80 OR Data[DynOffset=DynOffTcpFrame; DataType=ByteStr4; DataMask=[15:0]] == 80)