Must rule for choice and individual case stmts

Need to deviate this standard yang. In the standard yang there is a choice.

            choice ace-ip-version {
              description
                "IP version used in this Acess List Entry.";
              case ace-ipv4 {
                uses packet-fields:acl-ipv4-header-fields;
                }
              }
              case ace-ipv6 {
                uses packet-fields:acl-ipv6-header-fields;
                }
              }
            }

Need to apply a must rule for each case statement ace-ipv4 and ace-ipv6. I need to calculate the number of instances of these cases

I get the the error “error: unknown error code: YANG_BAD_DEVIATION [must,‘case’]” when I deviate add like below,
deviation /iacl:access-lists/iacl:acl/iacl:access-list-entries/iacl:ace/iacl:matches/iacl:ace-type/iacl:ace-ip/iacl:ace-ip-version/iacl:ace-ipv4 {
deviate add {
must “count(*) < 100” {
tailf:dependency “.”;
error-message “Ipv4 rules should be only 1000”;
}
}
}

I don’t believe you are able to deviate on a case statement as indicated in section 7.18.3 of the YANG RFC (6020) as follows:

The "deviation" statement defines a hierarchy of a module that the
device does not implement faithfully.  The argument is a string that
identifies the node in the schema tree where a deviation from the
module occurs.  This node is called the deviation's target node.  The
contents of the "deviation" statement give details about the
deviation.

The argument string is an absolute schema node identifier (see
Section 6.5).

My suggestion is to deviate on the container node named matches. You will want to count the number of instances of the ipv4 leafs and ipv6 leafs to be less than your desired constraint.