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