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