In CISCO-CLASS-BASED-QOS-MIB.my, Cisco says:
Service policy is a policymap that is being attached to a logical interface. Because a policymap can also be a part of the hierarchical structure (inside a classmap), only a policymap that is directly attached to a logical interface is considered a service policy. Each service policy is uniquely identified by an index called cbQosPolicyIndex. This number is usually identical to its cbQosObjectsIndex as a policymap.
Sadly, Cisco doesn’t explain when it’s identical or not, and when not, how to find the matching cbQosConfigIndex. And here we are, I do have a few bad players, namely the Cisco ASR 1001. All other Cisco routers I analysed have identical values for cbQosPolicyIndex and cbQosObjectsIndex, but those beasts don’t. The most expensive Cisco routers are somewhat different then the basic crop. But anyway, I probably shall not complain, the MIB says “usually”, so it seems they protected themselves in a very inelegant but efficient way.
I’m not really sure what is the best way to solve this problem, maybe some fuzzy-matching of top-level policy-maps, e.g. those having no parents in the object tree ? Will see.
Update, problem fixed through a parser rewrite.