Each reference pipeline comes with a Python test program that you can execute to verify its functionality.
The test program uses the config.json file in the following location but uses a different attribute than when using it to start the simulator:
/sw/nic/rudra/src/conf/hello_world/config.json
To see the packet generation configuration, execute the command:
# cat /sw/nic/rudra/src/conf/hello_world/config.json
In the middle part of the file, you can see the create
key and the tests definition for pkt1, pkt2,
pkt3 and, pkt4. In the later part of the file, a verify_packet
message is the success criteria for each test. The
following is an example file content.
"create": {
"description": "p4 table entry is created as per base table_config. send and verify packet based on the given packet specification",
"craft_packet": {
"description": "generate a packet with the given dmac, ips and ports",
"pkt1": {
"description": "this packet should be redirected to the arm and then forwarded",
"ethHdr": {
"dst": "00:00:00:00:10:02",
"ipHdr": {
"src": "1.2.3.4",
"dst": "2.3.4.5",
"udpHdr": {
"sport": 345,
"dport": 456
}
}
},
"count": "1"
},
"pkt2": {
"description": "this packet should be directly sent to the verify intf",
"ethHdr": {
"dst": "00:00:00:00:10:04",
"ipHdr": {
"src": "5.5.5.5",
"dst": "1.2.1.2",
"udpHdr": {
"sport": 486,
"dport": 524
}
}
},
"count": "1"
},
"pkt3": {
"description": "this packet should be dropped",
"ethHdr": {
"dst": "00:50:00:00:10:23",
"ipHdr": {
"src": "3.5.6.2",
"dst": "4.2.0.8",
"udpHdr": {
"sport": 918,
"dport": 835
}
}
},
"count": "1"
},
"pkt4": {
"description": "this packet should be dropped as there is no nacl rule present for it in the nacl table",
"ethHdr": {
"dst": "00:00:72:00:10:62",
"ipHdr": {
"src": "9.1.5.6",
"dst": "3.8.1.0",
"udpHdr": {
"sport": 926,
"dport": 173
}
}
},
"count": "1"
}
},
"verify_packet": {
"description": "send and verify uf the spec have been programmed correctly",
"pkt1": {
"ethHdr": {
"dst": "00:00:00:00:10:02",
"ipHdr": {
"src": "1.2.3.4",
"dst": "2.3.4.5",
"udpHdr": {
"sport": 345,
"dport": 456
}
}
}
},
"pkt2": {
"ethHdr": {
"dst": "00:00:00:00:10:04",
"ipHdr": {
"src": "5.5.5.5",
"dst": "1.2.1.2",
"udpHdr": {
"sport": 486,
"dport": 524
}
}
}
},
"pkt3": {
},
"pkt4": {
}
}
}