Sample XOA CLI Script#

Input#

Below is an example of using the XOA CLI scripting commands to define and execute a simple test. A file containing these commands can simply be uploaded to a chassis using the XenaScriptingClient.

Listing 2 sample_input.txt#
; This is an example of using the Xena scripting language to set-up and
; execute a simple test case.
;
; This file is simply sent to TCP/IP port 22611 on a Xena chassis,
; and while it is executing on the chassis it sends lines of text
; back on the same TCP/IP connection.
;
; Much of what you see in response from the chassis is an "<OK>" for
; each new command value that you have sent. There will also be a
; blank line in response to each comment you send to the chassis. More
; importantly, of course, you will see the values of the commands and
; statistics that you explicitly query for.
;
; The chassis has a basic "WAIT" command to allow simple server-side
; waiting. For more advanced scripting logic, you should use a client-
; side scripting environment like Tcl/Perl/Python/Basic/C to send commands
; to the chassis, and retrieve and parse the responses.
;
; The example works on a single port configured in TX-to-RX loop mode
; so that everything sent is also received on the same port.

; First we authenticate the connection to the chassis and provide a user
; name for reservation:
C_LOGON "xena"
C_OWNER "example"

; We now set a default port for the session so that all port-specific
; commands go to this port; this also gives you a single place to edit
; if you want to run the example on a different port. The syntax is
; simply "m/p" where "m" is the module number and "p" is the port number:
0/0

; Let's see what type of port this is by querying for the interface type:
P_INTERFACE ?

; Now relinquish and reserve the port, clear any existing configuration, 
; and set it in loop-mode:
P_RESERVATION RELINQUISH
P_RESERVATION RESERVE
P_RESET
P_LOOPBACK TXON2RX

; Make a stream for transmitting 1000 packets of varying size at a 50% of
; the wire rate for the port. The packet data is just an Ethernet header,
; and we put a modifier on the last byte of the MAC destination address.
; The rest of the packet payload is and incrementing pattern of bytes.
; Finally we insert a Xena test payload at the end containing a TID value
; of 77. We use index 10 for the stream definition itself:
PS_CREATE [10]
PS_COMMENT [10] "Example stream of 1000 packets"
PS_PACKETLIMIT [10] 1000
PS_PACKETLENGTH [10] RANDOM 100 200
PS_RATEFRACTION [10] 500000
PS_MODIFIERCOUNT [10] 1
PS_MODIFIER [10,0] 5 0xFF000000 DEC 1
PS_PAYLOAD [10] INCREMENTING
PS_TPLDID [10] 77
PS_ENABLE [10] ON

; That was the stream definition. Until now we have been sending values
; to the chassis. Now we'll ask for information from the chassis just to
; verify our configuration. Queries have the same format as used when
; setting values, but with a "?" instead of the values:
PS_PACKETLENGTH [10] ?
P_MACADDRESS ?
; You can also ask for multiple commands a at time using some special
; pseudo-commands. Here we'll query for the complete stream definition.
; This will give us all the commands defined for the stream, including
; some which we have not set explicitly and therefore still have their
; default values from when the configuration was reset:
PS_CONFIG [10] ?

; When parsing the responses from a multi-command query you cannot
; immediately tell which command value is the last one. To establish a
; fix-point in the stream of response lines you can issue the special "SYNC"
; command which simply responds with "<SYNC>"; so when you receive this
; response you know that there are no more commands coming:
SYNC

; We're finally ready to run some traffic, but before we start the stream
; we have just defined we'll start the capture function and send out a single
; packet. Since we are in loop mode this packet will be captured on our port,
; and we'll pull it over to the client:

P_CAPTURE ON
P_XMITONE 0x001122334455,AABBCCDDEEFF,2222,FEDCBA9876543210,00000000
PC_STATS ?
PC_PACKET [0] ?

; Ok, now we'll start the stream. Capture is already on. Since this may be a
; slow port we insert a short wait period to make sure all 1000 packets are
; sent, and then we query for the TX and RX statistics:
P_TRAFFIC ON
WAIT 3
PT_ALL ?
PR_ALL ?

; All the packets should have been captured. We pull in a few of them to see
; the varying length and check that the modifier has correctly varied the 5th
; byte. We'll use another multi-command query that gives us both the packet
; data and the extra information available for each capture event:
PC_STATS ?
PC_INFO [1] ?
PC_INFO [2] ?
PC_INFO [3] ?
PC_INFO [4] ?
PC_INFO [5] ?

; Even though the single stream of the port has run dry we must still explicitly
; stop traffic generation, and we also stop capturing:
P_TRAFFIC OFF
P_CAPTURE OFF

; That's it.
; You have now seen how to build a stream, transmit the packets, do some
; capturing, and issue queries for statistics, capture, and configuration.

Output#

Below you can download a file containing the output generated by the chassis when it receives the commands shown in the previous section. A dump like this can be obtained and saved using the XenaScriptClient.

You need to do a line-by-line correlation of the two lists in order to fully understand the output.

Note

There are sections of blank lines in the output corresponding to the comment lines in the input.

Listing 3 sample_output.txt#
;; This is an example of using the Xena scripting language to set-up and
;; execute a simple test case.
;;
;; This file is simply sent to TCP/IP port 22611 on a Xena chassis,
;; and while it is executing on the chassis it sends lines of text
;; back on the same TCP/IP connection.
;;
;; Much of what you see in response from the chassis is an "<OK>" for
;; each new command value that you have sent. There will also be a
;; blank line in response to each comment you send to the chassis. More
;; importantly, of course, you will see the values of the commands and
;; statistics that you explicitly query for.
;;
;; The chassis has a basic "WAIT" command to allow simple server-side
;; waiting. For more advanced scripting logic, you should use a client-
;; side scripting environment like Tcl/Perl/Python/Basic/C to send commands
;; to the chassis, and retrieve and parse the responses.
;;
;; The example works on a single port configured in TX-to-RX loop mode
;; so that everything sent is also received on the same port.
;
;; First we authenticate the connection to the chassis and provide a user
;; name for reservation:
;C_LOGON "xena"
;C_OWNER "example"
;
;; We now set a default port for the session so that all port-specific
;; commands go to this port; this also gives you a single place to edit
;; if you want to run the example on a different port. The syntax is
;; simply "m/p" where "m" is the module number and "p" is the port number:
;0/0
;
;; Let's see what type of port this is by querying for the interface type:
;P_INTERFACE ?
;
;; Now relinquish and reserve the port, clear any existing configuration, 
;; and set it in loop-mode:
;P_RESERVATION RELINQUISH
;P_RESERVATION RESERVE
;P_RESET
;P_LOOPBACK TXON2RX
;
;; Make a stream for transmitting 1000 packets of varying size at a 50% of
;; the wire rate for the port. The packet data is just an Ethernet header,
;; and we put a modifier on the last byte of the MAC destination address.
;; The rest of the packet payload is and incrementing pattern of bytes.
;; Finally we insert a Xena test payload at the end containing a TID value
;; of 77. We use index 10 for the stream definition itself:
;PS_CREATE [10]
;PS_COMMENT [10] "Example stream of 1000 packets"
;PS_PACKETLIMIT [10] 1000
;PS_PACKETLENGTH [10] RANDOM 100 200
;PS_RATEFRACTION [10] 500000
;PS_MODIFIERCOUNT [10] 1
;PS_MODIFIER [10,0] 5 0xFF000000 DEC 1
;PS_PAYLOAD [10] INCREMENTING
;PS_TPLDID [10] 77
;PS_ENABLE [10] ON
;
;; That was the stream definition. Until now we have been sending values
;; to the chassis. Now we'll ask for information from the chassis just to
;; verify our configuration. Queries have the same format as used when
;; setting values, but with a "?" instead of the values:
;PS_PACKETLENGTH [10] ?
;P_MACADDRESS ?
;; You can also ask for multiple commands a at time using some special
;; pseudo-commands. Here we'll query for the complete stream definition.
;; This will give us all the commands defined for the stream, including
;; some which we have not set explicitly and therefore still have their
;; default values from when the configuration was reset:
;PS_CONFIG [10] ?
;
;; When parsing the responses from a multi-command query you cannot
;; immediately tell which command value is the last one. To establish a
;; fix-point in the stream of response lines you can issue the special "SYNC"
;; command which simply responds with "<SYNC>"; so when you receive this
;; response you know that there are no more commands coming:
;SYNC
;
;; We're finally ready to run some traffic, but before we start the stream
;; we have just defined we'll start the capture function and send out a single
;; packet. Since we are in loop mode this packet will be captured on our port,
;; and we'll pull it over to the client:
;
;P_CAPTURE ON
;P_XMITONE 0x001122334455,AABBCCDDEEFF,2222,FEDCBA9876543210,00000000
;PC_STATS ?
;PC_PACKET [0] ?
;
;; Ok, now we'll start the stream. Capture is already on. Since this may be a
;; slow port we insert a short wait period to make sure all 1000 packets are
;; sent, and then we query for the TX and RX statistics:
;P_TRAFFIC ON
;WAIT 3
;PT_ALL ?
;PR_ALL ?
;
;; All the packets should have been captured. We pull in a few of them to see
;; the varying length and check that the modifier has correctly varied the 5th
;; byte. We'll use another multi-command query that gives us both the packet
;; data and the extra information available for each capture event:
;PC_STATS ?
;PC_INFO [1] ?
;PC_INFO [2] ?
;PC_INFO [3] ?
;PC_INFO [4] ?
;PC_INFO [5] ?
;
;; Even though the single stream of the port has run dry we must still explicitly
;; stop traffic generation, and we also stop capturing:
;P_TRAFFIC OFF
;P_CAPTURE OFF
;
;; That's it.
;; You have now seen how to build a stream, transmit the packets, do some
;; capturing, and issue queries for statistics, capture, and configuration.























<OK>
<OK>







P_INTERFACE  "T1 100/1000M [Dual] [Auto]"



<NOTVALID>
<OK>
<OK>
<OK>







<OK>
<OK>
<OK>
<OK>
<OK>
<OK>
<OK>
<OK>
<OK>
<OK>





PS_PACKETLENGTH  [10]  RANDOM 100 200
P_MACADDRESS  0x04F4BC94DAE0





PS_ENABLE  [10]  ON
PS_PACKETLIMIT  [10]  1000
PS_COMMENT  [10]  "Example stream of 1000 packets"
PS_RATEFRACTION  [10]  500000
PS_BURST  [10]  -1 100
PS_BURSTGAP  [10]  0 0
PS_HEADERPROTOCOL  [10]  ETHERNET
PS_PACKETHEADER  [10]  0x00000000000004F4BC94DAE0FFFF
PS_MODIFIERCOUNT  [10]  1
PS_MODIFIER  [10,0]  5 0xFF000000 DEC 1
PS_MODIFIERRANGE  [10,0]  0 1 65535
PS_PACKETLENGTH  [10]  RANDOM 100 200
PS_PAYLOAD  [10]  INCREMENTING 
PS_TPLDID  [10]  77
PS_INSERTFCS  [10]  ON
PS_IPV4GATEWAY  [10]  0.0.0.0
PS_IPV6GATEWAY  [10]  0x00000000000000000000000000000000
PS_PFCPRIORITY  [10]  VLAN_PCP






<SYNC>






<OK>
<OK>
PC_STATS  0 1 380727300691184
PC_PACKET  [0]  0x001122334455AABBCCDDEEFF2222FEDCBA98765432
1000000000FD0707070707070707070707070707




<OK>
<RESUME>
PT_TOTAL  0 0 149400 1001
PT_NOTPLD  0 0 26 1
PT_EXTRA  0 0 0 0 0 0 0 0 0 0 0
PT_STREAM  [10]  0 0 149374 1000
P_RECEIVESYNC  IN_SYNC
PR_TOTAL  0 0 149374 1000
PR_NOTPLD  0 0 0 0
PR_EXTRA  1 0 0 0 0 0 0 0
PR_PFCSTATS  0 0 0 0 0 0 0 0 0
PR_TPLDS  77
PR_TPLDTRAFFIC  [77]  0 0 149374 1000
PR_TPLDERRORS  [77]  0 0 0 0
PR_TPLDLATENCY  [77]  53 53 53 53 53 53
PR_TPLDJITTER  [77]  -1 -1 -1 -1 -1 -1





PC_STATS  1 407 380727300691184
PC_EXTRA  [1]  380727384593744 0 9527447 142
PC_PACKET  [1]  0x0000000000FF04F4BC94DAE0FFFF0E0F101112131415161718191A1B1C1D1E
1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D
3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C
5D5E5F606162636465666768696A6B6C6D6E6F707172737475000000A01072
3D004D0E8000025DA67CAFBD79A06975CFA6
PC_EXTRA  [2]  380727384596744 0 190 187
PC_PACKET  [2]  0x0000000000FE04F4BC94DAE0FFFF0E0F101112131415161718191A1B1C1D1E
1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D
3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C
5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B
7C7D7E7F808182838485868788898A8B8C8D8E8F909192939495969798999A
9B9C9D9E9FA0A1A2000001A01073B5004D0E0000335D667DEEB484A0E06076C2
PC_EXTRA  [3]  380727384599360 0 189 143
PC_PACKET  [3]  0x0000000000FD04F4BC94DAE0FFFF0E0F101112131415161718191A1B1C1D1E
1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D
3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C
5D5E5F606162636465666768696A6B6C6D6E6F70717273747576000002A010
74FD004D0E0000575DB67A6EFF28A0090E50FA
PC_EXTRA  [4]  380727384602416 0 191 185
PC_PACKET  [4]  0x0000000000FC04F4BC94DAE0FFFF0E0F101112131415161718191A1B1C1D1E
1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D
3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C
5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B
7C7D7E7F808182838485868788898A8B8C8D8E8F909192939495969798999A
9B9C9D9E9FA0000003A010767C004D0E0000F75D6B78297FC6A0181B0A5C
PC_EXTRA  [5]  380727384604776 0 189 106
PC_PACKET  [5]  0x0000000000FB04F4BC94DAE0FFFF0E0F101112131415161718191A1B1C1D1E
1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D
3E3F404142434445464748494A4B4C4D4E4F5051000004A01077A4004D0E00
002C5DC3798EA0ADA0A2FEAF0D



<OK>
<OK>