[
    {
        "id": "e122",
        "name": "Add route filter with from and to tag",
        "category": [
            "filter",
            "route"
        ],
        "plugins": {
            "requires": "nsPlugin"
        },
        "setup": [
            "$TC qdisc add dev $DEV1 ingress"
        ],
        "cmdUnderTest": "$TC filter add dev $DEV1 parent ffff: protocol ip prio 100 route from 1 to 10 classid 1:10",
        "expExitCode": "0",
        "verifyCmd": "$TC filter ls dev $DEV1 parent ffff:",
        "matchPattern": "flowid 1:10 to 10 from 1",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DEV1 ingress"
        ]
    },
    {
        "id": "6573",
        "name": "Add route filter with fromif and to tag",
        "category": [
            "filter",
            "route"
        ],
        "plugins": {
            "requires": "nsPlugin"
        },
        "setup": [
            "$TC qdisc add dev $DEV1 ingress"
        ],
        "cmdUnderTest": "$TC filter add dev $DEV1 parent ffff: protocol ip prio 100 route fromif $DEV1 to 10 classid 1:10",
        "expExitCode": "0",
        "verifyCmd": "$TC filter ls dev $DEV1 parent ffff:",
        "matchPattern": "flowid 1:10 to 10 fromif",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DEV1 ingress"
        ]
    },
    {
        "id": "1362",
        "name": "Add route filter with to flag and reclassify action",
        "category": [
            "filter",
            "route"
        ],
        "plugins": {
            "requires": "nsPlugin"
        },
        "setup": [
            "$TC qdisc add dev $DEV1 ingress"
        ],
        "cmdUnderTest": "$TC filter add dev $DEV1 parent ffff: protocol ip prio 2 route to 10 classid 1:20 action reclassify",
        "expExitCode": "0",
        "verifyCmd": "$TC filter ls dev $DEV1 parent ffff:",
        "matchPattern": "filter protocol ip pref.*route chain [0-9]+.*flowid 1:20 to 10.*action order [0-9]+: gact action reclassify",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DEV1 ingress"
        ]
    },
    {
        "id": "4720",
        "name": "Add route filter with from flag and continue actions",
        "category": [
            "filter",
            "route"
        ],
        "plugins": {
            "requires": "nsPlugin"
        },
        "setup": [
            "$TC qdisc add dev $DEV1 ingress"
        ],
        "cmdUnderTest": "$TC filter add dev $DEV1 parent ffff: protocol ip prio 2 route from 10 classid 1:100 action continue",
        "expExitCode": "0",
        "verifyCmd": "$TC filter ls dev $DEV1 parent ffff:",
        "matchPattern": "filter protocol ip pref.*route chain [0-9]+.*flowid 1:100 from 10.*action continue",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DEV1 ingress"
        ]
    },
    {
        "id": "2812",
        "name": "Add route filter with form tag and pipe action",
        "category": [
            "filter",
            "route"
        ],
        "plugins": {
            "requires": "nsPlugin"
        },
        "setup": [
            "$TC qdisc add dev $DEV1 ingress"
        ],
        "cmdUnderTest": "$TC filter add dev $DEV1 parent ffff: protocol ip prio 2 route from 10 to 2 classid 1:1 action pipe",
        "expExitCode": "0",
        "verifyCmd": "$TC filter ls dev $DEV1 parent ffff:",
        "matchPattern": "filter protocol ip pref.*route chain [0-9]+.*flowid 1:1 to 2 from 10.*action pipe",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DEV1 ingress"
        ]
    },
    {
        "id": "7994",
        "name": "Add route filter with multiple actions",
        "category": [
            "filter",
            "route"
        ],
        "plugins": {
            "requires": "nsPlugin"
        },
        "setup": [
            "$TC qdisc add dev $DEV1 ingress"
        ],
        "cmdUnderTest": "$TC filter add dev $DEV1 parent ffff: protocol ip prio 2 route from 10 to 2 classid 1:1 action skbedit mark 7 pipe action gact drop",
        "expExitCode": "0",
        "verifyCmd": "$TC filter ls dev $DEV1 parent ffff:",
        "matchPattern": "filter protocol ip pref.*route chain [0-9]+.*flowid 1:1 to 2 from 10.*action order [0-9]+: skbedit  mark 7 pipe.*action order [0-9]+: gact action drop",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DEV1 ingress"
        ]
    },
    {
        "id": "4312",
        "name": "List route filters",
        "category": [
            "filter",
            "route"
        ],
        "plugins": {
            "requires": "nsPlugin"
        },
        "setup": [
            "$TC qdisc add dev $DEV1 ingress",
            "$TC filter add dev $DEV1 parent ffff: protocol ip prio 2 route from 10 to 2 classid 1:1 action pipe",
            "$TC filter add dev $DEV1 parent ffff: protocol ip prio 2 route from 20 to 1 classid 1:20 action pipe"
        ],
        "cmdUnderTest": "$TC filter show dev $DEV1 parent ffff:",
        "expExitCode": "0",
        "verifyCmd": "$TC filter show dev $DEV1 parent ffff:",
        "matchPattern": "action order [0-9]+: gact action pipe",
        "matchCount": "2",
        "teardown": [
            "$TC qdisc del dev $DEV1 ingress"
        ]
    },
    {
        "id": "2634",
        "name": "Delete route filter with pipe action",
        "category": [
            "filter",
            "route"
        ],
        "plugins": {
            "requires": "nsPlugin"
        },
        "setup": [
            "$TC qdisc add dev $DEV1 ingress",
            "$TC filter add dev $DEV1 parent ffff: protocol ip prio 2 route from 10 to 2 classid 1:1 action pipe"
        ],
        "cmdUnderTest": "$TC filter del dev $DEV1 parent ffff: protocol ip prio 2 route from 10 to 2 classid 1:1 action pipe",
        "expExitCode": "0",
        "verifyCmd": "$TC filter show dev $DEV1 parent ffff:",
        "matchPattern": "filter protocol ip pref.*route chain [0-9]+.*flowid 1:1 to 2 from 10.*action pipe",
        "matchCount": "0",
        "teardown": [
            "$TC qdisc del dev $DEV1 ingress"
        ]
    },
    {
        "id": "b042",
        "name": "Try to delete class referenced by route after a replace",
        "category": [
            "filter",
            "route"
        ],
        "plugins": {
            "requires": "nsPlugin"
        },
        "setup": [
            "$TC qdisc add dev $DEV1 parent root handle 10: drr",
            "$TC class add dev $DEV1 parent root classid 1 drr",
            "$TC filter add dev $DEV1 parent 10: prio 1 route from 10 classid 10:1 action ok",
            "$TC filter replace dev $DEV1 parent 10: prio 1 route from 5 classid 10:1 action drop"
        ],
        "cmdUnderTest": "$TC class delete dev $DEV1 parent 10: classid 10:1",
        "expExitCode": "2",
        "verifyCmd": "$TC class show dev $DEV1",
        "matchPattern": "class drr 10:1",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DEV1 parent root drr"
        ]
    },
    {
        "id": "a7d2",
        "name": "Delete a route filter that was moved to another bucket",
        "category": [
            "filter",
            "route"
        ],
        "plugins": {
            "requires": "nsPlugin"
        },
        "setup": [
            "$TC qdisc add dev $DEV1 ingress",
            "$TC filter add dev $DEV1 parent ffff: protocol ip prio 100 route from 1 to 1 classid 1:1",
            "$TC filter change dev $DEV1 parent ffff: protocol ip prio 100 handle 0x10001 route from 1 to 2 classid 1:1",
            "$TC filter add dev $DEV1 parent ffff: protocol ip prio 200 route from 5 to 5 classid 1:5"
        ],
        "cmdUnderTest": "$TC filter del dev $DEV1 parent ffff: protocol ip prio 100 handle 0x10002 route from 1 to 2",
        "expExitCode": "0",
        "verifyCmd": "$TC -j filter show dev $DEV1 parent ffff:",
        "matchJSON": [
            {
                "protocol": "ip",
                "pref": 200,
                "kind": "route",
                "chain": 0
            },
            {
                "protocol": "ip",
                "pref": 200,
                "kind": "route",
                "chain": 0,
                "options": {
                    "fh": "0x50005",
                    "flowid": "1:5"
                }
            }
        ],
        "teardown": [
            "$TC qdisc del dev $DEV1 ingress"
        ]
    },
    {
        "id": "c05a",
        "name": "Try to change a route filter onto an already used handle",
        "category": [
            "filter",
            "route"
        ],
        "plugins": {
            "requires": "nsPlugin"
        },
        "setup": [
            "$TC qdisc add dev $DEV1 ingress",
            "$TC filter add dev $DEV1 parent ffff: protocol ip prio 100 route from 1 to 1 classid 1:1 action ok",
            "$TC filter add dev $DEV1 parent ffff: protocol ip prio 100 route from 2 to 2 classid 1:2 action drop"
        ],
        "cmdUnderTest": "$TC filter change dev $DEV1 parent ffff: protocol ip prio 100 handle 0x10001 route from 2 to 2 classid 1:1 action ok",
        "expExitCode": "2",
        "verifyCmd": "$TC -j filter show dev $DEV1 parent ffff:",
        "matchJSON": [
            {
                "protocol": "ip",
                "pref": 100,
                "kind": "route",
                "chain": 0
            },
            {
                "protocol": "ip",
                "pref": 100,
                "kind": "route",
                "chain": 0,
                "options": {
                    "fh": "0x10001",
                    "flowid": "1:1",
                    "actions": [
                        {
                            "order": 1,
                            "kind": "gact",
                            "control_action": {
                                "type": "pass"
                            }
                        }
                    ]
                }
            },
            {
                "protocol": "ip",
                "pref": 100,
                "kind": "route",
                "chain": 0,
                "options": {
                    "fh": "0x20002",
                    "flowid": "1:2",
                    "actions": [
                        {
                            "order": 1,
                            "kind": "gact",
                            "control_action": {
                                "type": "drop"
                            }
                        }
                    ]
                }
            }
        ],
        "teardown": [
            "$TC qdisc del dev $DEV1 ingress"
        ]
    },
    {
        "id": "3f21",
        "name": "Replace a route filter that shares its key with another filter",
        "category": [
            "filter",
            "route"
        ],
        "plugins": {
            "requires": "nsPlugin"
        },
        "setup": [
            "$TC qdisc add dev $DEV1 ingress",
            "$TC filter add dev $DEV1 parent ffff: protocol ip prio 100 handle 0x10101 route from 1 to 1 classid 1:1",
            "$TC filter add dev $DEV1 parent ffff: protocol ip prio 100 handle 0x10201 route from 1 to 1 classid 1:2"
        ],
        "cmdUnderTest": "$TC filter replace dev $DEV1 parent ffff: protocol ip prio 100 handle 0x10101 route from 1 to 1 classid 1:9",
        "expExitCode": "0",
        "verifyCmd": "$TC -j filter show dev $DEV1 parent ffff:",
        "matchJSON": [
            {
                "protocol": "ip",
                "pref": 100,
                "kind": "route",
                "chain": 0
            },
            {
                "protocol": "ip",
                "pref": 100,
                "kind": "route",
                "chain": 0,
                "options": {
                    "fh": "0x10101",
                    "flowid": "1:9"
                }
            },
            {
                "protocol": "ip",
                "pref": 100,
                "kind": "route",
                "chain": 0,
                "options": {
                    "fh": "0x10201",
                    "flowid": "1:2"
                }
            }
        ],
        "teardown": [
            "$TC qdisc del dev $DEV1 ingress"
        ]
    },
    {
        "id": "9d0e",
        "name": "Replace both route filters sharing a key",
        "category": [
            "filter",
            "route"
        ],
        "plugins": {
            "requires": "nsPlugin"
        },
        "setup": [
            "$TC qdisc add dev $DEV1 ingress",
            "$TC filter add dev $DEV1 parent ffff: protocol ip prio 100 handle 0x10101 route from 1 to 1 classid 1:1",
            "$TC filter add dev $DEV1 parent ffff: protocol ip prio 100 handle 0x10201 route from 1 to 1 classid 1:2",
            "$TC filter replace dev $DEV1 parent ffff: protocol ip prio 100 handle 0x10101 route from 1 to 1 classid 1:9"
        ],
        "cmdUnderTest": "$TC filter replace dev $DEV1 parent ffff: protocol ip prio 100 handle 0x10201 route from 1 to 1 classid 1:8",
        "expExitCode": "0",
        "verifyCmd": "$TC -j filter show dev $DEV1 parent ffff:",
        "matchJSON": [
            {
                "protocol": "ip",
                "pref": 100,
                "kind": "route",
                "chain": 0
            },
            {
                "protocol": "ip",
                "pref": 100,
                "kind": "route",
                "chain": 0,
                "options": {
                    "fh": "0x10101",
                    "flowid": "1:9"
                }
            },
            {
                "protocol": "ip",
                "pref": 100,
                "kind": "route",
                "chain": 0,
                "options": {
                    "fh": "0x10201",
                    "flowid": "1:8"
                }
            }
        ],
        "teardown": [
            "$TC qdisc del dev $DEV1 ingress"
        ]
    },
    {
        "id": "4000",
        "name": "Change a wildcard route filter classid only (no routing attribute)",
        "category": [
            "filter",
            "route"
        ],
        "plugins": {
            "requires": "nsPlugin"
        },
        "setup": [
            "$TC qdisc add dev $DEV1 ingress",
            "$TC filter add dev $DEV1 parent ffff: protocol ip prio 100 route classid 1:1"
        ],
        "cmdUnderTest": "$TC filter change dev $DEV1 parent ffff: protocol ip prio 100 route classid 1:9",
        "expExitCode": "0",
        "verifyCmd": "$TC filter ls dev $DEV1 parent ffff:",
        "matchPattern": "fh 0xffff8000 flowid 1:9",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DEV1 ingress"
        ]
    },
    {
        "id": "907a",
        "name": "Try to change a route filter with no routing attribute and a non-wildcard handle",
        "category": [
            "filter",
            "route"
        ],
        "plugins": {
            "requires": "nsPlugin"
        },
        "setup": [
            "$TC qdisc add dev $DEV1 ingress",
            "$TC filter add dev $DEV1 parent ffff: protocol ip prio 100 route from 1 to 1 classid 1:1"
        ],
        "cmdUnderTest": "$TC filter change dev $DEV1 parent ffff: protocol ip prio 100 handle 0x10001 route classid 1:2",
        "expExitCode": "2",
        "verifyCmd": "$TC filter ls dev $DEV1 parent ffff:",
        "matchPattern": "fh 0x00010001 flowid 1:1 to 1 from 1",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DEV1 ingress"
        ]
    }
]