-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
selftests/tc-testings: add selftests for xt action
Test 2029: Add xt action with log-prefix Test 3562: Replace xt action log-prefix Test 8291: Delete xt action with valid index Test 5169: Delete xt action with invalid index Test 7284: List xt actions Test 5010: Flush xt actions Test 8437: Add xt action with duplicate index Test 2837: Add xt action with invalid index Signed-off-by: Zhengchao Shao <shaozhengchao@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
- Loading branch information
Zhengchao Shao
authored and
David S. Miller
committed
Sep 16, 2022
1 parent
4a1db52
commit 910d504
Showing
1 changed file
with
219 additions
and
0 deletions.
There are no files selected for viewing
219 changes: 219 additions & 0 deletions
219
tools/testing/selftests/tc-testing/tc-tests/actions/xt.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,219 @@ | ||
[ | ||
{ | ||
"id": "2029", | ||
"name": "Add xt action with log-prefix", | ||
"category": [ | ||
"actions", | ||
"xt" | ||
], | ||
"setup": [ | ||
[ | ||
"$TC actions flush action xt", | ||
0, | ||
1, | ||
255 | ||
] | ||
], | ||
"cmdUnderTest": "$TC action add action xt -j LOG --log-prefix PONG index 100", | ||
"expExitCode": "0", | ||
"verifyCmd": "$TC action ls action xt", | ||
"matchPattern": "action order [0-9]*:.*target LOG level warning prefix \"PONG\".*index 100 ref", | ||
"matchCount": "1", | ||
"teardown": [ | ||
"$TC actions flush action xt" | ||
] | ||
}, | ||
{ | ||
"id": "3562", | ||
"name": "Replace xt action log-prefix", | ||
"category": [ | ||
"actions", | ||
"xt" | ||
], | ||
"setup": [ | ||
[ | ||
"$TC actions flush action xt", | ||
0, | ||
1, | ||
255 | ||
], | ||
[ | ||
"$TC action add action xt -j LOG --log-prefix PONG index 1", | ||
0, | ||
1, | ||
255 | ||
] | ||
], | ||
"cmdUnderTest": "$TC action replace action xt -j LOG --log-prefix WIN index 1", | ||
"expExitCode": "0", | ||
"verifyCmd": "$TC action get action xt index 1", | ||
"matchPattern": "action order [0-9]*:.*target LOG level warning prefix \"WIN\".*index 1 ref", | ||
"matchCount": "1", | ||
"teardown": [ | ||
"$TC action flush action xt" | ||
] | ||
}, | ||
{ | ||
"id": "8291", | ||
"name": "Delete xt action with valid index", | ||
"category": [ | ||
"actions", | ||
"xt" | ||
], | ||
"setup": [ | ||
[ | ||
"$TC actions flush action xt", | ||
0, | ||
1, | ||
255 | ||
], | ||
[ | ||
"$TC action add action xt -j LOG --log-prefix PONG index 1000", | ||
0, | ||
1, | ||
255 | ||
] | ||
], | ||
"cmdUnderTest": "$TC action delete action xt index 1000", | ||
"expExitCode": "0", | ||
"verifyCmd": "$TC action get action xt index 1000", | ||
"matchPattern": "action order [0-9]*:.*target LOG level warning prefix \"PONG\".*index 1000 ref", | ||
"matchCount": "0", | ||
"teardown": [ | ||
"$TC action flush action xt" | ||
] | ||
}, | ||
{ | ||
"id": "5169", | ||
"name": "Delete xt action with invalid index", | ||
"category": [ | ||
"actions", | ||
"xt" | ||
], | ||
"setup": [ | ||
[ | ||
"$TC actions flush action xt", | ||
0, | ||
1, | ||
255 | ||
], | ||
[ | ||
"$TC action add action xt -j LOG --log-prefix PONG index 1000", | ||
0, | ||
1, | ||
255 | ||
] | ||
], | ||
"cmdUnderTest": "$TC action delete action xt index 333", | ||
"expExitCode": "255", | ||
"verifyCmd": "$TC action get action xt index 1000", | ||
"matchPattern": "action order [0-9]*:.*target LOG level warning prefix \"PONG\".*index 1000 ref", | ||
"matchCount": "1", | ||
"teardown": [ | ||
"$TC action flush action xt" | ||
] | ||
}, | ||
{ | ||
"id": "7284", | ||
"name": "List xt actions", | ||
"category": [ | ||
"actions", | ||
"xt" | ||
], | ||
"setup": [ | ||
[ | ||
"$TC action flush action xt", | ||
0, | ||
1, | ||
255 | ||
], | ||
"$TC action add action xt -j LOG --log-prefix PONG index 1001", | ||
"$TC action add action xt -j LOG --log-prefix WIN index 1002", | ||
"$TC action add action xt -j LOG --log-prefix LOSE index 1003" | ||
], | ||
"cmdUnderTest": "$TC action list action xt", | ||
"expExitCode": "0", | ||
"verifyCmd": "$TC action list action xt", | ||
"matchPattern": "action order [0-9]*: tablename:", | ||
"matchCount": "3", | ||
"teardown": [ | ||
"$TC actions flush action xt" | ||
] | ||
}, | ||
{ | ||
"id": "5010", | ||
"name": "Flush xt actions", | ||
"category": [ | ||
"actions", | ||
"xt" | ||
], | ||
"setup": [ | ||
[ | ||
"$TC actions flush action xt", | ||
0, | ||
1, | ||
255 | ||
], | ||
"$TC action add action xt -j LOG --log-prefix PONG index 1001", | ||
"$TC action add action xt -j LOG --log-prefix WIN index 1002", | ||
"$TC action add action xt -j LOG --log-prefix LOSE index 1003" | ||
], | ||
"cmdUnderTest": "$TC action flush action xt", | ||
"expExitCode": "0", | ||
"verifyCmd": "$TC action list action xt", | ||
"matchPattern": "action order [0-9]*: tablename:", | ||
"matchCount": "0", | ||
"teardown": [ | ||
"$TC actions flush action xt" | ||
] | ||
}, | ||
{ | ||
"id": "8437", | ||
"name": "Add xt action with duplicate index", | ||
"category": [ | ||
"actions", | ||
"xt" | ||
], | ||
"setup": [ | ||
[ | ||
"$TC actions flush action xt", | ||
0, | ||
1, | ||
255 | ||
], | ||
"$TC action add action xt -j LOG --log-prefix PONG index 101" | ||
], | ||
"cmdUnderTest": "$TC action add action xt -j LOG --log-prefix WIN index 101", | ||
"expExitCode": "255", | ||
"verifyCmd": "$TC action get action xt index 101", | ||
"matchPattern": "action order [0-9]*:.*target LOG level warning prefix \"PONG\".*index 101", | ||
"matchCount": "1", | ||
"teardown": [ | ||
"$TC action flush action xt" | ||
] | ||
}, | ||
{ | ||
"id": "2837", | ||
"name": "Add xt action with invalid index", | ||
"category": [ | ||
"actions", | ||
"xt" | ||
], | ||
"setup": [ | ||
[ | ||
"$TC actions flush action xt", | ||
0, | ||
1, | ||
255 | ||
] | ||
], | ||
"cmdUnderTest": "$TC action add action xt -j LOG --log-prefix WIN index 4294967296", | ||
"expExitCode": "255", | ||
"verifyCmd": "$TC action ls action xt", | ||
"matchPattern": "action order [0-9]*:*target LOG level warning prefix \"WIN\"", | ||
"matchCount": "0", | ||
"teardown": [ | ||
"$TC action flush action xt" | ||
] | ||
} | ||
] |