#!/bin/bash
# Test 6
# Check when enabling marking via an action-group it works ok
INTERFACE=$1
set policy action name test mark pcp 3
set policy action name test mark pcp-inner
set policy action name test police rate 1
set policy action name test police then mark pcp 7
set policy action name test police then mark pcp-inner
set policy qos profile prof bandwidth 2mbit
set policy qos name trunk shaper default prof
set policy qos name test shaper class 1 match 1 action-group test
set policy qos name test shaper class 1 profile prof
set policy qos name test shaper default prof
set int data $INTERFACE policy qos trunk
set int data $INTERFACE vif 10 inner-vlan 20
set int data $INTERFACE vif 10 policy qos test
set int data $INTERFACE vif 10 vlan 10
commit
ret=`run sh queuing $INTERFACE.10 class | grep markpcp | grep active | wc -l`
if [ $ret -ne 1 ]; then
   echo "Failed to activate marking using an action-group";
   exit 1;
fi

ret=`run sh queuing $INTERFACE.10 class | grep policer | grep inner | grep active | wc -l`
if [ $ret -ne 1 ]; then
   echo "Failed to activate a policer using an action-group";
   exit 1;
fi

# Tidy up
del int data $INTERFACE policy
del int data $INTERFACE vif 10
del policy
commit

echo "Test 6 passed"
