• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2# vim: ft=sh
3
4. lib/generic.sh
5
6QDISCS="cbq htb dsmark"
7
8if [ ! -d tests/cls ]; then
9    ts_log "tests/cls folder does not exist"
10    ts_skip
11fi
12
13for q in ${QDISCS}; do
14	ts_log "Preparing classifier testbed with qdisc $q"
15
16	for c in tests/cls/*.c; do
17
18		case "$q" in
19		cbq)
20			ts_tc "cls-testbed" "cbq root qdisc creation" \
21				qdisc add dev $DEV root handle 10:0 \
22				cbq bandwidth 100Mbit avpkt 1400 mpu 64
23			ts_tc "cls-testbed" "cbq root class creation" \
24				class add dev $DEV parent 10:0  classid 10:12 \
25				cbq bandwidth 100mbit rate 100mbit allot 1514 prio 3 \
26				maxburst 1 avpkt  500 bounded
27			;;
28		htb)
29			ts_qdisc_available "htb"
30			if [ $? -eq 0 ]; then
31				ts_log "cls-testbed: HTB is unsupported by $TC, skipping"
32				continue;
33			fi
34			ts_tc "cls-testbed" "htb root qdisc creation" \
35				qdisc add dev $DEV root handle 10:0 htb
36			ts_tc "cls-testbed" "htb root class creation" \
37				class add dev $DEV parent 10:0 classid 10:12 \
38				htb rate 100Mbit quantum 1514
39			;;
40		dsmark)
41			ts_qdisc_available "dsmark"
42			if [ $? -eq 0 ]; then
43				ts_log "cls-testbed: dsmark is unsupported by $TC, skipping"
44				continue;
45			fi
46			ts_tc "cls-testbed" "dsmark root qdisc creation" \
47				qdisc add dev $DEV root handle 20:0 \
48				dsmark indices 64 default_index 1 set_tc_index
49			ts_tc "cls-testbed" "dsmark class creation" \
50				class change dev $DEV parent 20:0 classid 20:12 \
51				dsmark mask 0xff value 2
52			ts_tc "cls-testbed" "prio inner qdisc creation" \
53				qdisc add dev $DEV parent 20:0 handle 10:0 prio
54			;;
55		*)
56			ts_err "cls-testbed: no testbed configuration found for qdisc $q"
57			continue
58			;;
59		esac
60
61		ts_tc "cls-testbed" "tree listing" qdisc list dev eth0
62		ts_tc "cls-testbed" "tree class listing" class list dev eth0
63		ts_log "cls-testbed: starting classifier test $c"
64		$c
65
66		case "$q" in
67		*)
68			ts_tc "cls-testbed" "generic qdisc tree deletion" \
69				qdisc del dev $DEV root
70			;;
71		esac
72	done
73done
74