clicon / clixon

YANG-based toolchain including NETCONF and RESTCONF interfaces and an interactive CLI
http://www.clicon.org/
Other
216 stars 71 forks source link

Message to the user #497

Closed khromenokroman closed 6 months ago

khromenokroman commented 7 months ago

Hi, is there a way to output a message from the plugin to the Cli?? for example, about the process of passing transactions, do something like printf()

olofhagsand commented 7 months ago

With "the plugin" I assume you mean a backend plugin. A cli plugin can just use stderr/stdout. Communication from a backend plugin ro the cli (or any other client) is by:

  1. Replies on existing RPC:s when the function is completed. One could define a new RPC just to poll a message
  2. Notifications. Set up a event notification which the CLI (or any other client) can subscribe to.
  3. Some out-of-band mechanism, but this is outside clixon.

For event notifications: The backend plugin creates a stream with stream_add() and then makes notifications with stream_notify(). The cli client (cli plugin) subscribes to the event stream with clicon_rpc_create_subscription() and then needs to set up event handling for the returned socket.

olofhagsand commented 7 months ago

See also https://clixon-docs.readthedocs.io/en/latest/misc.html#event-notifications