File: pol_traffic

package info (click to toggle)
tcng 10b-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,644 kB
  • sloc: ansic: 19,040; pascal: 4,640; yacc: 2,619; sh: 1,914; perl: 1,546; lex: 772; makefile: 751
file content (49 lines) | stat: -rw-r--r-- 1,436 bytes parent folder | download | duplicates (5)
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
# policer in if_c: traffic test (single policer) ------------------------------
LD_LIBRARY_PATH=. PATH=$PATH:tcc/ext \
  tcsim -Xc,-tc tests/lib/pol_single.tcsim | tcsim_filter -c tos
D:00 50
D:01 51
E:00 101
# policer at external interface: traffic test (single policer) ----------------
LD_LIBRARY_PATH=. PATH=$PATH:tcc/ext \
  tcsim -Xc,-xif:test tests/lib/pol_single.tcsim | tcsim_filter -c tos
D:00 54
D:01 47
E:00 101
# policer at if_c: drop test (single policer) ---------------------------------
LD_LIBRARY_PATH=. PATH=$PATH:tcc/ext \
  tcsim -Xc,-tc tests/lib/pol_single_drop.tcsim | tcsim_filter -c tos
D:01 51
E:00 101
# policer at if_ext: drop test (single policer) -------------------------------
LD_LIBRARY_PATH=. PATH=$PATH:tcc/ext \
  tcsim -Xc,-xif:test tests/lib/pol_single_drop.tcsim | tcsim_filter -c tos
D:01 47
E:00 101
# policer at if_ext: alternative version --------------------------------------
LD_LIBRARY_PATH=. PATH=$PATH:tcc/ext \
  tcsim -Xc,-xif:test | tcsim_filter -c tos
/*
 * Single policer, drops
 */

dev eth0 10000 { /* 10 Mbps */
    $p = police(rate 250kbps,burst 130B);
    dsmark (indices 2) {
        class (1,mask 0,value 1)
            if (conform police $p && count police $p) || drop;
        class (0)
            if 1;
    }
}

every 0.001s send 0 x 125       /* 1 Mbps */
time 0.1s

/*
 * Should enqueue 101 packets, mark 25% of them as "1", and drop the rest
 */

EOF
D:01 25
E:00 101