cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
450
Views
5
Helpful
1
Replies

How to make DpActionTrans.actionSetTimeout configurable instead of static

rkudumul
Cisco Employee
Cisco Employee

Hi,

Currently we hard coded the action timeout value(600 sec) in the action class.  But we want to make it configurable instead of static.

@ActionCallback(callPoint = "test", callType = ActionCBType.ACTION)
public ConfXMLParam[] test(DpActionTrans trans, ConfTag name, ConfObject[] kp, ConfXMLParam[] params)
throws DpCallbackException {

trans.actionSetTimeout(600);

}

Any idea how to make it configurable?

Thanks & Regards
Ramathulasi

1 Reply 1

snovello
Cisco Employee
Cisco Employee
Hello,
One way to make it configurable is to add an input parameter to your action. So you alter the yang model for the action adding an input section like
input {
leaf transaction-timeout {
type uint16;
default 600;
description ‘transaction timeout in seconds’;
}
}

In your code you have to get the value from the params argument. A java example for a string value is in the NSO installation under
examples.ncs/getting-started/developing-with-ncs/2-actions

Another possibility would be to store this timeout in cdb, and having the action read it from there. It works if you are not interested in changing it per invocation, but rather just configuring a default value once.