ConfD User Community

Tailf:cli-completion-actionpoint usage in Java/YANG


#1

NSO version: 4.7.1

I have written a sample java action-demo to explore how tailf:cli-completion-actionpoint ( Tail-f YANG CLI extensions) works.

However when i invoke the completion-actionpoint (from CLI) I always get below errors in log files

ncs.log

no registration found for callpoint if-complete-action/completion of type=external

devel.log

1-Dec-2018::21:03:28.952 zahid-VirtualBox ncs[29209]: devel-c no registration found for callpoint if-complete-action/completion of type=external
1-Dec-2018::21:03:28.952 zahid-VirtualBox ncs[29209]: ncs Return error {cs_error,undefined,misc,external,undefined,undefined,
<<“no registration found for callpoint if-complete-action/completion of type=external”>>,
undefined,undefined,false}

Here is the yang definition

module action-demo {
…namespace “http://com/example/actiondemo”;
…prefix action-demo;

…import ietf-inet-types { prefix inet; }
…import tailf-common { prefix tailf; }
…import tailf-ncs { prefix ncs; }

…description “A small demo module to illustrate how to implement user defined actions”;

…container action-demo {
…tailf:action myvpn-action {
…tailf:actionpoint actionpoint-myvpn;
…input {
…container endpoint {
…tailf:cli-compact-syntax;
…leaf device {
…type leafref {
…path “/ncs:devices/ncs:device/ncs:name”;
…}
…tailf:info “Endpoint Device”;
…mandatory true;
…}

…leaf interface {
…tailf:info “Endpoint Port”;
…type string;
…tailf:cli-completion-actionpoint if-complete-action;
…mandatory true;
…}
…}
…}
…}
…}
}

Here is the Java code snippet

public class ActionDemo {
private static Logger LOGGER = Logger.getLogger(ActionDemo.class);

// some code here
// …

@ActionCallback(callPoint = “if-complete-action”, callType = ActionCBType.COMPLETION)
Completion completion(DpActionTrans actx, char cliStyle, String token, char completionChar, ConfObject[] kp, String cmdPath, String cmdParamId,
ConfQname simpleType, String extra) throws DpCallbackException {
try {
LOGGER.info(String.format(“completion() callback, actionpoint : %s”, actx.getActionPoint()));

CompletionReply reply = Completion.newReply();
reply.addCompletion(“fe-0/0”, null);
reply.addCompletion(“fe-0/1”, null);
reply.addCompletion(“ge-0/0”, null);
reply.addCompletion(“ge-0/1”, null);
reply.setCompletionInfo(“interfaces”);
reply.setCompletionDesc(“all device interfaces”);
return reply;

} catch (Exception e) {
throw new DpCallbackException(“completion failed”, e);
}
}
}

package-meta-data.xml

action-demo 1.0 Java-based action-demo 2.0 action-demo com.example.actiondemo.ActionDemo

Any help will be greatly appreciated.

Thanks

Zahid


#2

Problem has been resolved.
completion() callback was not overridden due to the fact that it was package private.
I made it public completion().


#3

Great. For future NSO questions you likely want to post them at the NSO developer hub:
https://community.cisco.com/t5/nso-developer-hub/ct-p/5672j-dev-nso