linux/tools/testing/selftests/tc-testing/tc-tests/filters/flower.json

[
    {
        "id": "e41d",
        "name": "Add 1M flower filters with 10 parallel tc instances",
        "category": [
            "filter",
            "flower",
            "concurrency"
        ],
        "setup": [
            "/bin/mkdir $BATCH_DIR",
            "$TC qdisc add dev $DEV2 ingress",
            "./tdc_multibatch.py $DEV2 $BATCH_DIR 100000 10 add"
        ],
        "cmdUnderTest": "bash -c \"find $BATCH_DIR/add* -print | xargs -n 1 -P 10 $TC -b\"",
        "expExitCode": "0",
        "verifyCmd": "$TC -s filter show dev $DEV2 ingress",
        "matchPattern": "filter protocol ip pref 1 flower chain 0 handle",
        "matchCount": "1000000",
        "teardown": [
            "$TC qdisc del dev $DEV2 ingress",
            "/bin/rm -rf $BATCH_DIR"
        ]
    },
    {
        "id": "6f52",
        "name": "Delete 1M flower filters with 10 parallel tc instances",
        "category": [
            "filter",
            "flower",
            "concurrency"
        ],
        "setup": [
            "/bin/mkdir $BATCH_DIR",
            "$TC qdisc add dev $DEV2 ingress",
            "./tdc_multibatch.py $DEV2 $BATCH_DIR 1000000 1 add",
            "$TC -b $BATCH_DIR/add_0",
            "./tdc_multibatch.py $DEV2 $BATCH_DIR 100000 10 del"
        ],
        "cmdUnderTest": "bash -c \"find $BATCH_DIR/del* -print | xargs -n 1 -P 10 $TC -b\"",
        "expExitCode": "0",
        "verifyCmd": "$TC -s filter show dev $DEV2 ingress",
        "matchPattern": "filter protocol ip pref 1 flower chain 0 handle",
        "matchCount": "0",
        "teardown": [
            "$TC qdisc del dev $DEV2 ingress",
            "/bin/rm -rf $BATCH_DIR"
        ]
    },
    {
        "id": "c9da",
        "name": "Replace 1M flower filters with 10 parallel tc instances",
        "category": [
            "filter",
            "flower",
            "concurrency"
        ],
        "setup": [
            "/bin/mkdir $BATCH_DIR",
            "$TC qdisc add dev $DEV2 ingress",
            "./tdc_multibatch.py $DEV2 $BATCH_DIR 1000000 1 add",
            "$TC -b $BATCH_DIR/add_0",
            "./tdc_multibatch.py $DEV2 $BATCH_DIR 100000 10 replace"
        ],
        "cmdUnderTest": "bash -c \"find $BATCH_DIR/replace* -print | xargs -n 1 -P 10 $TC -b\"",
        "expExitCode": "0",
        "verifyCmd": "$TC -s filter show dev $DEV2 ingress",
        "matchPattern": "filter protocol ip pref 1 flower chain 0 handle",
        "matchCount": "1000000",
        "teardown": [
            "$TC qdisc del dev $DEV2 ingress",
            "/bin/rm -rf $BATCH_DIR"
        ]
    },
    {
        "id": "14be",
        "name": "Concurrently replace same range of 100k flower filters from 10 tc instances",
        "category": [
            "filter",
            "flower",
            "concurrency"
        ],
        "setup": [
            "/bin/mkdir $BATCH_DIR",
            "$TC qdisc add dev $DEV2 ingress",
            "./tdc_multibatch.py $DEV2 $BATCH_DIR 100000 1 add",
            "$TC -b $BATCH_DIR/add_0",
            "./tdc_multibatch.py -d $DEV2 $BATCH_DIR 100000 10 replace"
        ],
        "cmdUnderTest": "bash -c \"find $BATCH_DIR/replace* -print | xargs -n 1 -P 10 $TC -b\"",
        "expExitCode": "0",
        "verifyCmd": "$TC -s filter show dev $DEV2 ingress",
        "matchPattern": "filter protocol ip pref 1 flower chain 0 handle",
        "matchCount": "100000",
        "teardown": [
            "$TC qdisc del dev $DEV2 ingress",
            "/bin/rm -rf $BATCH_DIR"
        ]
    },
    {
        "id": "0c44",
        "name": "Concurrently delete same range of 100k flower filters from 10 tc instances",
        "category": [
            "filter",
            "flower",
            "concurrency"
        ],
        "setup": [
            "/bin/mkdir $BATCH_DIR",
            "$TC qdisc add dev $DEV2 ingress",
            "./tdc_multibatch.py $DEV2 $BATCH_DIR 100000 1 add",
            "$TC -b $BATCH_DIR/add_0",
            "./tdc_multibatch.py -d $DEV2 $BATCH_DIR 100000 10 del"
        ],
        "cmdUnderTest": "bash -c \"find $BATCH_DIR/del* -print | xargs -n 1 -P 10 $TC -f -b\"",
        "expExitCode": "123",
        "verifyCmd": "$TC -s filter show dev $DEV2 ingress",
        "matchPattern": "filter protocol ip pref 1 flower chain 0 handle",
        "matchCount": "0",
        "teardown": [
            "$TC qdisc del dev $DEV2 ingress",
	    "/bin/rm -rf $BATCH_DIR"
        ]
    },
    {
        "id": "ab62",
        "name": "Add and delete from same tp with 10 tc instances",
        "category": [
            "filter",
            "flower",
            "concurrency"
        ],
        "setup": [
            "/bin/mkdir $BATCH_DIR",
            "$TC qdisc add dev $DEV2 ingress",
            "./tdc_multibatch.py -x init_ $DEV2 $BATCH_DIR 100000 5 add",
            "bash -c \"find $BATCH_DIR/init_* -print | xargs -n 1 -P 5 $TC -b\"",
            "./tdc_multibatch.py -x par_ -a 500001 -m 5 $DEV2 $BATCH_DIR 100000 5 add",
            "./tdc_multibatch.py -x par_ $DEV2 $BATCH_DIR 100000 5 del"
        ],
        "cmdUnderTest": "bash -c \"find $BATCH_DIR/par_* -print | xargs -n 1 -P 10 $TC -b\"",
        "expExitCode": "0",
        "verifyCmd": "$TC -s filter show dev $DEV2 ingress",
        "matchPattern": "filter protocol ip pref 1 flower chain 0 handle",
        "matchCount": "500000",
        "teardown": [
            "$TC qdisc del dev $DEV2 ingress",
            "/bin/rm -rf $BATCH_DIR"
        ]
    },
    {
        "id": "6e8f",
        "name": "Replace and delete from same tp with 10 tc instances",
        "category": [
            "filter",
            "flower",
            "concurrency"
        ],
        "setup": [
            "/bin/mkdir $BATCH_DIR",
            "$TC qdisc add dev $DEV2 ingress",
            "./tdc_multibatch.py -x init_ $DEV2 $BATCH_DIR 100000 10 add",
            "bash -c \"find $BATCH_DIR/init_* -print | xargs -n 1 -P 5 $TC -b\"",
            "./tdc_multibatch.py -x par_ -a 500001 -m 5 $DEV2 $BATCH_DIR 100000 5 replace",
            "./tdc_multibatch.py -x par_ $DEV2 $BATCH_DIR 100000 5 del"
        ],
        "cmdUnderTest": "bash -c \"find $BATCH_DIR/par_* -print | xargs -n 1 -P 10 $TC -b\"",
        "expExitCode": "0",
        "verifyCmd": "$TC -s filter show dev $DEV2 ingress",
        "matchPattern": "filter protocol ip pref 1 flower chain 0 handle",
        "matchCount": "500000",
        "teardown": [
            "$TC qdisc del dev $DEV2 ingress",
            "/bin/rm -rf $BATCH_DIR"
        ]
    },
    {
        "id": "2ff3",
        "name": "Add flower with max handle and then dump it",
        "category": [
            "filter",
            "flower"
        ],
        "setup": [
            "$TC qdisc add dev $DEV2 ingress"
        ],
        "cmdUnderTest": "$TC filter add dev $DEV2 protocol ip pref 1 ingress handle 0xffffffff flower action ok",
        "expExitCode": "0",
        "verifyCmd": "$TC filter show dev $DEV2 ingress",
        "matchPattern": "filter protocol ip pref 1 flower.*handle 0xffffffff",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DEV2 ingress"
        ]
    },
    {
        "id": "d052",
        "name": "Add 1M filters with the same action",
        "category": [
            "filter",
            "flower"
        ],
        "setup": [
            "$TC qdisc add dev $DEV2 ingress",
            "./tdc_batch.py $DEV2 $BATCH_FILE --share_action -n 1000000"
        ],
        "cmdUnderTest": "$TC -b $BATCH_FILE",
        "expExitCode": "0",
        "verifyCmd": "$TC actions list action gact",
        "matchPattern": "action order 0: gact action drop.*index 1 ref 1000000 bind 1000000",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DEV2 ingress",
            "/bin/rm $BATCH_FILE"
        ]
    },
    {
        "id": "4cbd",
        "name": "Try to add filter with duplicate key",
        "category": [
            "filter",
            "flower"
        ],
        "setup": [
            "$TC qdisc add dev $DEV2 ingress",
            "$TC filter add dev $DEV2 protocol ip prio 1 ingress flower dst_mac e4:11:22:11:4a:51 src_mac e4:11:22:11:4a:50 ip_proto tcp src_ip 1.1.1.1 dst_ip 2.2.2.2 action drop"
        ],
        "cmdUnderTest": "$TC filter add dev $DEV2 protocol ip prio 1 ingress flower dst_mac e4:11:22:11:4a:51 src_mac e4:11:22:11:4a:50 ip_proto tcp src_ip 1.1.1.1 dst_ip 2.2.2.2 action drop",
        "expExitCode": "2",
        "verifyCmd": "$TC -s filter show dev $DEV2 ingress",
        "matchPattern": "filter protocol ip pref 1 flower chain 0 handle",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DEV2 ingress"
        ]
    },
    {
        "id": "7c65",
        "name": "Add flower filter and then terse dump it",
        "category": [
            "filter",
            "flower"
        ],
        "setup": [
            "$TC qdisc add dev $DEV2 ingress"
        ],
        "cmdUnderTest": "$TC filter add dev $DEV2 protocol ip pref 1 ingress flower dst_mac e4:11:22:11:4a:51 action drop",
        "expExitCode": "0",
        "verifyCmd": "$TC -br filter show dev $DEV2 ingress",
        "matchPattern": "filter protocol ip pref 1 flower.*handle",
        "matchCount": "1",
        "teardown": [
            "$TC qdisc del dev $DEV2 ingress"
        ]
    },
    {
        "id": "d45e",
        "name": "Add flower filter and verify that terse dump doesn't output filter key",
        "category": [
            "filter",
            "flower"
        ],
        "setup": [
            "$TC qdisc add dev $DEV2 ingress"
        ],
        "cmdUnderTest": "$TC filter add dev $DEV2 protocol ip pref 1 ingress flower dst_mac e4:11:22:11:4a:51 action drop",
        "expExitCode": "0",
        "verifyCmd": "$TC -br filter show dev $DEV2 ingress",
        "matchPattern": "  dst_mac e4:11:22:11:4a:51",
        "matchCount": "0",
        "teardown": [
            "$TC qdisc del dev $DEV2 ingress"
        ]
    }
]