Inbuilt Traffic Generator Commands

This module describes the Cisco IOS XR Software commands to set up and run the inbuilt traffic generator on the Network Processing Unit (NPU) of line cards of distributed systems and route processors of fixed routers.

For detailed information about the inbuilt traffic generator concepts, and examples, see the Inbuilt Traffic Generator for Network Diagnostics chapter in the System Monitoring Configuration Guide for Cisco 8000 Series Routers.

diagnostic packet-generator create

To create an instance of the inbuilt traffic generator, use the command diagnostic packet-generator create in EXEC mode.

diagnostic packet-generator create traffic-generator-name { duration traffic-duration | rate packet-rate | filename packet-file | packet packet-details | traffic-class traffic-class } { ingress interface ingress-interface-name [ member bundle-member-interface ] | | egress interface egress-interface-name [ [ npu npu ] | | [ slice slice ] ] | | raw } capture location location

Syntax Description

traffic-generator-name

Specify a name for the traffic generator instance

duration traffic-duration

Specify the traffic duration in seconds

rate packet-rate

Specify the traffic-rate in pps

filename packet-file

Specify the file with the packet details.

The file can be a pcap file with .pcap suffix or a text file with scapy script or hex string.

packet packet-details

Specify the packet details directly at command-line

Maximum length for packets provided at command line is 255 characters. For larger packets, use the filename packet-file option.

traffic-class traffic-class

Specify the traffic-class

ingress

Specify the traffic generator instance to inject ingress packets

interface ingress-interface-name

Specify the ingress interface for packet injection

member bundle-member-interface

If the ingress interface is a bundle-interface, specify the member interface for packet injection. If nothing is provided, one of the existing members in the target location will be selected to inject packets.

egress

Specify the traffic generator instance to inject egress packets

interface egress-interface-name

Specify the egress interface for packet injection

npu npu

Specify the npu from which the packet will be injected.

Default value: 0

slice slice

Specify the slice from which the packet will be injected.

Default value: 0

raw

Specify the traffic generator instance to inject raw packets

capture

Enable packet capture

location location

Specify the slot location where you will create the traffic generator instance

Command Default

While creating an ingress traffic generator instance, if you did not specify the ethernet header of the packet to be injected, the software will generate a default ethernet header with the following source and destination MAC addresses:

  • A default source MAC address of 00:00:00:00:00:01.

  • The MAC address of the ingress interface as the destination MAC address.

If you provided a subinterface as the ingress interface, the software will include the VLAN header after the ethernet header.

Command Modes

XR EXEC mode

Command History

Release Modification

Release 24.2.11

This command was introduced.

Usage Guidelines


Caution


Don’t run the inbuilt traffic generator on a live network unless you are fully aware of the impact of packets injected. Injecting packets into a live network may result in network outages.

Caution


Raw traffic generator mode should be executed only by Cisco engineers. Improper use of raw mode could cause unexpected behavior, such as NPU lock-up.

Task ID

Task ID Operation

diag

execute

root-system

execute

root-lr

execute

cisco-support

read, execute

Example

The following example shows how to create a traffic generator instance in ingress mode:

Router# diagnostic packet-generator create t1 rate 100 duration 60 packet IP(src="32.0.0.1",dst="22.0.0.1",ttl=64)/UDP()/Raw(load="a"*100) ingress interface FourHundredGigE0/0/0/1 capture location 0/RP0/CPU0
OK

The following example shows how to create a traffic generator instance in egress mode:

Router# diagnostic packet-generator create t1 rate 100 duration 60 packet Ether(src="A:B:C:D:E:F",dst="1:2:3:4:5:6")/IP(src="32.0.0.1",dst="109.0.0.101",ttl=64)/Raw(load="f"*100) egress interface fourHundredGigE0/0/0/0 capture location 0/RP0/CPU0
OK

diagnostic packet-generator delete

To delete the inbuilt traffic generator instance, use the command diagnostic packet-generator delete in EXEC mode.

diagnostic packet-generator delete traffic-generator-name location location

Syntax Description

traffic-generator-name

Specify the name of the traffic generator instance

location location

Specify the slot-location of the traffic generator instance

Command Default

None

Command Modes

XR EXEC mode

Command History

Release Modification

Release 24.2.11

This command was introduced.

Usage Guidelines

After completing the traffic testing, execute this command to delete the traffic generator instance and free up resources.

Task ID

Task ID Operation

diag

execute

root-system

execute

root-lr

execute

cisco-support

read, execute

Example

The following example shows how to delete the inbuilt traffic generator instance:

Router# diagnostic packet-generator delete t1 location 0/RP0/CPU0
OK

diagnostic packet-generator start

To start injecting packets from the inbuilt traffic generator, use the command diagnostic packet-generator start in EXEC mode.

diagnostic packet-generator start traffic-generator-name location location

Syntax Description

traffic-generator-name

Specify the name of the traffic generator instance to start packet injection

location location

Specify the slot-location of the traffic generator instance

Command Default

None

Command Modes

XR EXEC mode

Command History

Release Modification

Release 24.2.11

This command was introduced.

Usage Guidelines


Caution


Don’t run the inbuilt traffic generator on a live network unless you are fully aware of the impact of packets injected. Injecting packets into a live network may result in network outages.

Task ID

Task ID Operation

diag

execute

root-system

execute

root-lr

execute

cisco-support

read, execute

Example

The following example shows how to start a previously created traffic generator instance:

Router# diagnostic packet-generator start t1 location 0/RP0/CPU0
OK

diagnostic packet-generator stop

To stop injecting packets from the inbuilt traffic generator, use the command diagnostic packet-generator stop in EXEC mode.

diagnostic packet-generator stop traffic-generator-name location location

Syntax Description

traffic-generator-name

Specify the name of the traffic generator instance to stop packet injection

location location

Specify the slot-location of the traffic generator instance

Command Default

None

Command Modes

XR EXEC mode

Command History

Release Modification

Release 24.2.11

This command was introduced.

Usage Guidelines

None

Task ID

Task ID Operation

diag

execute

root-system

execute

root-lr

execute

cisco-support

read, execute

Example

The following example shows how to stop injecting packets from the inbuilt traffic generator:

Router# diagnostic packet-generator stop t1 location 0/RP0/CPU0
OK

show diagnostic packet-generator status

To view the status of the inbuilt traffic generator instance, use the command show diagnostic packet-generator status in EXEC mode.

show diagnostic packet-generator status traffic-generator-name location location

Syntax Description

traffic-generator-name

Specify the name of the traffic generator instance or all .

If you specify all , the command displays the summary of all packet-generators, without packet details, in the target location.

location location

Specify the slot-location of the traffic generator

Command Default

None

Command Modes

XR EXEC mode

Command History

Release Modification

Release 24.2.11

This command was introduced.

Usage Guidelines

None

Task ID

Task ID Operation

diag

execute

root-system

execute

root-lr

execute

cisco-support

read, execute

Example

The following example shows how to view the status of the traffic generator instance and the packet details:

Router# show diagnostic packet-generator status t1 location 0/RP0/CPU0
0/RP0/CPU0:
Name           Run_State    Type    Capture  Set_Rate(pps)  Applied_Rate(pps)  Duration(sec)  TC  Phy_Interface  NPU  Slice  IFG  Packets        Bytes         
================================================================================================================================================================
T1             Running      Ingress True     100            101                60             0   FH0/0/0/1      0    4      1    209            45144         
----------------------------------------------------------------------------------------------------------------------------------------------------------------
Packet Details:
###[ Ethernet ]###
  dst       = 78:bf:d2:07:10:08
  src       = 00:00:00:00:00:01
  type      = IPv4
###[ IP ]###
     version   = 4
     ihl       = 5
     tos       = 0x0
     len       = 128
     id        = 1
     flags     =
     frag      = 0
     ttl       = 64
     proto     = udp
     chksum    = 0x446b
     src       = 32.0.0.1
     dst       = 22.0.0.1
     \options   \
###[ UDP ]###
        sport     = domain
        dport     = domain
        len       = 108
        chksum    = 0xc3a5
###[ DNS ]###
           id        = 24929
           qr        = 0
           opcode    = 12
           aa        = 0
           tc        = 0
           rd        = 1
           ra        = 0
           z         = 1
           ad        = 1
           cd        = 0
           rcode     = format-error
           qdcount   = 24929
           ancount   = 24929
           nscount   = 24929
           arcount   = 24929
           qd        = ''
           an        = ''
           ns        = ''
           ar        = ''
###[ Raw ]###
              load      = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'