Issue Compiling YANG File Any help on this model?

module myyang {
  namespace "";
  prefix myyang;

  import tailf-common {
    prefix tailf;
  import ietf-inet-types {
    prefix inet;
  container mycontainer {
      list application {
          key "name";
          leaf name {
              type string;
          leaf keyname {
              type leafref { path "/port-map/port12"; }
          leaf nat {
              type leafref 
              { path "/port-map[port12 = current()/../keyname]/protocol/protocol-name"; }
          leaf protocol {
              type leafref
              {path "/app-pc[app-pcname= /port-map[port12 = current()/../keyname]/protocol1]/pc-name"; }
  list app-pc {
      key "app-pcname";
      leaf app-pcname {
          type string;
      list pc-name {
        key "pc";
        leaf pc {
          type string;
  list port-map {
    key "port12";
    leaf port12 {
      type inet:port-number;
    leaf protocol1 {
        type string;
    list protocol {
      key "protocol-name";
      leaf protocol-name {
        type string;

When I compile I get following error any help on the same ?

[root@localhost bin]# ./confdc -c myyang.yang 
myyang.yang:26: error: bad argument value "/app-pc[app-pcname= /port-map[port12 = current()/../keyname]/protocol1]/pc-name", should be of type path-arg
[root@localhost bin]#

From the YANG spec, i.e. RFC 6020, 9.9.2. The path Statement:

   The syntax for a path argument is a subset of the XPath abbreviated
   syntax.  Predicates are used only for constraining the values for the
   key nodes for list entries.  Each predicate consists of exactly one
   equality test per key, and multiple adjacent predicates MAY be
   present if a list has multiple keys.  The syntax is formally defined
   by the rule "path-arg" in Section 12.

And through that rule, you find:

   path-predicate      = "[" *WSP path-equality-expr *WSP "]"

   path-equality-expr  = node-identifier *WSP "=" *WSP path-key-expr

   path-key-expr       = current-function-invocation *WSP "/" *WSP

   current-function-invocation = current-keyword *WSP "(" *WSP ")"

   rel-path-keyexpr    = 1*(".." *WSP "/" *WSP)
                         *(node-identifier *WSP "/" *WSP)

I.e. the key predicates are restricted to [<key-name> = current()/…/<path-without-predicates>], which your path argument doesn’t adhere to. I’m not sure I understand exactly what you are trying to achieve, but I think it should be possible by using a simpler leafref path combined with a ‘must’ expression.

That ABNF is the whole story for YANG, but there’s more to tell for ConfD. In ConfD, we also have the deref function. So, I wonder if you can explain a bit more @per. When I read the above ABNF, I am assumign that the path-key-expr production is actually this in ConfD:

path-key-expr       = function-invocation *WSP "/" *WSP
function-invocation = current-function-invocation | 
deref-function-invocation = deref-keyword *WSP "(" *WSP path-key-expr *WSP ")/" path-key-expr
deref-keyword = 'deref'

Is that right?

If so, can you help me figure out why confd says this isn’t a valid path-arg (whitespace added for readability only)?

type leafref {
          path "/base:profiles/base:profile[

That ABNF is the whole story for YANG, but there’s more to tell for ConfD. In ConfD, we also have the deref function.

Or maybe it is the whole story, and deref can only be in the path, outside a predicate. Is that it @per?