summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/tc-testing/creating-testcases/scapy-example.json
blob: 5a9377b72d7f876677c3a264a5d775da1f4e304c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
[
    {
        "id": "b1e9",
        "name": "Test matching of source IP",
        "category": [
            "actions",
            "scapy"
        ],
        "plugins": {
            "requires": [
                "nsPlugin",
                "scapyPlugin"
            ]
        },
        "setup": [
            [
                "$TC qdisc del dev $DEV1 ingress",
                0,
                1,
                2,
                255
            ],
            "$TC qdisc add dev $DEV1 ingress"
        ],
        "cmdUnderTest": "$TC filter add dev $DEV1 parent ffff: prio 3 protocol ip flower src_ip 16.61.16.61 flowid 1:1 action ok",
        "scapy": {
            "iface": "$DEV0",
            "count": 1,
            "packet": "Ether(type=0x800)/IP(src='16.61.16.61')/ICMP()"
        },
        "expExitCode": "0",
        "verifyCmd": "$TC -s -j filter ls dev $DEV1 ingress prio 3",
        "matchJSON": [
            {
                "path": [
                    1,
                    "options",
                    "actions",
                    0,
                    "stats",
                    "packets"
                ],
                "value": 1
            }
        ],
        "teardown": [
            "$TC qdisc del dev $DEV1 ingress"
        ]
    },
    {
        "id": "e9c4",
        "name": "Test matching of source IP with wrong count",
        "category": [
            "actions",
            "scapy"
        ],
        "plugins": {
            "requires": [
                "nsPlugin",
                "scapyPlugin"
            ]
        },
        "setup": [
            [
                "$TC qdisc del dev $DEV1 ingress",
                0,
                1,
                2,
                255
            ],
            "$TC qdisc add dev $DEV1 ingress"
        ],
        "cmdUnderTest": "$TC filter add dev $DEV1 parent ffff: prio 3 protocol ip flower src_ip 16.61.16.61 flowid 1:1 action ok",
        "scapy": {
            "iface": "$DEV0",
            "count": 3,
            "packet": "Ether(type=0x800)/IP(src='16.61.16.61')/ICMP()"
        },
        "expExitCode": "0",
        "verifyCmd": "$TC -s -j filter ls dev $DEV1 parent ffff:",
        "matchJSON": [
            {
                "path": [
                    1,
                    "options",
                    "actions",
                    0,
                    "stats",
                    "packets"
                ],
                "value": 1
            }
        ],
        "teardown": [
            "$TC qdisc del dev $DEV1 ingress"
        ]
    }
]