1[
2    {
3        "id": "696a",
4        "name": "Add simple ct action",
5        "category": [
6            "actions",
7            "ct"
8        ],
9        "setup": [
10            [
11                "$TC actions flush action ct",
12                0,
13                1,
14                255
15            ]
16        ],
17        "cmdUnderTest": "$TC actions add action ct index 42",
18        "expExitCode": "0",
19        "verifyCmd": "$TC actions list action ct",
20        "matchPattern": "action order [0-9]*: ct zone 0 pipe.*index 42 ref",
21        "matchCount": "1",
22        "teardown": [
23            "$TC actions flush action ct"
24        ]
25    },
26    {
27        "id": "e38c",
28        "name": "Add simple ct action with cookie",
29        "category": [
30            "actions",
31            "ct"
32        ],
33        "setup": [
34            [
35                "$TC actions flush action ct",
36                0,
37                1,
38                255
39            ]
40        ],
41        "cmdUnderTest": "$TC actions add action ct index 42 cookie deadbeef",
42        "expExitCode": "0",
43        "verifyCmd": "$TC actions list action ct",
44        "matchPattern": "action order [0-9]*: ct zone 0 pipe.*index 42 ref.*cookie deadbeef",
45        "matchCount": "1",
46        "teardown": [
47            "$TC actions flush action ct"
48        ]
49    },
50    {
51        "id": "9f20",
52        "name": "Add ct clear action",
53        "category": [
54            "actions",
55            "ct"
56        ],
57        "setup": [
58            [
59                "$TC actions flush action ct",
60                0,
61                1,
62                255
63            ]
64        ],
65        "cmdUnderTest": "$TC actions add action ct clear index 42",
66        "expExitCode": "0",
67        "verifyCmd": "$TC actions list action ct",
68        "matchPattern": "action order [0-9]*: ct clear pipe.*index 42 ref",
69        "matchCount": "1",
70        "teardown": [
71            "$TC actions flush action ct"
72        ]
73    },
74    {
75        "id": "0bc1",
76        "name": "Add ct clear action with cookie of max length",
77        "category": [
78            "actions",
79            "ct"
80        ],
81        "setup": [
82            [
83                "$TC actions flush action ct",
84                0,
85                1,
86                255
87            ]
88        ],
89        "cmdUnderTest": "$TC actions add action ct clear index 42 cookie aa11bb22cc33dd44ee55ff66aa11b1b2",
90        "expExitCode": "0",
91        "verifyCmd": "$TC actions list action ct",
92        "matchPattern": "action order [0-9]*: ct clear pipe.*index 42 ref.*cookie aa11bb22cc33dd44ee55ff66aa11b1b2",
93        "matchCount": "1",
94        "teardown": [
95            "$TC actions flush action ct"
96        ]
97    },
98    {
99        "id": "5bea",
100        "name": "Try ct with zone",
101        "category": [
102            "actions",
103            "ct"
104        ],
105        "setup": [
106            [
107                "$TC actions flush action ct",
108                0,
109                1,
110                255
111            ]
112        ],
113        "cmdUnderTest": "$TC actions add action ct zone 404 index 42",
114        "expExitCode": "0",
115        "verifyCmd": "$TC actions list action ct",
116        "matchPattern": "action order [0-9]*: ct zone 404 pipe.*index 42 ref",
117        "matchCount": "1",
118        "teardown": [
119            "$TC actions flush action ct"
120        ]
121    },
122    {
123        "id": "d5d6",
124        "name": "Try ct with zone, commit",
125        "category": [
126            "actions",
127            "ct"
128        ],
129        "setup": [
130            [
131                "$TC actions flush action ct",
132                0,
133                1,
134                255
135            ]
136        ],
137        "cmdUnderTest": "$TC actions add action ct zone 404 commit index 42",
138        "expExitCode": "0",
139        "verifyCmd": "$TC actions list action ct",
140        "matchPattern": "action order [0-9]*: ct commit zone 404 pipe.*index 42 ref",
141        "matchCount": "1",
142        "teardown": [
143            "$TC actions flush action ct"
144        ]
145    },
146    {
147        "id": "029f",
148        "name": "Try ct with zone, commit, mark",
149        "category": [
150            "actions",
151            "ct"
152        ],
153        "setup": [
154            [
155                "$TC actions flush action ct",
156                0,
157                1,
158                255
159            ]
160        ],
161        "cmdUnderTest": "$TC actions add action ct zone 404 commit mark 0x42 index 42",
162        "expExitCode": "0",
163        "verifyCmd": "$TC actions list action ct",
164        "matchPattern": "action order [0-9]*: ct commit mark 66 zone 404 pipe.*index 42 ref",
165        "matchCount": "1",
166        "teardown": [
167            "$TC actions flush action ct"
168        ]
169    },
170    {
171        "id": "a58d",
172        "name": "Try ct with zone, commit, mark, nat",
173        "category": [
174            "actions",
175            "ct"
176        ],
177        "setup": [
178            [
179                "$TC actions flush action ct",
180                0,
181                1,
182                255
183            ]
184        ],
185        "cmdUnderTest": "$TC actions add action ct zone 404 commit mark 0x42 nat src addr 5.5.5.7 index 42",
186        "expExitCode": "0",
187        "verifyCmd": "$TC actions list action ct",
188        "matchPattern": "action order [0-9]*: ct commit mark 66 zone 404 nat src addr 5.5.5.7 pipe.*index 42 ref",
189        "matchCount": "1",
190        "teardown": [
191            "$TC actions flush action ct"
192        ]
193    },
194    {
195        "id": "901b",
196        "name": "Try ct with full nat ipv4 range syntax",
197        "category": [
198            "actions",
199            "ct"
200        ],
201        "setup": [
202            [
203                "$TC actions flush action ct",
204                0,
205                1,
206                255
207            ]
208        ],
209        "cmdUnderTest": "$TC actions add action ct commit nat src addr 5.5.5.7-5.5.6.0 port 1000-2000 index 44",
210        "expExitCode": "0",
211        "verifyCmd": "$TC actions list action ct",
212        "matchPattern": "action order [0-9]*: ct commit zone 0 nat src addr 5.5.5.7-5.5.6.0 port 1000-2000 pipe.*index 44 ref",
213        "matchCount": "1",
214        "teardown": [
215            "$TC actions flush action ct"
216        ]
217    },
218    {
219        "id": "072b",
220        "name": "Try ct with full nat ipv6 syntax",
221        "category": [
222            "actions",
223            "ct"
224        ],
225        "setup": [
226            [
227                "$TC actions flush action ct",
228                0,
229                1,
230                255
231            ]
232        ],
233        "cmdUnderTest": "$TC actions add action ct commit nat src addr 2001::1 port 1000-2000 index 44",
234        "expExitCode": "0",
235        "verifyCmd": "$TC actions list action ct",
236        "matchPattern": "action order [0-9]*: ct commit zone 0 nat src addr 2001::1 port 1000-2000 pipe.*index 44 ref",
237        "matchCount": "1",
238        "teardown": [
239            "$TC actions flush action ct"
240        ]
241    },
242    {
243        "id": "3420",
244        "name": "Try ct with full nat ipv6 range syntax",
245        "category": [
246            "actions",
247            "ct"
248        ],
249        "setup": [
250            [
251                "$TC actions flush action ct",
252                0,
253                1,
254                255
255            ]
256        ],
257        "cmdUnderTest": "$TC actions add action ct commit nat src addr 2001::1-2001::10 port 1000-2000 index 44",
258        "expExitCode": "0",
259        "verifyCmd": "$TC actions list action ct",
260        "matchPattern": "action order [0-9]*: ct commit zone 0 nat src addr 2001::1-2001::10 port 1000-2000 pipe.*index 44 ref",
261        "matchCount": "1",
262        "teardown": [
263            "$TC actions flush action ct"
264        ]
265    },
266    {
267        "id": "4470",
268        "name": "Try ct with full nat ipv6 range syntax + force",
269        "category": [
270            "actions",
271            "ct"
272        ],
273        "setup": [
274            [
275                "$TC actions flush action ct",
276                0,
277                1,
278                255
279            ]
280        ],
281        "cmdUnderTest": "$TC actions add action ct commit force nat src addr 2001::1-2001::10 port 1000-2000 index 44",
282        "expExitCode": "0",
283        "verifyCmd": "$TC actions list action ct",
284        "matchPattern": "action order [0-9]*: ct commit force zone 0 nat src addr 2001::1-2001::10 port 1000-2000 pipe.*index 44 ref",
285        "matchCount": "1",
286        "teardown": [
287            "$TC actions flush action ct"
288        ]
289    },
290    {
291        "id": "5d88",
292        "name": "Try ct with label",
293        "category": [
294            "actions",
295            "ct"
296        ],
297        "setup": [
298            [
299                "$TC actions flush action ct",
300                0,
301                1,
302                255
303            ]
304        ],
305        "cmdUnderTest": "$TC actions add action ct label 123123 index 44",
306        "expExitCode": "0",
307        "verifyCmd": "$TC actions list action ct",
308        "matchPattern": "action order [0-9]*: ct zone 0 label 12312300000000000000000000000000 pipe.*index 44 ref",
309        "matchCount": "1",
310        "teardown": [
311            "$TC actions flush action ct"
312        ]
313    },
314    {
315        "id": "04d4",
316        "name": "Try ct with label with mask",
317        "category": [
318            "actions",
319            "ct"
320        ],
321        "setup": [
322            [
323                "$TC actions flush action ct",
324                0,
325                1,
326                255
327            ]
328        ],
329        "cmdUnderTest": "$TC actions add action ct label 12312300000000000000000000000001/ffffffff000000000000000000000001 index 44",
330        "expExitCode": "0",
331        "verifyCmd": "$TC actions list action ct",
332        "matchPattern": "action order [0-9]*: ct zone 0 label 12312300000000000000000000000001/ffffffff000000000000000000000001 pipe.*index 44 ref",
333        "matchCount": "1",
334        "teardown": [
335            "$TC actions flush action ct"
336        ]
337    },
338    {
339        "id": "9751",
340        "name": "Try ct with mark + mask",
341        "category": [
342            "actions",
343            "ct"
344        ],
345        "setup": [
346            [
347                "$TC actions flush action ct",
348                0,
349                1,
350                255
351            ]
352        ],
353        "cmdUnderTest": "$TC actions add action ct mark 0x42/0xf0 index 42",
354        "expExitCode": "0",
355        "verifyCmd": "$TC actions list action ct",
356        "matchPattern": "action order [0-9]*: ct mark 66/0xf0 zone 0 pipe.*index 42 ref",
357        "matchCount": "1",
358        "teardown": [
359            "$TC actions flush action ct"
360        ]
361    },
362    {
363        "id": "2faa",
364        "name": "Try ct with mark + mask and cookie",
365        "category": [
366            "actions",
367            "ct"
368        ],
369        "setup": [
370            [
371                "$TC actions flush action ct",
372                0,
373                1,
374                255
375            ]
376        ],
377        "cmdUnderTest": "$TC actions add action ct mark 0x42/0xf0 index 42 cookie aa11bb22cc33dd44ee55ff66aa11b1b2",
378        "expExitCode": "0",
379        "verifyCmd": "$TC actions list action ct",
380        "matchPattern": "action order [0-9]*: ct mark 66/0xf0 zone 0 pipe.*index 42 ref.*cookie aa11bb22cc33dd44ee55ff66aa11b1b2",
381        "matchCount": "1",
382        "teardown": [
383            "$TC actions flush action ct"
384        ]
385    },
386    {
387        "id": "3991",
388        "name": "Add simple ct action with no_percpu flag",
389        "category": [
390            "actions",
391            "ct"
392        ],
393        "setup": [
394            [
395                "$TC actions flush action ct",
396                0,
397                1,
398                255
399            ]
400        ],
401        "cmdUnderTest": "$TC actions add action ct no_percpu",
402        "expExitCode": "0",
403        "verifyCmd": "$TC actions list action ct",
404        "matchPattern": "action order [0-9]*: ct zone 0 pipe.*no_percpu",
405        "matchCount": "1",
406        "teardown": [
407            "$TC actions flush action ct"
408        ]
409    },
410    {
411        "id": "3992",
412        "name": "Add ct action triggering DNAT tuple conflict",
413        "category": [
414            "actions",
415            "ct",
416	    "scapy"
417        ],
418	"plugins": {
419		"requires": [
420			"nsPlugin",
421			"scapyPlugin"
422		]
423	},
424        "setup": [
425            [
426                "$TC qdisc del dev $DEV1 ingress",
427                0,
428                1,
429		2,
430                255
431            ],
432	    "$TC qdisc add dev $DEV1 ingress"
433        ],
434        "cmdUnderTest": "$TC filter add dev $DEV1 ingress protocol ip prio 1 flower ct_state -trk action ct commit nat dst addr 20.0.0.1 port 10 pipe action drop",
435	"scapy": [
436	    {
437		"iface": "$DEV0",
438		"count": 1,
439		"packet": "Ether(type=0x800)/IP(src='10.0.0.10',dst='10.0.0.10')/TCP(sport=5000,dport=10)"
440	    },
441	    {
442		"iface": "$DEV0",
443		"count": 1,
444		"packet": "Ether(type=0x800)/IP(src='10.0.0.10',dst='10.0.0.20')/TCP(sport=5000,dport=10)"
445	    }
446	],
447        "expExitCode": "0",
448        "verifyCmd": "cat /proc/net/nf_conntrack",
449        "matchPattern": "dst=10.0.0.20",
450        "matchCount": "1",
451        "teardown": [
452            "$TC qdisc del dev $DEV1 ingress"
453        ]
454    }
455]
456