Terminal Diagnostic Messages

The server can support generation of notification messages that will automatically be displayed on yangcli-pro and yp-shell terminal sessions. A SIL or SIL-SA program will generate the <term-msg> notifications and the server will deliver them to all clients enabled to receive notifications. The client program will display the text message contents on the terminal.

  • The yumaworks-term-msg.yang module defines the <term-msg> notification.

  • The --with-term-msg CLI parameter is used by netconfd-pro and yangcli-pro/yp-shell to enable the <term-msg> notifications

  • The 'agt_make_term_msg' API function is used to make a notification structure using the provided text string.

Diagnostic Message Generation by SIL and SIL-SA Callbacks

Once this feature is enabled, the SIL or SIL-SA code must use a special API function to create a terminal message to send.

Once created, the notification is queued in the normal manner.

Do not use the "stream" specific APIs for terminal messages!
agt_not_msg_t *agt_make_term_msg(const xmlChar *msg, status_t *res)

Create a <term-msg> notification.

Parameters
  • msg -- string to send as the data field

  • res -- address of return status

Return values

*res -- return status

Returns

malloced agt_not_msg_t struct if OK; NULL if some error

SIL Example Usage

const xmlChar *msgbuff =
   (const xmlChar *)"This is a 1 line message";
status_t res = NO_ERR;
agt_not_msg_t *notif = agt_make_term_msg(msgbuff, &res);
if (notif == NULL) {
    log_error("\nError: cannot make term-msg (%s)",
               get_error_string(res));
    return;
}

agt_not_queue_notification(notif);

SIL-SA Example Usage:

const xmlChar *msgbuff =
   (const xmlChar *)"This is a 2 line message\nthat will be displayed";
status_t res = NO_ERR;
agt_not_msg_t *notif = agt_make_term_msg(msgbuff, &res);
if (notif == NULL) {
    log_error("\nError: cannot make term-msg (%s)",
              get_error_string(res));
    return;
}

sil_sa_queue_notification(notif);