Load netconf notification and add create-subscription to yang.

This commit is contained in:
Olof hagsand 2018-10-23 20:43:59 +02:00
parent 71eddeaa74
commit 77e56868d4
4 changed files with 51 additions and 4 deletions

View file

@ -91,16 +91,18 @@ process_incoming_packet(clicon_handle h,
cxobj *xret = NULL; /* Return (out) */
cxobj *xrpc;
cxobj *xc;
yang_spec *yspec;
clicon_debug(1, "RECV");
clicon_debug(2, "%s: RCV: \"%s\"", __FUNCTION__, cbuf_get(cb));
yspec = clicon_dbspec_yang(h);
if ((str0 = strdup(cbuf_get(cb))) == NULL){
clicon_log(LOG_ERR, "%s: strdup: %s", __FUNCTION__, strerror(errno));
return -1;
}
str = str0;
/* Parse incoming XML message */
if (xml_parse_string(str, NULL, &xreq) < 0){
if (xml_parse_string(str, yspec, &xreq) < 0){
if ((cbret = cbuf_new()) == NULL){
if (netconf_operation_failed(cbret, "rpc", "internal error")< 0)
goto done;

View file

@ -44,9 +44,9 @@ extern int xml_child_sort;
/*
* Prototypes
*/
int xml_child_spec(char *name, cxobj *xp, yang_spec *yspec, yang_stmt **yp);
int xml_cmp(const void* arg1, const void* arg2);
int xml_sort(cxobj *x0, void *arg);
int xml_child_spec(char *name, cxobj *xp, yang_spec *yspec, yang_stmt **yp);
int xml_cmp(const void* arg1, const void* arg2);
int xml_sort(cxobj *x0, void *arg);
cxobj *xml_search(cxobj *x, char *name, int yangi, enum rfc_6020 keyword, int keynr, char **keyvec, char **keyval);
int xml_insert_pos(cxobj *x0, char *name, int yangi, enum rfc_6020 keyword,
int keynr, char **keyvec, char **keyval, int low,

View file

@ -990,6 +990,8 @@ netconf_module_load(clicon_handle h)
/* Load yang spec */
if (yang_spec_parse_module(h, "ietf-netconf", CLIXON_DATADIR, NULL, yspec, NULL)< 0)
goto done;
if (yang_spec_parse_module(h, "ietf-netconf-notification", CLIXON_DATADIR, NULL, yspec, NULL)< 0)
goto done;
if ((xc = clicon_conf_xml(h)) == NULL){
clicon_err(OE_CFG, ENOENT, "Clicon configuration not loaded");
goto done;

View file

@ -91,4 +91,47 @@ module ietf-netconf-notification {
}
}
}
rpc create-subscription {
description
"The command to create a notification subscription. It
takes as argument the name of the notification stream
and filter. Both of those options
limit the content of the subscription. In addition,
there are two time-related parameters, startTime and
stopTime, which can be used to select the time interval
of interest to the notification replay feature.";
reference "RFC 5277, Section 2.1";
input {
leaf stream{
type string;
default "NETCONF";
description "An optional parameter, <stream>, that indicates which
stream of events is of interest. If not present, events in the
default NETCONF stream will be sent.";
}
leaf filter{
type string;
description "An optional parameter, <filter>, that indicates which
subset of all possible events is of interest. The format of this
parameter is the same as that of the filter parameter in the
NETCONF protocol operations. If not present, all events not
precluded by other parameters will be sent. See section 3.6
for more information on filters";
}
leaf startTime {
type date-and-time;
description "used to trigger the replay feature
and indicate that the replay should start at the time
specified. If <startTime> is not present, this is not a replay
subscription.";
}
leaf stopTime {
type date-and-time;
description "used with the optional
replay feature to indicate the newest notifications of
interest. If <stopTime> is not present, the notifications will
continue until the subscription is terminated.";
}
}
}
}