Subject: [netmod] must-stmt usage example

From: Andy Bierman <[email-masked]>
Date: Sat, 30 May 2009 11:16:40 -0700

Hi,

[Warning: enhancement request up ahead!]

If one were to write a YANG file to model
the create-subscription operation in RFC 5277,
one might add the following must-stmt to
the stopTime leaf:

    leaf stopTime {
       must ". < ../startTime";
       type xsd:dateTime;
       description
          "An optional parameter used with the optional replay
           feature to indicate the newest notifications of
           interest. If stop time is not present, the notifications
           will continue until the subscription is terminated.
           Must be used with startTime.";
    }

The problem is that the error-tag specified for this exact error
condition (in RFC 5277) is 'bad-element'.  However, the YANG draft
specifies that the error-tag used is hard-wired to 'operation-failed'.

IMO, an optional error-tag-stmt added to the must-stmt subclauses
will make this construct more useful.  If the clause is missing,
then the default is 'operation-failed'.  The string has to match
one of the standard error-tag values in RFC 4741.

    leaf stopTime {
       must ". < ../startTime" {
           error-tag "bad-element";
       }
       type xsd:dateTime;
       description
          "An optional parameter used with the optional replay
           feature to indicate the newest notifications of
           interest. If stop time is not present, the notifications
           will continue until the subscription is terminated.
           Must be used with startTime.";
    }

    error-tag-stmt   =  error-tag-keyword sep
                        error-tag-arg-str stmtend

    error-tag-arg-str = < a string which matches the rule
                          error-tag-arg >

    error-tag-arg = ** error-tag values enumerated **

This would affect the length, pattern, range, and must statements.
All of them allow the error-app-tag and error-message fields now,
so they should allow an error-tag field as well.

Comments?

Andy

---

From: Andy Bierman <[email-masked]>
Date: Sat, 30 May 2009 11:21:40 -0700

> one might add the following must-stmt to

oops -- got it backwards:

        must ". >= ../startTime";

Andy

---

From: Andy Bierman <[email-masked]>
Date: Sat, 30 May 2009 11:34:53 -0700

> [Warning: enhancement request up ahead!]

I just remembered that the create-subscription operation
defines some useless <error-info> added to it (bad-element).
Modeling all the error-info is more than I had in mind,
and the error-tag alone is not enough to automate the
error response correctly.  Perhaps YANG2 should model
every error detail, but not now.

BTW, in the future, we should not misuse the <bad-element>
error-info.  The <error-path> already points to
the bad input parameter, so this data is redundant.

Andy