The "common-functions" widget cannot be found.
This widget could not be displayed.
This widget could not be displayed.
This widget could not be displayed.
This widget could not be displayed.
This widget could not be displayed.
cancel
Showing results for 
Search instead for 
Did you mean: 

action call

suvdeshm
Cisco Employee
Cisco Employee

Experts, I need help with this error-

I have code for calling action which gives error at the last line:-----

with ncs.maapi.Session(m, uinfo.username, 'python', groups=['ncsadmin']):
   with m.start_write_trans() as t:
      root = ncs.maagic.get_root(t)
      ip_node = ncs.maagic.get_node(t, "/act-key-gen:action")
      input_keygen = ip_node.keygen
      ip=input_keygen.get_input()
      ip.request = request_list
 
The error is:-----

ncs.maagic.MaagicError: Node has no attribute 'request'

The yang for the action being called is:-----

module act-key-gen {

namespace "http://example.com/act-key-gen";
prefix act-key-gen;


container action {
   tailf:action keygen {
     tailf:actionpoint keygen;
      input {
          list request {
             leaf module {
                type modules;
             }
          leaf char-set {
               type charset;

          }

1 Accepted Solution

Accepted Solutions

snovello
Cisco Employee
Cisco Employee
The error message seems to be misleading but you cannot assign to a list this way in the maagic API. I think that is the problem.
If you were to switch this round
request_list = ip.request
the you can create elements in the list
individual_request = request_list.create()
and assign values to the leaves in the created elements

View solution in original post

2 Replies 2

snovello
Cisco Employee
Cisco Employee
The error message seems to be misleading but you cannot assign to a list this way in the maagic API. I think that is the problem.
If you were to switch this round
request_list = ip.request
the you can create elements in the list
individual_request = request_list.create()
and assign values to the leaves in the created elements

Thank you.