Running the Test Program and Verifying the Outcome

Hello World Reference Pipeline User Guide (UG1669)

Document ID
UG1669
Release Date
2024-02-15
Revision
1.1 English

The location of the test program is:

/sw/nic/rudra/src/hello_world/test/test_nacl_redirect.py

To run the test program, execute the following commands:

# cd /sw/nic/rudra/src/hello_world/test
# configfile=/sw/nic/rudra/src/conf/hello_world/config.json
# python3 ./test_nacl_redirect.py -c ${configfile} -o create 

You should see the test program getting executed. An example of the executed test program is given below. It shows the result of each test. A Test return code : True message in the last line of the result indicates that all the tests were run to completion and were successful.

hello_world configuration added to the spec table
----------------------------------------------------------------------------------------------------
         dmac : 00:00:00:00:10:02
         sip : 1.2.3.4
         dip : 2.3.4.5
         sport : 345
         dport : 456
         action : nacl_redirect
----------------------------------------------------------------------------------------------------
         dmac : 00:00:00:00:10:04
         sip : 5.5.5.5
         dip : 1.2.1.2
         sport : 486
         dport : 524
         action : nacl_permit
----------------------------------------------------------------------------------------------------
         dmac : 00:50:00:00:10:23
         sip : 3.5.6.2
         dip : 4.2.0.8
         sport : 918
         dport : 835
         action : nacl_drop
----------------------------------------------------------------------------------------------------
Packets to be sent :
***********************************************************************************Packet ID: pkt1
Updated destination in the ethHdr to 00:00:00:00:10:02
Updated source in the ipHdr to 1.2.3.4
Updated destination in the ipHdr to 2.3.4.5
Updated source port in the udpHdr to 345
Updated destination port in the udpHdr to 456
***********************************************************************************Packet ID: pkt2
Updated destination in the ethHdr to 00:00:00:00:10:04
Updated source in the ipHdr to 5.5.5.5
Updated destination in the ipHdr to 1.2.1.2
Updated source port in the udpHdr to 486
Updated destination port in the udpHdr to 524
***********************************************************************************Packet ID: pkt3
Updated destination in the ethHdr to 00:50:00:00:10:23
Updated source in the ipHdr to 3.5.6.2
Updated destination in the ipHdr to 4.2.0.8
Updated source port in the udpHdr to 918
Updated destination port in the udpHdr to 835
***********************************************************************************Packet ID: pkt4
Updated destination in the ethHdr to 00:00:72:00:10:62
Updated source in the ipHdr to 9.1.5.6
Updated destination in the ipHdr to 3.8.1.0
Updated source port in the udpHdr to 926
Updated destination port in the udpHdr to 173
***********************************************************************************2023-09-08 01:36:15 Sending pkt with pkt id: pkt1
Sent 1 packets.
2023-09-08 01:36:16 Received a pkt
Packet test for pkt1 passed
----------------------------------------------------------------------------------------------------
2023-09-08 01:36:46 Sending pkt with pkt id: pkt2
Sent 1 packets.
2023-09-08 01:36:47 Received a pkt
Packet test for pkt2 passed
----------------------------------------------------------------------------------------------------
2023-09-08 01:37:17 Sending pkt with pkt id: pkt3
Sent 1 packets.
2023-09-08 01:37:18 Received a pkt
Packet test for pkt3 failed
----------------------------------------------------------------------------------------------------
2023-09-08 01:37:48 Sending pkt with pkt id: pkt4
Sent 1 packets.
2023-09-08 01:37:49 Received a pkt
Packet test for pkt4 failed
----------------------------------------------------------------------------------------------------
here is the callback function
Executing command pdsctl show pipeline internal table nacl
Callback function returned successfully
***********************************************************************************Executing hello_world packet test
***********************************************************************************Test Execution   : Packet ID : pkt1
Test Description : this packet should be redirected to the arm and then forwarded
STATUS : SUCCESS
----------------------------------------------------------------------------------------------------
Test Execution   : Packet ID : pkt2
Test Description : this packet should be directly sent to the verify intf
STATUS : SUCCESS
----------------------------------------------------------------------------------------------------
Test Execution   : Packet ID : pkt3
Test Description : this packet should be dropped
STATUS : SUCCESS
----------------------------------------------------------------------------------------------------
Test Execution   : Packet ID : pkt4
Test Description : this packet should be dropped as there is no nacl rule present for it in the nacl table
STATUS : SUCCESS
----------------------------------------------------------------------------------------------------
The hello_world packet test has passed
Test return code : True