ConfD User Community

Can I have list inside action,whether it is possible


#1

for more details pls see below example

tailf:action ccd {
tailf:info "Change ";
tailf:actionpoint c-point {
tailf:opaque ‘ur’;
}

                            list  PC {
                           
                            key "Md";
                            leaf Md {
                                    type string;
                                    mandatory true;
                            }
                    input {

                            leaf Pad {
                                    description "Users ";
                                    type string;
                                    mandatory true;
                            }

                            leaf Npad {
                                    description "Users";
                                    type string;
                                    mandatory true;
                            }

                    }
                    output {}
         } }

#2

You can’t!
But, can you compile this?


#3

no,i’m unable to compile this YANG.


#4

Good because a list inside of an action is not valid YANG.
You can have lists inside of the input or output if you want.


#5

hi,

can we define a callpoint for a list if we have defined it inside an action just like normal list?


#6

No you can’t - what would it mean? The ‘input’ statement defines the parameters to give to an action when invoked, ConfD will pass them to the action callback/executable. How would a callpoint for any of those parameters be interpreted?


#7

Hi per,

as per our requirement i need to generate a command for something like changing the password for a particular user.

example…
users user changepasswd [username] curpasswd **** newpasswd ****

here we want the usernames to be populated with a callpoint.

is it possible to do with actions?. please suggest if there is any alternative.

thanks.


#8

I’m not really sure what you mean here, but it certainly doesn’t seem to be the case of a list defined inside action ‘input’ - rather it seems to be a leaf in the action input that should have the value of one of the keys in a list. The “natural” way to model such a thing is to have the leaf be type leafref { path "/path/to/list/key"'; }. A leafref in action/rpc input is fully supported only in ConfD-6.5 or later, but it works for CLI completion also in earlier versions. (Whether the list is provided by CDB or by an external data provider via a callpoint doesn’t matter.)

But I also get the impression that the list in question is actually users user, in which case you can’t really have the action be invoked as users user changepasswd without a key after user (at least not unless you want it to be invoked for all users:-). I.e. if the changepasswd action is defined in the users user list, the way to invoke it would be

users user [username] changepasswd curpasswd **** newpasswd ****

where [username] is required to be the key of an existing entry in the list. This “just works”, and seems to me to be a clean solution for your requirement