ConfD User Community

Does confd_cs_node_info say node is "config false"

Hi

We are trying to use a single callpoint to handle the whole yang model. at same time, those operational data should be split out to different “data provider”. However, we can’t found any indicator that can help us to distinguish those “config false” leaf from others. From the documents, my best guessing would be using CS_NODE_IS_WRITE flag to make the judgment. But there is no any details description about those flags.
is there anyone who has done similar thing before? thanks for your comments in advance.

============update
after twist a little bit of one example, I got some hint but not very sure if my understanding is right.
My yamg model now look like as follows

module arpe {
  namespace "http://tail-f.com/ns/example/arpe";
  prefix arpe;

  import ietf-inet-types {
    prefix inet;
  }

  container arpentries {
    list arpe {
      key "ip";
      leaf ip {
        config true;
        type inet:ip-address;
      }
      leaf ifname {
        config true;
        type string;
      }
      leaf hwaddr {
        config false;
        type string;
      }
      leaf permanent {
        type boolean;
        mandatory true;
      }
      leaf published {
        type boolean;
        mandatory true;
      }
    }
  }
}

Then I have ifname as “config true” and hwaddr as “config false” node. in the code, i tried to print the flag for those two nodes.

object = confd_cs_node_cd(NULL, "/arpe:arpentries/arpe/ifname");
debugf = fopen("_tmp_debug", "a");
fprintf(debugf," flag = %d \n", object->info.flags);
fclose(debugf);

object = confd_cs_node_cd(NULL, "/arpe:arpentries/arpe/hwaddr");
debugf = fopen("_tmp_debug", "a");
fprintf(debugf," flag = %d \n", object->info.flags);
fclose(debugf);

then I got the output as

flag = 6 # config true
flag = 4100 #config false

translate those two value to the flag

config false: 4100 = 00010000 00000100 # CS_NODE_IS_CDB & CS_NODE_IS_WRITE_ALL 
confg true: 6  = 00000000 00000110 # CS_NODE_IS_CDB & CS_NODE_IS_WRITE

So, the question is can I make a assumption that the flag can be used to distinguish “config false” node from config nodes?

Yes - CS_NODE_IS_WRITE is not set for config false nodes, but is set for config nodes.

Thanks for the reply. Do you mean I can use "CS_NODE_IS_WRITE = 1 " to check “config true” data.
at same time, as you can see in my code, I have found the CS_NODE_IS_WRITE_ALL is set for “config false”. Does that means the criteria of Operational Data is ““CS_NODE_IS_WRITE_ALL” = 1 and CS_NODE_IS_WRITE = 0”.

Yes (although of course you can’ t literally use that to test a bit value in C).

I don’t know why that is, and it is not the case for me when I try your model. As far as I know, that flag is set for leafs that have tailf:writable true;, but there may be other cases. In any case you should ignore it for config false vs config true.

No, the CS_NODE_IS_WRITE flag being unset (as I wrote earlier) is sufficient.

Note though that the above is for “normal” data nodes - action/rpc input/output and notifications (where config doesn’t apply) may use CS_NODE_IS_WRITE in other ways.

1 Like