xref: /linux/tools/testing/selftests/tc-testing/tc-tests/actions/nat.json (revision 55223394d56bab42ebac71ba52e0fd8bfdc6fc07)
1[
2    {
3        "id": "7565",
4        "name": "Add nat action on ingress with default control action",
5        "category": [
6            "actions",
7            "nat"
8        ],
9        "setup": [
10            [
11                "$TC actions flush action nat",
12                0,
13                1,
14                255
15            ]
16        ],
17        "cmdUnderTest": "$TC actions add action nat ingress 192.168.1.1 200.200.200.1",
18        "expExitCode": "0",
19        "verifyCmd": "$TC actions ls action nat",
20        "matchPattern": "action order [0-9]+:  nat ingress 192.168.1.1/32 200.200.200.1 pass",
21        "matchCount": "1",
22        "teardown": [
23            "$TC actions flush action nat"
24        ]
25    },
26    {
27        "id": "fd79",
28        "name": "Add nat action on ingress with pipe control action",
29        "category": [
30            "actions",
31            "nat"
32        ],
33        "setup": [
34            [
35                "$TC actions flush action nat",
36                0,
37                1,
38                255
39            ]
40        ],
41        "cmdUnderTest": "$TC actions add action nat ingress 1.1.1.1 2.2.2.1 pipe index 77",
42        "expExitCode": "0",
43        "verifyCmd": "$TC actions get action nat index 77",
44        "matchPattern": "action order [0-9]+:  nat ingress 1.1.1.1/32 2.2.2.1 pipe.*index 77 ref",
45        "matchCount": "1",
46        "teardown": [
47            "$TC actions flush action nat"
48        ]
49    },
50    {
51        "id": "eab9",
52        "name": "Add nat action on ingress with continue control action",
53        "category": [
54            "actions",
55            "nat"
56        ],
57        "setup": [
58            [
59                "$TC actions flush action nat",
60                0,
61                1,
62                255
63            ]
64        ],
65        "cmdUnderTest": "$TC actions add action nat ingress 192.168.10.10 192.168.20.20 continue index 1000",
66        "expExitCode": "0",
67        "verifyCmd": "$TC actions get action nat index 1000",
68        "matchPattern": "action order [0-9]+:  nat ingress 192.168.10.10/32 192.168.20.20 continue.*index 1000 ref",
69        "matchCount": "1",
70        "teardown": [
71            "$TC actions flush action nat"
72        ]
73    },
74    {
75        "id": "c53a",
76        "name": "Add nat action on ingress with reclassify control action",
77        "category": [
78            "actions",
79            "nat"
80        ],
81        "setup": [
82            [
83                "$TC actions flush action nat",
84                0,
85                1,
86                255
87            ]
88        ],
89        "cmdUnderTest": "$TC actions add action nat ingress 192.168.10.10 192.168.20.20 reclassify index 1000",
90        "expExitCode": "0",
91        "verifyCmd": "$TC actions get action nat index 1000",
92        "matchPattern": "action order [0-9]+:  nat ingress 192.168.10.10/32 192.168.20.20 reclassify.*index 1000 ref",
93        "matchCount": "1",
94        "teardown": [
95            "$TC actions flush action nat"
96        ]
97    },
98    {
99        "id": "76c9",
100        "name": "Add nat action on ingress with jump control action",
101        "category": [
102            "actions",
103            "nat"
104        ],
105        "setup": [
106            [
107                "$TC actions flush action nat",
108                0,
109                1,
110                255
111            ]
112        ],
113        "cmdUnderTest": "$TC actions add action nat ingress 12.18.10.10 12.18.20.20 jump 10 index 22",
114        "expExitCode": "0",
115        "verifyCmd": "$TC actions get action nat index 22",
116        "matchPattern": "action order [0-9]+:  nat ingress 12.18.10.10/32 12.18.20.20 jump 10.*index 22 ref",
117        "matchCount": "1",
118        "teardown": [
119            "$TC actions flush action nat"
120        ]
121    },
122    {
123        "id": "24c6",
124        "name": "Add nat action on ingress with drop control action",
125        "category": [
126            "actions",
127            "nat"
128        ],
129        "setup": [
130            [
131                "$TC actions flush action nat",
132                0,
133                1,
134                255
135            ]
136        ],
137        "cmdUnderTest": "$TC actions add action nat ingress 1.18.1.1 1.18.2.2 drop index 722",
138        "expExitCode": "0",
139        "verifyCmd": "$TC actions get action nat index 722",
140        "matchPattern": "action order [0-9]+:  nat ingress 1.18.1.1/32 1.18.2.2 drop.*index 722 ref",
141        "matchCount": "1",
142        "teardown": [
143            "$TC actions flush action nat"
144        ]
145    },
146    {
147        "id": "2120",
148        "name": "Add nat action on ingress with maximum index value",
149        "category": [
150            "actions",
151            "nat"
152        ],
153        "setup": [
154            [
155                "$TC actions flush action nat",
156                0,
157                1,
158                255
159            ]
160        ],
161        "cmdUnderTest": "$TC actions add action nat ingress 1.18.1.1 1.18.2.2 index 4294967295",
162        "expExitCode": "0",
163        "verifyCmd": "$TC actions get action nat index 4294967295",
164        "matchPattern": "action order [0-9]+:  nat ingress 1.18.1.1/32 1.18.2.2 pass.*index 4294967295 ref",
165        "matchCount": "1",
166        "teardown": [
167            "$TC actions flush action nat"
168        ]
169    },
170    {
171        "id": "3e9d",
172        "name": "Add nat action on ingress with invalid index value",
173        "category": [
174            "actions",
175            "nat"
176        ],
177        "setup": [
178            [
179                "$TC actions flush action nat",
180                0,
181                1,
182                255
183            ]
184        ],
185        "cmdUnderTest": "$TC actions add action nat ingress 1.18.1.1 1.18.2.2 index 4294967295555",
186        "expExitCode": "255",
187        "verifyCmd": "$TC actions get action nat index 4294967295555",
188        "matchPattern": "action order [0-9]+:  nat ingress 1.18.1.1/32 1.18.2.2 pass.*index 4294967295555 ref",
189        "matchCount": "0",
190        "teardown": [
191            [
192                "$TC actions flush action nat",
193                0,
194                1,
195                255
196            ]
197        ]
198    },
199    {
200        "id": "f6c9",
201        "name": "Add nat action on ingress with invalid IP address",
202        "category": [
203            "actions",
204            "nat"
205        ],
206        "setup": [
207            [
208                "$TC actions flush action nat",
209                0,
210                1,
211                255
212            ]
213        ],
214        "cmdUnderTest": "$TC actions add action nat ingress 1.1.1.1 1.1888.2.2 index 7",
215        "expExitCode": "255",
216        "verifyCmd": "$TC actions get action nat index 7",
217        "matchPattern": "action order [0-9]+:  nat ingress 1.1.1.1/32 1.1888.2.2 pass.*index 7 ref",
218        "matchCount": "0",
219        "teardown": [
220            [
221                "$TC actions flush action nat",
222                0,
223                1,
224                255
225            ]
226        ]
227    },
228    {
229        "id": "be25",
230        "name": "Add nat action on ingress with invalid argument",
231        "category": [
232            "actions",
233            "nat"
234        ],
235        "setup": [
236            [
237                "$TC actions flush action nat",
238                0,
239                1,
240                255
241            ]
242        ],
243        "cmdUnderTest": "$TC actions add action nat ingress 1.1.1.1 1.18.2.2 another_arg index 12",
244        "expExitCode": "255",
245        "verifyCmd": "$TC actions get action nat index 12",
246        "matchPattern": "action order [0-9]+:  nat ingress 1.1.1.1/32 1.18.2.2 pass.*another_arg.*index 12 ref",
247        "matchCount": "0",
248        "teardown": [
249            [
250                "$TC actions flush action nat",
251                0,
252                1,
253                255
254            ]
255        ]
256    },
257    {
258        "id": "a7bd",
259        "name": "Add nat action on ingress with DEFAULT IP address",
260        "category": [
261            "actions",
262            "nat"
263        ],
264        "setup": [
265            [
266                "$TC actions flush action nat",
267                0,
268                1,
269                255
270            ]
271        ],
272        "cmdUnderTest": "$TC actions add action nat ingress default 10.10.10.1 index 12",
273        "expExitCode": "0",
274        "verifyCmd": "$TC actions get action nat index 12",
275        "matchPattern": "action order [0-9]+:  nat ingress 0.0.0.0/32 10.10.10.1 pass.*index 12 ref",
276        "matchCount": "1",
277        "teardown": [
278            "$TC actions flush action nat"
279        ]
280    },
281    {
282        "id": "ee1e",
283        "name": "Add nat action on ingress with ANY IP address",
284        "category": [
285            "actions",
286            "nat"
287        ],
288        "setup": [
289            [
290                "$TC actions flush action nat",
291                0,
292                1,
293                255
294            ]
295        ],
296        "cmdUnderTest": "$TC actions add action nat ingress any 10.10.10.1 index 12",
297        "expExitCode": "0",
298        "verifyCmd": "$TC actions get action nat index 12",
299        "matchPattern": "action order [0-9]+:  nat ingress 0.0.0.0/32 10.10.10.1 pass.*index 12 ref",
300        "matchCount": "1",
301        "teardown": [
302            "$TC actions flush action nat"
303        ]
304    },
305    {
306        "id": "1de8",
307        "name": "Add nat action on ingress with ALL IP address",
308        "category": [
309            "actions",
310            "nat"
311        ],
312        "setup": [
313            [
314                "$TC actions flush action nat",
315                0,
316                1,
317                255
318            ]
319        ],
320        "cmdUnderTest": "$TC actions add action nat ingress all 10.10.10.1 index 12",
321        "expExitCode": "0",
322        "verifyCmd": "$TC actions get action nat index 12",
323        "matchPattern": "action order [0-9]+:  nat ingress 0.0.0.0/32 10.10.10.1 pass.*index 12 ref",
324        "matchCount": "1",
325        "teardown": [
326            "$TC actions flush action nat"
327        ]
328    },
329    {
330        "id": "8dba",
331        "name": "Add nat action on egress with default control action",
332        "category": [
333            "actions",
334            "nat"
335        ],
336        "setup": [
337            [
338                "$TC actions flush action nat",
339                0,
340                1,
341                255
342            ]
343        ],
344        "cmdUnderTest": "$TC actions add action nat egress 10.10.10.1 20.20.20.1",
345        "expExitCode": "0",
346        "verifyCmd": "$TC actions ls action nat",
347        "matchPattern": "action order [0-9]+:  nat egress 10.10.10.1/32 20.20.20.1 pass",
348        "matchCount": "1",
349        "teardown": [
350            "$TC actions flush action nat"
351        ]
352    },
353    {
354        "id": "19a7",
355        "name": "Add nat action on egress with pipe control action",
356        "category": [
357            "actions",
358            "nat"
359        ],
360        "setup": [
361            [
362                "$TC actions flush action nat",
363                0,
364                1,
365                255
366            ]
367        ],
368        "cmdUnderTest": "$TC actions add action nat egress 10.10.10.1 20.20.20.1 pipe",
369        "expExitCode": "0",
370        "verifyCmd": "$TC actions ls action nat",
371        "matchPattern": "action order [0-9]+:  nat egress 10.10.10.1/32 20.20.20.1 pipe",
372        "matchCount": "1",
373        "teardown": [
374            "$TC actions flush action nat"
375        ]
376    },
377    {
378        "id": "f1d9",
379        "name": "Add nat action on egress with continue control action",
380        "category": [
381            "actions",
382            "nat"
383        ],
384        "setup": [
385            [
386                "$TC actions flush action nat",
387                0,
388                1,
389                255
390            ]
391        ],
392        "cmdUnderTest": "$TC actions add action nat egress 10.10.10.1 20.20.20.1 continue",
393        "expExitCode": "0",
394        "verifyCmd": "$TC actions ls action nat",
395        "matchPattern": "action order [0-9]+:  nat egress 10.10.10.1/32 20.20.20.1 continue",
396        "matchCount": "1",
397        "teardown": [
398            "$TC actions flush action nat"
399        ]
400    },
401    {
402        "id": "6d4a",
403        "name": "Add nat action on egress with reclassify control action",
404        "category": [
405            "actions",
406            "nat"
407        ],
408        "setup": [
409            [
410                "$TC actions flush action nat",
411                0,
412                1,
413                255
414            ]
415        ],
416        "cmdUnderTest": "$TC actions add action nat egress 10.10.10.1 20.20.20.1 reclassify",
417        "expExitCode": "0",
418        "verifyCmd": "$TC actions ls action nat",
419        "matchPattern": "action order [0-9]+:  nat egress 10.10.10.1/32 20.20.20.1 reclassify",
420        "matchCount": "1",
421        "teardown": [
422            "$TC actions flush action nat"
423        ]
424    },
425    {
426        "id": "b313",
427        "name": "Add nat action on egress with jump control action",
428        "category": [
429            "actions",
430            "nat"
431        ],
432        "setup": [
433            [
434                "$TC actions flush action nat",
435                0,
436                1,
437                255
438            ]
439        ],
440        "cmdUnderTest": "$TC actions add action nat egress 10.10.10.1 20.20.20.1 jump 777",
441        "expExitCode": "0",
442        "verifyCmd": "$TC actions ls action nat",
443        "matchPattern": "action order [0-9]+:  nat egress 10.10.10.1/32 20.20.20.1 jump 777",
444        "matchCount": "1",
445        "teardown": [
446            "$TC actions flush action nat"
447        ]
448    },
449    {
450        "id": "d9fc",
451        "name": "Add nat action on egress with drop control action",
452        "category": [
453            "actions",
454            "nat"
455        ],
456        "setup": [
457            [
458                "$TC actions flush action nat",
459                0,
460                1,
461                255
462            ]
463        ],
464        "cmdUnderTest": "$TC actions add action nat egress 10.10.10.1 20.20.20.1 drop",
465        "expExitCode": "0",
466        "verifyCmd": "$TC actions ls action nat",
467        "matchPattern": "action order [0-9]+:  nat egress 10.10.10.1/32 20.20.20.1 drop",
468        "matchCount": "1",
469        "teardown": [
470            "$TC actions flush action nat"
471        ]
472    },
473    {
474        "id": "a895",
475        "name": "Add nat action on egress with DEFAULT IP address",
476        "category": [
477            "actions",
478            "nat"
479        ],
480        "setup": [
481            [
482                "$TC actions flush action nat",
483                0,
484                1,
485                255
486            ]
487        ],
488        "cmdUnderTest": "$TC actions add action nat egress default 20.20.20.1 pipe index 10",
489        "expExitCode": "0",
490        "verifyCmd": "$TC actions get action nat index 10",
491        "matchPattern": "action order [0-9]+:  nat egress 0.0.0.0/32 20.20.20.1 pipe.*index 10 ref",
492        "matchCount": "1",
493        "teardown": [
494            "$TC actions flush action nat"
495        ]
496    },
497    {
498        "id": "2572",
499        "name": "Add nat action on egress with ANY IP address",
500        "category": [
501            "actions",
502            "nat"
503        ],
504        "setup": [
505            [
506                "$TC actions flush action nat",
507                0,
508                1,
509                255
510            ]
511        ],
512        "cmdUnderTest": "$TC actions add action nat egress any 20.20.20.1 pipe index 10",
513        "expExitCode": "0",
514        "verifyCmd": "$TC actions get action nat index 10",
515        "matchPattern": "action order [0-9]+:  nat egress 0.0.0.0/32 20.20.20.1 pipe.*index 10 ref",
516        "matchCount": "1",
517        "teardown": [
518            "$TC actions flush action nat"
519        ]
520    },
521    {
522        "id": "37f3",
523        "name": "Add nat action on egress with ALL IP address",
524        "category": [
525            "actions",
526            "nat"
527        ],
528        "setup": [
529            [
530                "$TC actions flush action nat",
531                0,
532                1,
533                255
534            ]
535        ],
536        "cmdUnderTest": "$TC actions add action nat egress all 20.20.20.1 pipe index 10",
537        "expExitCode": "0",
538        "verifyCmd": "$TC actions get action nat index 10",
539        "matchPattern": "action order [0-9]+:  nat egress 0.0.0.0/32 20.20.20.1 pipe.*index 10 ref",
540        "matchCount": "1",
541        "teardown": [
542            "$TC actions flush action nat"
543        ]
544    },
545    {
546        "id": "6054",
547        "name": "Add nat action on egress with cookie",
548        "category": [
549            "actions",
550            "nat"
551        ],
552        "setup": [
553            [
554                "$TC actions flush action nat",
555                0,
556                1,
557                255
558            ]
559        ],
560        "cmdUnderTest": "$TC actions add action nat egress all 20.20.20.1 pipe index 10 cookie aa1bc2d3eeff112233445566778800a1",
561        "expExitCode": "0",
562        "verifyCmd": "$TC actions get action nat index 10",
563        "matchPattern": "action order [0-9]+:  nat egress 0.0.0.0/32 20.20.20.1 pipe.*index 10 ref.*cookie aa1bc2d3eeff112233445566778800a1",
564        "matchCount": "1",
565        "teardown": [
566            "$TC actions flush action nat"
567        ]
568    },
569    {
570        "id": "79d6",
571        "name": "Add nat action on ingress with cookie",
572        "category": [
573            "actions",
574            "nat"
575        ],
576        "setup": [
577            [
578                "$TC actions flush action nat",
579                0,
580                1,
581                255
582            ]
583        ],
584        "cmdUnderTest": "$TC actions add action nat ingress 192.168.1.1 10.10.10.1 reclassify index 1 cookie 112233445566778899aabbccddeeff11",
585        "expExitCode": "0",
586        "verifyCmd": "$TC actions get action nat index 1",
587        "matchPattern": "action order [0-9]+:  nat ingress 192.168.1.1/32 10.10.10.1 reclassify.*index 1 ref.*cookie 112233445566778899aabbccddeeff11",
588        "matchCount": "1",
589        "teardown": [
590            "$TC actions flush action nat"
591        ]
592    },
593    {
594        "id": "4b12",
595        "name": "Replace nat action with invalid goto chain control",
596        "category": [
597            "actions",
598            "nat"
599        ],
600        "setup": [
601            [
602                "$TC actions flush action nat",
603                0,
604                1,
605                255
606            ],
607            "$TC actions add action nat ingress 1.18.1.1 1.18.2.2 drop index 90"
608        ],
609        "cmdUnderTest": "$TC actions replace action nat ingress 1.18.1.1 1.18.2.2 goto chain 42 index 90 cookie c1a0c1a0",
610        "expExitCode": "255",
611        "verifyCmd": "$TC actions get action nat index 90",
612        "matchPattern": "action order [0-9]+:  nat ingress 1.18.1.1/32 1.18.2.2 drop.*index 90 ref",
613        "matchCount": "1",
614        "teardown": [
615            "$TC actions flush action nat"
616        ]
617    }
618]
619