Subject: [netmod] XPath roots example

From: Andy Bierman <[email-masked]>
Date: Wed, 07 Jan 2009 09:48:35 -0800

Hi,

Maybe a stupid example will help.
I think I agree with Martin on all the various roots,
but I'm not sure :-)

module test {

   container test {

      must /test2;
      must ../test2;

      leaf test { type string; }
   }

   leaf test2 {
      when /test;
      type string;
   }

   rpc test {
      when /test;

      input {
        leaf test {
           type string;
           must /test2;
           must ../test2;
        }
        leaf test2 { type int32; }
      }
      output {
        leaf test {
           type string;
           must /test2;
           must ../test2;
        }
        leaf test2 { type int32; }
      }
   }

   notification test {
      when /test;

      leaf test {
           type string;
           must /test2;
           must ../test2;
      }
      leaf test2 { type int32; }
   }

}

Which 'test' or 'test2' is being referenced in each
must or when statement?

Andy

_______________________________________________
netmod mailing list
[email-masked]
https://www.ietf.org/mailman/listinfo/netmod

---

From: Martin Bjorklund <[email-masked]>
Date: Wed, 07 Jan 2009 21:49:13 +0100 (CET)

Hi,

>       leaf test { type string; }

This is not allowed.  Very unclear what it would mean...
I.e. 'when' is not allowed in 'rpc'.

>         leaf test2 { type int32; }

Ditto.

Continuing this example:

   list interface {                   // A
     key "name";
     leaf name { ... }
   }

   notification foo
     leaf test {
       type leafref {
         path "/interface/name";      // 1
       }
       must "/interface/name";        // 2
     }
     leaf test2 {
       type leafref {
         path "../interface/name";    // 3
       }
       must "../interface/name";      // 4
     }
     list interface {                 // B
       key "name";
       leaf name { ... }
     }
   }

The confusion here is real - the main use case for leafrefs is to be
able to refer to config/operational data in notifications, so it seems
(1) above should refer to the config data (A), not the list in the
notification (B).  But clearly (3) refers to (B), not (A).   It's also
odd if (2) does not refer to the same as (1).

/martin