# trTCM_red treats Tc pass but Tp fail correctly ------------------------------
LD_LIBRARY_PATH=. PATH=$PATH:tcc/ext tcsim -v -Xc,-xif:test | \
  sed '/^.* c .*returns /s///p;d'
dev eth0 0 {
    #include "meters.tc"

    set_trTCM($p,cir 0bps,cbs 300B,pir 0bps,pbs 1000B);

    prio (bands 4) {
	class if trTCM_green($p);
	class if trTCM_yellow($p);
	class if trTCM_red($p);
	class if 1;
    }
}

send 0 x 1000	/* passes burst, fails commited -> yellow */
send 0 x 300	/* fails burst -> red */
EOF
OK (0) (1:2, 0x0)
OK (0) (1:3, 0x0)
# trTCM tccext code -----------------------------------------------------------
tcc -xif:err 2>&1 >/dev/null | grep -v '^#'
#include "meters.tc"
    
set_trTCM($p,cir 0bps,cbs 300B,pir 0bps,pbs 1000B);
    
prio (bands 4) {
    class if trTCM_green($p);
    class if trTCM_yellow($p);
    class if trTCM_red($p);
    class if 1;
}
EOF
block eth0 egress
bucket 1 = 0 0 300 300 0
bucket 2 = 0 0 1000 1000 0
action 3 = class 1:3
action 2 = class 1:2
action 0 = count 2 action 2
action 4 = conform 2 action 0 action 3
action 1 = class 1:1
action 5 = count 2 action 1
action 6 = count 1 action 5
action 7 = conform 2 action 6 action 3
action 8 = conform 1 action 7 action 4
match action 8
