;; 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 "" for ;; each new parameter 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 parameters 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 ;; parameters 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 kind 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 parameters a at time using some special ;; pseudo-parameters. Here we'll query for the complete stream definition. ;; This will give us all the parameters 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-parameter query you cannot ;; immediately tell which parameter 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 ""; so when you receive this ;; response you know that there are no more parameters 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-parameter 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. P_INTERFACE "SFP-E 10/100/1000M [Triple] [Auto]" PS_PACKETLENGTH [10] RANDOM 100 200 P_MACADDRESS 0x04F4BC1A0CE0 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_HEADERPROTOCOL [10] ETHERNET PS_PACKETHEADER [10] 0x00000000000004F4BC1A0CE0FFFF 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 PC_STATS 0 1 150048282720010104 PC_PACKET [0] 0x001122334455AABBCCDDEEFF2222FEDCBA9876543210F06ECC85 PT_TOTAL 0 0 149443 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 149417 1000 P_RECEIVESYNC IN_SYNC PR_TOTAL 0 0 149443 1001 PR_NOTPLD 0 0 26 1 PR_EXTRA 0 0 0 0 0 0 0 0 PR_TPLDS 77 PR_TPLDTRAFFIC [77] 0 0 149417 1000 PR_TPLDERRORS [77] 0 0 0 0 PR_TPLDLATENCY [77] 0 0 0 0 PR_TPLDJITTER [77] -1 -1 -1 -1 PC_STATS 1 102 150048282720010104 PC_EXTRA [1] 96759552 0 12094759 185 PC_PACKET [1] 0x0000000000FF04F4BC1A0CE0FFFF0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA0000000C88E6E50004D0E8000BAC3F360F4D0A5C8E8491995 PC_EXTRA [2] 96762552 0 191 187 PC_PACKET [2] 0x0000000000FE04F4BC1A0CE0FFFF0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA0A1A2000001C88E6FCA004D0E00000BC3226165CB9FC8BCB813A6 PC_EXTRA [3] 96765552 0 189 143 PC_PACKET [3] 0x0000000000FD04F4BC1A0CE0FFFF0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F70717273747576000002C88E7117004D0E0000D1C3EC7FC91574C8EC77D934 PC_EXTRA [4] 96768240 0 191 185 PC_PACKET [4] 0x0000000000FC04F4BC1A0CE0FFFF0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA0000003C88E728E004D0E000051C3677C478D7CC8183FC6DF PC_EXTRA [5] 96771216 0 189 106 PC_PACKET [5] 0x0000000000FB04F4BC1A0CE0FFFF0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F5051000004C88E73B7004D0E00008CC3EB7D4DB3D7C8DED1C74B