yumapro  20.10-12
YumaPro SDK
agt_ypgnmi.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 - 2021, YumaWorks, Inc., All Rights Reserved.
3  *
4  * Unless required by applicable law or agreed to in writing,
5  * software distributed under the License is distributed on an
6  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
7  * KIND, either express or implied. See the License for the
8  * specific language governing permissions and limitations
9  * under the License.
10  */
11 #if defined(WITH_GNMI) && defined(WITH_RESTCONF) && defined(WITH_YCONTROL)
12 #ifndef _H_agt_ypgnmi
13 #define _H_agt_ypgnmi
14 
15 /* FILE: agt_ypgnmi.h
16 *********************************************************************
17 * *
18 * P U R P O S E *
19 * *
20 *********************************************************************/
21 
28 /*********************************************************************
29 * *
30 * C H A N G E H I S T O R Y *
31 * *
32 *********************************************************************
33 
34 date init comment
35 ----------------------------------------------------------------------
36 22-Mar-18 am Begun
37 */
38 
39 #ifndef _H_agt
40 #include "agt.h"
41 #endif
42 
43 #ifndef _H_agt_cfg
44 #include "agt_cfg.h"
45 #endif
46 
47 #ifndef _H_ncxtypes
48 #include "ncxtypes.h"
49 #endif
50 
51 #ifndef _H_dlq
52 #include "dlq.h"
53 #endif
54 
55 #ifndef _H_status
56 #include "status.h"
57 #endif
58 
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62 
63 /********************************************************************
64 * *
65 * C O N S T A N T S *
66 * *
67 *********************************************************************/
68 
69 /********************************************************************
70 * *
71 * T Y P E S *
72 * *
73 *********************************************************************/
74 
75 
76 /********************************************************************
77 * *
78 * F U N C T I O N S *
79 * *
80 *********************************************************************/
81 
82 
83 
102 extern status_t
103  agt_ypgnmi_init (void);
104 
105 
111 extern void
112  agt_ypgnmi_cleanup (void);
113 
114 
118 #ifdef __cplusplus
119 } /* end extern 'C' */
120 #endif
121 
122 #endif /* _H_agt_ypgnmi */
123 #endif // WITH_GNMI && WITH_RESTCONF && WITH_YCONTROL
ypgnmi_check_edits_status
boolean ypgnmi_check_edits_status(ypgnmi_edit_cb_t *ecb)
Check if any of the requested edits failed.
Definition: ypgnmi.c:381
ses.h
NETCONF Session Common definitions module.
ERR_NCX_SKIPPED
@ ERR_NCX_SKIPPED
2001
Definition: status_enum.h:551
agt_make_int_leaf
val_value_t * agt_make_int_leaf(obj_template_t *parentobj, const xmlChar *leafname, int32 leafval, status_t *res)
make an int32 val_value_t struct for a specified leaf or leaf-list
Definition: agt_util.c:3721
agt_ses.h
Server Session Management.
agt_util.h
Utility Functions for NCX Server method routines.
ERR_NCX_RESOURCE_UNKNOWN
@ ERR_NCX_RESOURCE_UNKNOWN
385
Definition: status_enum.h:428
val_find_child
val_value_t * val_find_child(const val_value_t *parent, const xmlChar *modname, const xmlChar *childname)
Find the first instance of the specified child node.
Definition: val.c:8560
agt_ypgnmi_set_setup
status_t agt_ypgnmi_set_setup(ses_cb_t *scb, rpc_msg_t *msg, val_value_t *input_val)
handle the YP-GNMI SET request from the subsystem
Definition: agt_ypgnmi_set.c:852
ERR_NCX_DEF_NOT_FOUND
@ ERR_NCX_DEF_NOT_FOUND
250
Definition: status_enum.h:289
log_error
void log_error(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_ERROR log entry.
agt_ypgnmi.h
Server YP-GNMI support module.
val.h
Value Node Basic Support.
val_make_simval_obj
val_value_t * val_make_simval_obj(obj_template_t *obj, const xmlChar *valstr, status_t *res)
Create and set a val_value_t as a simple type from an object template instead of individual fields Ca...
Definition: val_util.c:4389
YCONTROL_MSGBODY_ERROR
@ YCONTROL_MSGBODY_ERROR
error message
Definition: ycontrol_types.h:96
YCONTROL_MSG_SUBSYS_REQUEST
@ YCONTROL_MSG_SUBSYS_REQUEST
subsystem-request sent from subsystem to server
Definition: ycontrol_types.h:81
agt_sil_profile.h
Server SIL <agt-profile> message handler.
YCONTROL_MSGBODY_OK
@ YCONTROL_MSGBODY_OK
OK message.
Definition: ycontrol_types.h:90
op.h
NETCONF protocol operations.
VAL_NAME
#define VAL_NAME(V)
Access the value name.
Definition: val.h:399
ncxconst.h
Contains NCX constants.
ncxmod.h
NCX Module Load Manager.
ses_msg_free_buff
void ses_msg_free_buff(ses_cb_t *scb, ses_msg_buff_t *buff)
Free the session buffer chunk.
Definition: ses_msg.c:460
ses_msg.h
NETCONF Session Message Common definitions module.
xml_clean_attrs
void xml_clean_attrs(xml_attrs_t *attrs)
clean an xml_attrs_t variable
Definition: xml_util.c:1243
agt_ypgnmi_get_setup
status_t agt_ypgnmi_get_setup(ses_cb_t *scb, rpc_msg_t *msg, val_value_t *input_val)
handle the YP-GNMI get request from the subsystem
Definition: agt_ypgnmi_get.c:272
OP_EDITOP_MERGE
@ OP_EDITOP_MERGE
edit op is merge
Definition: op.h:124
agt_ncx_load_for_all_modules
status_t agt_ncx_load_for_all_modules(agt_ncx_load_cbfn_t cbfn, void *cookie)
Invoke a callback for all the modules loaded dynamically.
Definition: agt_ncx_load.c:3139
agt_sil_module_walker
status_t agt_sil_module_walker(const xmlChar *name, void *cookie)
Callback for dynamically loaded modules.
Definition: agt_sil.c:9892
ERR_NCX_MISSING_PARM
@ ERR_NCX_MISSING_PARM
233
Definition: status_enum.h:272
agt_ycontrol_send_ok
status_t agt_ycontrol_send_ok(ses_cb_t *scb, const xmlChar *service_id, uint32 msgid)
Send a ycontrol OK message.
Definition: agt_ycontrol.c:1518
log_debug2
void void void void void void void void void log_debug2(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG2 log entry.
NO_ERR
@ NO_ERR
000
Definition: status_enum.h:188
xpath.h
Schema and data model Xpath search support.
NCX_PROTO_RESTCONF
@ NCX_PROTO_RESTCONF
IETF RESTCONF.
Definition: ncxtypes.h:788
xml_init_attrs
void xml_init_attrs(xml_attrs_t *attrs)
initialize an xml_attrs_t variable
Definition: xml_util.c:745
log_debug4
void void void void void void void void void void void void void log_debug4(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG4 log entry.
ERR_NCX_OPERATION_FAILED
@ ERR_NCX_OPERATION_FAILED
274
Definition: status_enum.h:315
agt_ycontrol_send_error
status_t agt_ycontrol_send_error(ses_cb_t *scb, const xmlChar *service_id, uint32 msgid, status_t res, const xmlChar *errstr)
Send a ycontrol error message.
Definition: agt_ycontrol.c:1455
agt_sil.h
SIL Transaction APIs.
LOGDEBUG2
#define LOGDEBUG2
Check if at least log-level=debug2.
Definition: log.h:292
val_gen_index_chain
status_t val_gen_index_chain(const obj_template_t *obj, val_value_t *val)
Create an index chain for the just-parsed table or container struct.
Definition: val_util.c:2632
log_warn
void void void log_warn(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_WARN log entry.
ERR_INTERNAL_VAL
@ ERR_INTERNAL_VAL
004
Definition: status_enum.h:194
val_child_add
status_t val_child_add(val_value_t *child, val_value_t *parent)
Add a child value node to a parent value node.
Definition: val_child.c:1542
val_util.h
Value Node Utilities.
agt_ycontrol_register_service
status_t agt_ycontrol_register_service(const xmlChar *service_name, agt_ycontrol_service_fn_t service_fn)
Register a YControl service layer.
Definition: agt_ycontrol.c:1722
json_wr.h
JSON Write functions.
agt_ncx_load_for_modules_in_bundles
status_t agt_ncx_load_for_modules_in_bundles(agt_ncx_load_cbfn_t cbfn, void *cookie)
Invoke a callback for all modules in all the bundles.
Definition: agt_ncx_load.c:3277
ERR_NCX_INVALID_VALUE
@ ERR_NCX_INVALID_VALUE
258
Definition: status_enum.h:299
agt_sil_edit_transaction_in_progress
boolean agt_sil_edit_transaction_in_progress(void)
Check if a SIL-SA transaction is in progress.
Definition: agt_sil.c:8689
ERR_INTERNAL_MEM
@ ERR_INTERNAL_MEM
003
Definition: status_enum.h:193
val_child.h
Value Node Child Access Support.
ERR_INTERNAL_INIT_SEQ
@ ERR_INTERNAL_INIT_SEQ
007
Definition: status_enum.h:197
get_error_string
const char * get_error_string(status_t res)
Get the error message for a specific internal error.
Definition: status.c:239
AGT_YP_GNMI
#define AGT_YP_GNMI
YP-GNMI service name for YControl.
Definition: agt.h:421
log_debug
void void void void void void void log_debug(const char *fstr,...) __attribute__((format(printf
Generate a new LOG_DEBUG_DEBUG log entry.
typ.h
Parameter Type Handler.
dlq_nextEntry
#define dlq_nextEntry(nodeP)
get the next queue entry after the current entry
Definition: dlq.h:265
agt.h
Multi-Protocol Network Management Server.
agt_make_leaf
val_value_t * agt_make_leaf(obj_template_t *parentobj, const xmlChar *leafname, const xmlChar *leafstrval, status_t *res)
make a string val_value_t struct for a specified leaf or leaf-list
Definition: agt_util.c:3683
ERR_NCX_RESOURCE_DENIED
@ ERR_NCX_RESOURCE_DENIED
269
Definition: status_enum.h:310
agt_ypgnmi_set.h
YP-GNMI SET request support module.
val_make_sprintf_string
xmlChar * val_make_sprintf_string(const val_value_t *val)
Malloc a buffer and then sprintf the xmlChar string NETCONF representation of a simple value.
Definition: val.c:10323
op_editop_name
const xmlChar * op_editop_name(op_editop_t ed_id)
Get the keyword for the specified op_editop_t enumeration.
Definition: op.c:106
ERR_NCX_NOT_FOUND
@ ERR_NCX_NOT_FOUND
225
Definition: status_enum.h:264
ERR_NCX_OPERATION_NOT_SUPPORTED
@ ERR_NCX_OPERATION_NOT_SUPPORTED
273
Definition: status_enum.h:314
YCONTROL_MSG_SERVER_RESPONSE
@ YCONTROL_MSG_SERVER_RESPONSE
server-response sent from server to subsystem
Definition: ycontrol_types.h:75
agt_acm_clear_msg_cache
void agt_acm_clear_msg_cache(xml_msg_hdr_t *msg)
Clear an agt_acm_cache_t struct attached to the specified message.
Definition: agt_acm.c:734
obj_find_child
obj_template_t * obj_find_child(obj_template_t *obj, const xmlChar *modname, const xmlChar *objname)
Find a child object with the specified Qname.
Definition: obj.c:6116
tstamp_datetime
void tstamp_datetime(xmlChar *buff)
Set the current date and time in an XML dateTime string format.
Definition: tstamp.c:160
ycontrol_msg_cmn.h
YControl Message Utilities.
get_first_edit_entry
ypgnmi_edit_t * get_first_edit_entry(ypgnmi_edit_cb_t *cb)
Get the first edit entry in editsQ.
Definition: ypgnmi.c:142
LOGDEBUG4
#define LOGDEBUG4
Check if at least log-level=debug4.
Definition: log.h:302
log.h
NCX System Logging Manager.
log_flush
void log_flush(void)
Flush output buffers.
Definition: log.c:1880
ncxtypes.h
YANG module data structures Many internal representations of YANG module constructs.
agt_ncx_load.h
NETCONF Server load and unload operations.
obj_is_leaf
boolean obj_is_leaf(const obj_template_t *obj)
Check if object is a proper leaf.
Definition: obj.c:13323
ypgnmi.h
YP-GNMI requests support module.
agt_cli.h
NETCONF Server Command Line Interface handler.
rpc_new_msg
rpc_msg_t * rpc_new_msg(void)
Malloc and initialize a new rpc_msg_t struct.
Definition: rpc.c:84
LOGDEBUG
#define LOGDEBUG
Check if at least log-level=debug.
Definition: log.h:287
YCONTROL_MSG_SUBSYS_EVENT
@ YCONTROL_MSG_SUBSYS_EVENT
subsystem-event sent from subsystem to server
Definition: ycontrol_types.h:78
get_next_edit_entry
ypgnmi_edit_t * get_next_edit_entry(ypgnmi_edit_t *entry)
Get the next edit entry in the editsQ.
Definition: ypgnmi.c:169
agt_cfg.h
Manage Server configuration edit transactions.
dlq_deque
void * dlq_deque(dlq_hdrT *listP)
remove the first queue node from the queue list
Definition: dlq.c:286
val_get_first_child
val_value_t * val_get_first_child(const val_value_t *parent)
Get the first child node.
Definition: val.c:8477
AGT_YP_GNMI_MOD
#define AGT_YP_GNMI_MOD
YANG module used for YP-GNMI service messages.
Definition: agt.h:445
agt_acm.h
NETCONF Server Access Control Entry Points.
rpc_free_msg
void rpc_free_msg(rpc_msg_t *msg)
Free all the memory used by the specified rpc_msg_t.
Definition: rpc.c:152
log_debug2_append
void void void void void void void void void void log_debug2_append(const char *fstr,...) __attribute__((format(printf
Append to a LOG_DEBUG_DEBUG2 log entry.
agt_get_profile
agt_profile_t * agt_get_profile(void)
Get the server profile struct.
Definition: agt.c:4118
ses_set_gnmi_session
void ses_set_gnmi_session(ses_cb_t *scb)
Set the specified session as a gNMI session.
Definition: ses.c:4746
agt_ypgnmi_init
status_t agt_ypgnmi_init(void)
Initialize the YP-GNMI subsysystem handler.
Definition: agt_ypgnmi.c:1865
dlq_firstEntry
#define dlq_firstEntry(listP)
get the first entry in the queue list
Definition: dlq.h:337
val_new_value
val_value_t * val_new_value(void)
Malloc and initialize the fields in a val_value_t.
Definition: val.c:2697
VAL_OBJ
#define VAL_OBJ(V)
Access the object template.
Definition: val.h:381
ncx.h
YANG module utility functions.
agt_ycontrol_send_payload
status_t agt_ycontrol_send_payload(ses_cb_t *scb, const xmlChar *service_id, uint32 *msgid, ycontrol_msgtype_t msgtype, val_value_t *service_payload, boolean with_ywattrs)
Send the subsystem <ycontrol> message to the sevice manager on the specified session,...
Definition: agt_ycontrol.c:1312
xml_attrs_t
dlq_hdr_t xml_attrs_t
queue of xml_attr_t
Definition: xml_util.h:151
obj.h
Data Object Support.
TSTAMP_MIN_SIZE
#define TSTAMP_MIN_SIZE
normal minimum buffer size for a tstamp buffer
Definition: tstamp.h:67
ses_set_out_encoding
void ses_set_out_encoding(ses_cb_t *scb, ncx_display_mode_t encoding)
Set the output encoding.
Definition: ses.c:4084
agt_ycontrol.h
Handle the YumaPro Control Protocol <ycontrol> (top-level) element.
val_init_from_template
void val_init_from_template(val_value_t *val, struct obj_template_t_ *obj)
Initialize a value node from its object template.
YCONTROL_MSG_SUBSYS_RESPONSE
@ YCONTROL_MSG_SUBSYS_RESPONSE
subsystem-response sent from subsystem to server
Definition: ycontrol_types.h:84
YCONTROL_MSGBODY_PAYLOAD
@ YCONTROL_MSGBODY_PAYLOAD
payload message
Definition: ycontrol_types.h:93
val_child_next_same
val_value_t * val_child_next_same(val_value_t *curnode)
Get the next node of the same type.
Definition: val_child.c:2359
VAL_STR
#define VAL_STR(V)
Access the value as a string ONLY if typ_is_string() is true.
Definition: val.h:464
ncx_find_module
ncx_module_t * ncx_find_module(const xmlChar *modname, const xmlChar *revision)
Find a ncx_module_t in the ncx_sesmodQ.
Definition: ncx.c:3227
SET_ERROR
#define SET_ERROR(E)
macro SET_ERROR
Definition: status_enum.h:103
agt_ypgnmi_cleanup
void agt_ypgnmi_cleanup(void)
Cleanup the YP-GNMI Module.
Definition: agt_ypgnmi.c:1907
agt_ycontrol_get_obj
obj_template_t * agt_ycontrol_get_obj(void)
Get the ycontrol container object.
Definition: agt_ycontrol.c:1927
NCX_DISPLAY_MODE_JSON
@ NCX_DISPLAY_MODE_JSON
JSON (RFC 7951 format)
Definition: ncxtypes.h:466
xmlns.h
XML namespace support.
val_free_value
void val_free_value(val_value_t *val)
Scrub the memory in a val_value_t by freeing all the sub-fields and then freeing the entire struct it...
Definition: val.c:2842
agt_cli_get_valset
val_value_t * agt_cli_get_valset(void)
Retrieve the command line parameter set from boot time.
Definition: agt_cli.c:3427
status.h
Global error messages for status code enumerations.
xpath_convert_url_to_path
xmlChar * xpath_convert_url_to_path(const xmlChar *urlpath, ncx_name_match_t match_names, boolean alt_naming, boolean wildcards, boolean withkeys, boolean fullkeys, boolean withmod, ncx_protocol_t proto, status_t *res)
Convert a URL format path to XPath format path.
Definition: xpath.c:4374
dlq.h
dlq provides general double-linked list and queue support:
agt_ypgnmi_get.h
YP-GNMI GET request support module.