1[
2    {
3        "id": "d959",
4        "name": "Add cBPF action with valid bytecode",
5        "category": [
6            "actions",
7            "bpf"
8        ],
9        "setup": [
10            [
11                "$TC action flush action bpf",
12                0,
13                1,
14                255
15            ]
16        ],
17        "cmdUnderTest": "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0' index 100",
18        "expExitCode": "0",
19        "verifyCmd": "$TC action get action bpf index 100",
20        "matchPattern": "action order [0-9]*: bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0' default-action pipe.*index 100 ref",
21        "matchCount": "1",
22        "teardown": [
23            "$TC action flush action bpf"
24        ]
25    },
26    {
27        "id": "f84a",
28        "name": "Add cBPF action with invalid bytecode",
29        "category": [
30            "actions",
31            "bpf"
32        ],
33        "setup": [
34            [
35                "$TC actions flush action bpf",
36                0,
37                1,
38                255
39            ]
40        ],
41        "cmdUnderTest": "$TC action add action bpf bytecode '4,40 0 0 12,31 0 1 2048,6 0 0 262144,6 0 0 0' index 100",
42        "expExitCode": "255",
43        "verifyCmd": "$TC action get action bpf index 100",
44        "matchPattern": "action order [0-9]*: bpf bytecode '4,40 0 0 12,31 0 1 2048,6 0 0 262144,6 0 0 0' default-action pipe.*index 100 ref",
45        "matchCount": "0",
46        "teardown": [
47            "$TC actions flush action bpf"
48        ]
49    },
50    {
51        "id": "e939",
52        "name": "Add eBPF action with valid object-file",
53        "category": [
54            "actions",
55            "bpf"
56        ],
57        "plugins": {
58                "requires": "buildebpfPlugin"
59        },
60        "setup": [
61            [
62                "$TC action flush action bpf",
63                0,
64                1,
65                255
66            ]
67        ],
68        "cmdUnderTest": "$TC action add action bpf object-file $EBPFDIR/action.o section action-ok index 667",
69        "expExitCode": "0",
70        "verifyCmd": "$TC action get action bpf index 667",
71        "matchPattern": "action order [0-9]*: bpf action.o:\\[action-ok\\] id [0-9].* tag [0-9a-f]{16}( jited)? default-action pipe.*index 667 ref",
72        "matchCount": "1",
73        "teardown": [
74            "$TC action flush action bpf"
75        ]
76    },
77    {
78        "id": "282d",
79        "name": "Add eBPF action with invalid object-file",
80        "category": [
81            "actions",
82            "bpf"
83        ],
84        "plugins": {
85                "requires": "buildebpfPlugin"
86        },
87        "setup": [
88            [
89                "$TC action flush action bpf",
90                0,
91                1,
92                255
93            ]
94        ],
95        "cmdUnderTest": "$TC action add action bpf object-file $EBPFDIR/action.o section action-ko index 667",
96        "expExitCode": "255",
97        "verifyCmd": "$TC action get action bpf index 667",
98        "matchPattern": "action order [0-9]*: bpf action.o:\\[action-ko\\] id [0-9].*index 667 ref",
99        "matchCount": "0",
100        "teardown": [
101            [
102                "$TC action flush action bpf",
103                0,
104                1,
105                255
106            ]
107        ]
108    },
109    {
110        "id": "d819",
111        "name": "Replace cBPF bytecode and action control",
112        "category": [
113            "actions",
114            "bpf"
115        ],
116        "setup": [
117            [
118                "$TC actions flush action bpf",
119                0,
120                1,
121                255
122            ],
123            [
124                "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0' index 555",
125                0,
126                1,
127                255
128            ]
129        ],
130        "cmdUnderTest": "$TC action replace action bpf bytecode '4,40 0 0 12,21 0 1 2054,6 0 0 262144,6 0 0 0' drop index 555",
131        "expExitCode": "0",
132        "verifyCmd": "$TC action get action bpf index 555",
133        "matchPattern": "action order [0-9]*: bpf bytecode '4,40 0 0 12,21 0 1 2054,6 0 0 262144,6 0 0 0' default-action drop.*index 555 ref",
134        "matchCount": "1",
135        "teardown": [
136            "$TC action flush action bpf"
137        ]
138    },
139    {
140        "id": "6ae3",
141        "name": "Delete cBPF action ",
142        "category": [
143            "actions",
144            "bpf"
145        ],
146        "setup": [
147            [
148                "$TC actions flush action bpf",
149                0,
150                1,
151                255
152            ],
153            [
154                "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0' index 444",
155                0,
156                1,
157                255
158            ]
159        ],
160        "cmdUnderTest": "$TC action delete action bpf index 444",
161        "expExitCode": "0",
162        "verifyCmd": "$TC action get action bpf index 444",
163        "matchPattern": "action order [0-9]*: bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0' default-action pipe.*index 444 ref",
164        "matchCount": "0",
165        "teardown": [
166            "$TC action flush action bpf"
167        ]
168    },
169    {
170        "id": "3e0d",
171        "name": "List cBPF actions",
172        "category": [
173            "actions",
174            "bpf"
175        ],
176        "setup": [
177            [
178                "$TC action flush action bpf",
179                0,
180                1,
181                255
182            ],
183            "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0' ok index 101",
184            "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2054,6 0 0 262144,6 0 0 0' drop index 102",
185            "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 33024,6 0 0 262144,6 0 0 0' continue index 103"
186        ],
187        "cmdUnderTest": "$TC action list action bpf",
188        "expExitCode": "0",
189        "verifyCmd": "$TC action list action bpf",
190        "matchPattern": "action order [0-9]*: bpf bytecode",
191        "matchCount": "3",
192        "teardown": [
193            "$TC actions flush action bpf"
194        ]
195    },
196    {
197        "id": "55ce",
198        "name": "Flush BPF actions",
199        "category": [
200            "actions",
201            "bpf"
202        ],
203        "setup": [
204            [
205                "$TC actions flush action bpf",
206                0,
207                1,
208                255
209            ],
210            "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0' ok index 101",
211            "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2054,6 0 0 262144,6 0 0 0' drop index 102",
212            "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 33024,6 0 0 262144,6 0 0 0' continue index 103"
213        ],
214        "cmdUnderTest": "$TC action flush action bpf",
215        "expExitCode": "0",
216        "verifyCmd": "$TC action list action bpf",
217        "matchPattern": "action order [0-9]*: bpf bytecode",
218        "matchCount": "0",
219        "teardown": [
220            "$TC actions flush action bpf"
221        ]
222    },
223    {
224        "id": "ccc3",
225        "name": "Add cBPF action with duplicate index",
226        "category": [
227            "actions",
228            "bpf"
229        ],
230        "setup": [
231            [
232                "$TC actions flush action bpf",
233                0,
234                1,
235                255
236            ],
237            "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0' index 4294967295"
238        ],
239        "cmdUnderTest": "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2054,6 0 0 262144,6 0 0 0' index 4294967295",
240        "expExitCode": "255",
241        "verifyCmd": "$TC action get action bpf index 4294967295",
242        "matchPattern": "action order [0-9]*: bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0' default-action pipe.*index 4294967295",
243        "matchCount": "1",
244        "teardown": [
245            "$TC action flush action bpf"
246        ]
247    },
248    {
249        "id": "89c7",
250        "name": "Add cBPF action with invalid index",
251        "category": [
252            "actions",
253            "bpf"
254        ],
255        "setup": [
256            [
257                "$TC actions flush action bpf",
258                0,
259                1,
260                255
261            ]
262        ],
263        "cmdUnderTest": "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2054,6 0 0 262144,6 0 0 0' index 4294967296 cookie 123456",
264        "expExitCode": "255",
265        "verifyCmd": "$TC action ls action bpf",
266        "matchPattern": "action order [0-9]*: bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0' default-action pipe.*cookie 123456",
267        "matchCount": "0",
268        "teardown": [
269            "$TC action flush action bpf"
270        ]
271    },
272    {
273        "id": "7ab9",
274        "name": "Add cBPF action with cookie",
275        "category": [
276            "actions",
277            "bpf"
278        ],
279        "setup": [
280            [
281                "$TC actions flush action bpf",
282                0,
283                1,
284                255
285            ]
286        ],
287        "cmdUnderTest": "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2054,6 0 0 262144,6 0 0 0' cookie d0d0d0d0d0d0d0d0",
288        "expExitCode": "0",
289        "verifyCmd": "$TC action list action bpf",
290        "matchPattern": "action order [0-9]*: bpf.*cookie d0d0d0d0d0d0d0",
291        "matchCount": "1",
292        "teardown": [
293            "$TC action flush action bpf"
294        ]
295    },
296    {
297        "id": "b8a1",
298        "name": "Replace bpf action with invalid goto_chain control",
299        "category": [
300            "actions",
301            "bpf"
302        ],
303        "setup": [
304            [
305                "$TC actions flush action bpf",
306                0,
307                1,
308                255
309            ],
310            "$TC action add action bpf bytecode '1,6 0 0 4294967295' pass index 90"
311        ],
312        "cmdUnderTest": "$TC action replace action bpf bytecode '1,6 0 0 4294967295' goto chain 42 index 90 cookie c1a0c1a0",
313        "expExitCode": "255",
314        "verifyCmd": "$TC action list action bpf",
315        "matchPattern": "action order [0-9]*: bpf.* default-action pass.*index 90",
316        "matchCount": "1",
317        "teardown": [
318            "$TC action flush action bpf"
319        ]
320    }
321]
322