xref: /linux/tools/testing/selftests/tc-testing/tc-tests/actions/gact.json (revision 0ea5c948cb64bab5bc7a5516774eb8536f05aa0d)
1[
2    {
3        "id": "e89a",
4        "name": "Add valid pass action",
5        "category": [
6            "actions",
7            "gact"
8        ],
9        "plugins": {
10           "requires": "nsPlugin"
11        },
12        "setup": [
13            [
14                "$TC actions flush action gact",
15                0,
16                1,
17                255
18            ]
19        ],
20        "cmdUnderTest": "$TC actions add action pass index 8",
21        "expExitCode": "0",
22        "verifyCmd": "$TC actions list action gact",
23        "matchPattern": "action order [0-9]*: gact action pass.*index 8 ref",
24        "matchCount": "1",
25        "teardown": [
26            "$TC actions flush action gact"
27        ]
28    },
29    {
30        "id": "a02c",
31        "name": "Add valid pipe action",
32        "category": [
33            "actions",
34            "gact"
35        ],
36        "plugins": {
37           "requires": "nsPlugin"
38        },
39        "setup": [
40            [
41                "$TC actions flush action gact",
42                0,
43                1,
44                255
45            ]
46        ],
47        "cmdUnderTest": "$TC actions add action pipe index 6",
48        "expExitCode": "0",
49        "verifyCmd": "$TC actions list action gact",
50        "matchPattern": "action order [0-9]*: gact action pipe.*index 6 ref",
51        "matchCount": "1",
52        "teardown": [
53            "$TC actions flush action gact"
54        ]
55    },
56    {
57        "id": "feef",
58        "name": "Add valid reclassify action",
59        "category": [
60            "actions",
61            "gact"
62        ],
63        "plugins": {
64           "requires": "nsPlugin"
65        },
66        "setup": [
67            [
68                "$TC actions flush action gact",
69                0,
70                1,
71                255
72            ]
73        ],
74        "cmdUnderTest": "$TC actions add action reclassify index 5",
75        "expExitCode": "0",
76        "verifyCmd": "$TC actions list action gact",
77        "matchPattern": "action order [0-9]*: gact action reclassify.*index 5 ref",
78        "matchCount": "1",
79        "teardown": [
80            "$TC actions flush action gact"
81        ]
82    },
83    {
84        "id": "8a7a",
85        "name": "Add valid drop action",
86        "category": [
87            "actions",
88            "gact"
89        ],
90        "plugins": {
91           "requires": "nsPlugin"
92        },
93        "setup": [
94            [
95                "$TC actions flush action gact",
96                0,
97                1,
98                255
99            ]
100        ],
101        "cmdUnderTest": "$TC actions add action drop index 30",
102        "expExitCode": "0",
103        "verifyCmd": "$TC actions list action gact",
104        "matchPattern": "action order [0-9]*: gact action drop.*index 30 ref",
105        "matchCount": "1",
106        "teardown": [
107            "$TC actions flush action gact"
108        ]
109    },
110    {
111        "id": "9a52",
112        "name": "Add valid continue action",
113        "category": [
114            "actions",
115            "gact"
116        ],
117        "plugins": {
118           "requires": "nsPlugin"
119        },
120        "setup": [
121            [
122                "$TC actions flush action gact",
123                0,
124                1,
125                255
126            ]
127        ],
128        "cmdUnderTest": "$TC actions add action continue index 432",
129        "expExitCode": "0",
130        "verifyCmd": "$TC actions list action gact",
131        "matchPattern": "action order [0-9]*: gact action continue.*index 432 ref",
132        "matchCount": "1",
133        "teardown": [
134            "$TC actions flush action gact"
135        ]
136    },
137    {
138        "id": "d700",
139        "name": "Add invalid action",
140        "category": [
141            "actions",
142            "gact"
143        ],
144        "plugins": {
145           "requires": "nsPlugin"
146        },
147        "setup": [
148            [
149                "$TC actions flush action gact",
150                0,
151                1,
152                255
153            ]
154        ],
155        "cmdUnderTest": "$TC actions add action pump index 386",
156        "expExitCode": "255",
157        "verifyCmd": "$TC actions list action gact",
158        "matchPattern": "action order [0-9]*: gact action.*index 386 ref",
159        "matchCount": "0",
160        "teardown": [
161            "$TC actions flush action gact"
162        ]
163    },
164    {
165        "id": "9215",
166        "name": "Add action with duplicate index",
167        "category": [
168            "actions",
169            "gact"
170        ],
171        "plugins": {
172           "requires": "nsPlugin"
173        },
174        "setup": [
175            [
176                "$TC actions flush action gact",
177                0,
178                1,
179                255
180            ],
181            "$TC actions add action pipe index 15"
182        ],
183        "cmdUnderTest": "$TC actions add action drop index 15",
184        "expExitCode": "255",
185        "verifyCmd": "$TC actions list action gact",
186        "matchPattern": "action order [0-9]*: gact action drop.*index 15 ref",
187        "matchCount": "0",
188        "teardown": [
189            "$TC actions flush action gact"
190        ]
191    },
192    {
193        "id": "798e",
194        "name": "Add action with index exceeding 32-bit maximum",
195        "category": [
196            "actions",
197            "gact"
198        ],
199        "plugins": {
200           "requires": "nsPlugin"
201        },
202        "setup": [
203            [
204                "$TC actions flush action gact",
205                0,
206                1,
207                255
208            ]
209        ],
210        "cmdUnderTest": "$TC actions add action drop index 4294967296",
211        "expExitCode": "255",
212        "verifyCmd": "actions list action gact",
213        "matchPattern": "action order [0-9]*: gact action drop.*index 4294967296 ref",
214        "matchCount": "0",
215        "teardown": [
216            "$TC actions flush action gact"
217        ]
218    },
219    {
220        "id": "22be",
221        "name": "Add action with index at 32-bit maximum",
222        "category": [
223            "actions",
224            "gact"
225        ],
226        "plugins": {
227           "requires": "nsPlugin"
228        },
229        "setup": [
230            [
231                "$TC actions flush action gact",
232                0,
233                1,
234                255
235            ]
236        ],
237        "cmdUnderTest": "$TC actions add action drop index 4294967295",
238        "expExitCode": "0",
239        "verifyCmd": "$TC actions list action gact",
240        "matchPattern": "action order [0-9]*: gact action drop.*index 4294967295 ref",
241        "matchCount": "1",
242        "teardown": [
243            "$TC actions flush action gact"
244        ]
245    },
246    {
247        "id": "ac2a",
248        "name": "List actions",
249        "category": [
250            "actions",
251            "gact"
252        ],
253        "plugins": {
254           "requires": "nsPlugin"
255        },
256        "setup": [
257            [
258                "$TC actions flush action gact",
259                0,
260                1,
261                255
262            ],
263            "$TC actions add action reclassify index 101",
264            "$TC actions add action reclassify index 102",
265            "$TC actions add action reclassify index 103",
266            "$TC actions add action reclassify index 104",
267            "$TC actions add action reclassify index 105"
268        ],
269        "cmdUnderTest": "$TC actions list action gact",
270        "expExitCode": "0",
271        "verifyCmd": "$TC actions list action gact",
272        "matchPattern": "action order [0-9]*: gact action reclassify",
273        "matchCount": "5",
274        "teardown": [
275            "$TC actions flush action gact"
276        ]
277    },
278    {
279        "id": "3edf",
280        "name": "Flush gact actions",
281        "category": [
282            "actions",
283            "gact"
284        ],
285        "plugins": {
286           "requires": "nsPlugin"
287        },
288        "setup": [
289            "$TC actions add action reclassify index 101",
290            "$TC actions add action reclassify index 102",
291            "$TC actions add action reclassify index 103",
292            "$TC actions add action reclassify index 104",
293            "$TC actions add action reclassify index 105"
294        ],
295        "cmdUnderTest": "$TC actions flush action gact",
296        "expExitCode": "0",
297        "verifyCmd": "$TC actions list action gact",
298        "matchPattern": "action order [0-9]*: gact action reclassify",
299        "matchCount": "0",
300        "teardown": []
301    },
302    {
303        "id": "63ec",
304        "name": "Delete pass action",
305        "category": [
306            "actions",
307            "gact"
308        ],
309        "plugins": {
310           "requires": "nsPlugin"
311        },
312        "setup": [
313            [
314                "$TC actions flush action gact",
315                0,
316                1,
317                255
318            ],
319            "$TC actions add action pass index 1"
320        ],
321        "cmdUnderTest": "$TC actions del action gact index 1",
322        "expExitCode": "0",
323        "verifyCmd": "$TC actions list action gact",
324        "matchPattern": "action order [0-9]*: gact action pass.*index 1 ref",
325        "matchCount": "0",
326        "teardown": [
327            "$TC actions flush action gact"
328        ]
329    },
330    {
331        "id": "46be",
332        "name": "Delete pipe action",
333        "category": [
334            "actions",
335            "gact"
336        ],
337        "plugins": {
338           "requires": "nsPlugin"
339        },
340        "setup": [
341            [
342                "$TC actions flush action gact",
343                0,
344                1,
345                255
346            ],
347            "$TC actions add action pipe index 9"
348        ],
349        "cmdUnderTest": "$TC actions del action gact index 9",
350        "expExitCode": "0",
351        "verifyCmd": "$TC actions list action gact",
352        "matchPattern": "action order [0-9]*: gact action pipe.*index 9 ref",
353        "matchCount": "0",
354        "teardown": [
355            "$TC actions flush action gact"
356        ]
357    },
358    {
359        "id": "2e08",
360        "name": "Delete reclassify action",
361        "category": [
362            "actions",
363            "gact"
364        ],
365        "plugins": {
366           "requires": "nsPlugin"
367        },
368        "setup": [
369            [
370                "$TC actions flush action gact",
371                0,
372                1,
373                255
374            ],
375            "$TC actions add action reclassify index 65536"
376        ],
377        "cmdUnderTest": "$TC actions del action gact index 65536",
378        "expExitCode": "0",
379        "verifyCmd": "$TC actions list action gact",
380        "matchPattern": "action order [0-9]*: gact action reclassify.*index 65536 ref",
381        "matchCount": "0",
382        "teardown": [
383            "$TC actions flush action gact"
384        ]
385    },
386    {
387        "id": "99c4",
388        "name": "Delete drop action",
389        "category": [
390            "actions",
391            "gact"
392        ],
393        "plugins": {
394           "requires": "nsPlugin"
395        },
396        "setup": [
397            [
398                "$TC actions flush action gact",
399                0,
400                1,
401                255
402            ],
403            "$TC actions add action drop index 16"
404        ],
405        "cmdUnderTest": "$TC actions del action gact index 16",
406        "expExitCode": "0",
407        "verifyCmd": "$TC actions list action gact",
408        "matchPattern": "action order [0-9]*: gact action drop.*index 16 ref",
409        "matchCount": "0",
410        "teardown": [
411            "$TC actions flush action gact"
412        ]
413    },
414    {
415        "id": "fb6b",
416        "name": "Delete continue action",
417        "category": [
418            "actions",
419            "gact"
420        ],
421        "plugins": {
422           "requires": "nsPlugin"
423        },
424        "setup": [
425            [
426                "$TC actions flush action gact",
427                0,
428                1,
429                255
430            ],
431            "$TC actions add action continue index 32"
432        ],
433        "cmdUnderTest": "$TC actions del action gact index 32",
434        "expExitCode": "0",
435        "verifyCmd": "actions list action gact",
436        "matchPattern": "action order [0-9]*: gact action continue.*index 32 ref",
437        "matchCount": "0",
438        "teardown": [
439            "$TC actions flush action gact"
440        ]
441    },
442    {
443        "id": "0eb3",
444        "name": "Delete non-existent action",
445        "category": [
446            "actions",
447            "gact"
448        ],
449        "plugins": {
450           "requires": "nsPlugin"
451        },
452        "setup": [
453            [
454                "$TC actions flush action gact",
455                0,
456                1,
457                255
458            ]
459        ],
460        "cmdUnderTest": "$TC actions del action gact index 2",
461        "expExitCode": "255",
462        "verifyCmd": "$TC actions list action gact",
463        "matchPattern": "action order [0-9]*: gact action",
464        "matchCount": "0",
465        "teardown": [
466            "$TC actions flush action gact"
467        ]
468    },
469    {
470        "id": "f02c",
471        "name": "Replace gact action",
472        "category": [
473            "actions",
474            "gact"
475        ],
476        "plugins": {
477           "requires": "nsPlugin"
478        },
479        "setup": [
480            [
481                "$TC actions flush action gact",
482                0,
483                1,
484                255
485            ],
486            "$TC actions add action drop index 10",
487            "$TC actions add action drop index 12"
488        ],
489        "cmdUnderTest": "$TC actions replace action ok index 12",
490        "expExitCode": "0",
491        "verifyCmd": "$TC actions ls action gact",
492        "matchPattern": "action order [0-9]*: gact action pass",
493        "matchCount": "1",
494        "teardown": [
495            "$TC actions flush action gact"
496        ]
497    },
498    {
499        "id": "525f",
500        "name": "Get gact action by index",
501        "category": [
502            "actions",
503            "gact"
504        ],
505        "plugins": {
506           "requires": "nsPlugin"
507        },
508        "setup": [
509            [
510                "$TC actions flush action gact",
511                0,
512                1,
513                255
514            ],
515            "$TC actions add action drop index 3900800700"
516        ],
517        "cmdUnderTest": "$TC actions get action gact index 3900800700",
518        "expExitCode": "0",
519        "verifyCmd": "$TC actions get action gact index 3900800700",
520        "matchPattern": "index 3900800700",
521        "matchCount": "1",
522        "teardown": [
523            "$TC actions flush action gact"
524        ]
525    },
526    {
527        "id": "1021",
528        "name": "Add batch of 32 gact pass actions",
529        "category": [
530            "actions",
531            "gact"
532        ],
533        "plugins": {
534           "requires": "nsPlugin"
535        },
536        "setup": [
537            [
538                "$TC actions flush action gact",
539                0,
540                1,
541                255
542            ]
543        ],
544        "cmdUnderTest": "bash -c \"for i in \\`seq 1 32\\`; do cmd=\\\"action pass index \\$i \\\"; args=\"\\$args\\$cmd\"; done && $TC actions add \\$args\"",
545        "expExitCode": "0",
546        "verifyCmd": "$TC actions list action gact",
547        "matchPattern": "^[ \t]+index [0-9]+ ref",
548        "matchCount": "32",
549        "teardown": [
550            "$TC actions flush action gact"
551        ]
552    },
553    {
554        "id": "da7a",
555        "name": "Add batch of 32 gact continue actions with cookie",
556        "category": [
557            "actions",
558            "gact"
559        ],
560        "plugins": {
561           "requires": "nsPlugin"
562        },
563        "setup": [
564            [
565                "$TC actions flush action gact",
566                0,
567                1,
568                255
569            ]
570        ],
571        "cmdUnderTest": "bash -c \"for i in \\`seq 1 32\\`; do cmd=\\\"action continue index \\$i cookie aabbccddeeff112233445566778800a1 \\\"; args=\"\\$args\\$cmd\"; done && $TC actions add \\$args\"",
572        "expExitCode": "0",
573        "verifyCmd": "$TC actions list action gact",
574        "matchPattern": "^[ \t]+index [0-9]+ ref",
575        "matchCount": "32",
576        "teardown": [
577            "$TC actions flush action gact"
578        ]
579    },
580    {
581        "id": "8aa3",
582        "name": "Delete batch of 32 gact continue actions",
583        "category": [
584            "actions",
585            "gact"
586        ],
587        "plugins": {
588           "requires": "nsPlugin"
589        },
590        "setup": [
591            [
592                "$TC actions flush action gact",
593                0,
594                1,
595                255
596            ],
597            "bash -c \"for i in \\`seq 1 32\\`; do cmd=\\\"action continue index \\$i \\\"; args=\\\"\\$args\\$cmd\\\"; done && $TC actions add \\$args\""
598        ],
599        "cmdUnderTest": "bash -c \"for i in \\`seq 1 32\\`; do cmd=\\\"action gact index \\$i \\\"; args=\"\\$args\\$cmd\"; done && $TC actions del \\$args\"",
600        "expExitCode": "0",
601        "verifyCmd": "$TC actions list action gact",
602        "matchPattern": "^[ \t]+index [0-9]+ ref",
603        "matchCount": "0",
604        "teardown": []
605    },
606    {
607        "id": "8e47",
608        "name": "Add gact action with random determ goto chain control action",
609        "category": [
610            "actions",
611            "gact"
612        ],
613        "plugins": {
614           "requires": "nsPlugin"
615        },
616        "setup": [
617            [
618                "$TC actions flush action gact",
619                0,
620                1,
621                255
622            ]
623        ],
624        "cmdUnderTest": "$TC actions add action pass random determ goto chain 1 2 index 90",
625        "expExitCode": "255",
626        "verifyCmd": "$TC actions list action gact",
627        "matchPattern": "action order [0-9]*: gact action pass random type determ goto chain 1 val 2.*index 90 ref",
628        "matchCount": "0",
629        "teardown": [
630            "$TC actions flush action gact"
631        ]
632    },
633    {
634        "id": "ca89",
635        "name": "Replace gact action with invalid goto chain control",
636        "category": [
637            "actions",
638            "gact"
639        ],
640        "plugins": {
641           "requires": "nsPlugin"
642        },
643        "setup": [
644            [
645                "$TC actions flush action gact",
646                0,
647                1,
648                255
649            ],
650            "$TC actions add action pass random determ drop 2 index 90"
651        ],
652        "cmdUnderTest": "$TC actions replace action goto chain 42 random determ drop 5 index 90 cookie c1a0c1a0",
653        "expExitCode": "255",
654        "verifyCmd": "$TC actions list action gact",
655        "matchPattern": "action order [0-9]*: gact action pass.*random type determ drop val 2.*index 90 ref",
656        "matchCount": "1",
657        "teardown": [
658            "$TC actions flush action gact"
659        ]
660    },
661    {
662        "id": "95ad",
663        "name": "Add gact pass action with no_percpu flag",
664        "category": [
665            "actions",
666            "gact"
667        ],
668        "plugins": {
669           "requires": "nsPlugin"
670        },
671        "setup": [
672            [
673                "$TC actions flush action gact",
674                0,
675                1,
676                255
677            ]
678        ],
679        "cmdUnderTest": "$TC actions add action pass no_percpu",
680        "expExitCode": "0",
681        "verifyCmd": "$TC actions list action gact",
682        "matchPattern": "action order [0-9]*: gact action pass.*no_percpu",
683        "matchCount": "1",
684        "teardown": [
685            "$TC actions flush action gact"
686        ]
687    },
688    {
689        "id": "7f52",
690        "name": "Try to flush action which is referenced by filter",
691        "category": [
692            "actions",
693            "gact"
694        ],
695        "plugins": {
696            "requires": "nsPlugin"
697        },
698        "setup": [
699            [
700                "$TC actions flush action gact",
701                0,
702                1,
703                255
704            ],
705            "$TC qdisc add dev $DEV1 ingress",
706            "$TC actions add action pass index 1",
707            "$TC filter add dev $DEV1 protocol all ingress prio 1 handle 0x1234 matchall action gact index 1"
708        ],
709        "cmdUnderTest": "$TC actions flush action gact",
710        "expExitCode": "1",
711        "verifyCmd": "$TC actions ls action gact",
712        "matchPattern": "total acts 1.*action order [0-9]*: gact action pass.*index 1 ref 2 bind 1",
713        "matchCount": "1",
714        "teardown": [
715            "$TC qdisc del dev $DEV1 ingress",
716            [
717                "sleep 1; $TC actions flush action gact",
718                0,
719                1
720            ]
721        ]
722    },
723    {
724        "id": "ae1e",
725        "name": "Try to flush actions when last one is referenced by filter",
726        "category": [
727            "actions",
728            "gact"
729        ],
730        "plugins": {
731            "requires": "nsPlugin"
732        },
733        "setup": [
734            [
735                "$TC actions flush action gact",
736                0,
737                1,
738                255
739            ],
740            "$TC qdisc add dev $DEV1 ingress",
741	    [
742                "$TC actions add action pass index 1",
743		0,
744		1,
745		255
746	    ],
747            "$TC actions add action reclassify index 2",
748            "$TC actions add action drop index 3",
749            "$TC filter add dev $DEV1 protocol all ingress prio 1 handle 0x1234 matchall action gact index 3"
750        ],
751        "cmdUnderTest": "$TC actions flush action gact",
752        "expExitCode": "0",
753        "verifyCmd": "$TC actions ls action gact",
754        "matchPattern": "total acts 1.*action order [0-9]*: gact action drop.*index 3 ref 2 bind 1",
755        "matchCount": "1",
756        "teardown": [
757            "$TC qdisc del dev $DEV1 ingress",
758            [
759                "sleep 1; $TC actions flush action gact",
760                0,
761                1
762            ]
763        ]
764    }
765]
766