Reverted some of the nsc xpath API changes. In the revert, xpath_first() and xpath_vec() retain their old syntax with nsc==NULL.
The reason is to be conservative with the API. However, less used functions, such as xpath_vec_bool(), xpath_vec_ctx() and xpath_vec_flag() are changed with a new `nsc`parameter, which should be set to NULL in most cases.
This commit is contained in:
parent
89f751357d
commit
40d5b99d3b
32 changed files with 391 additions and 266 deletions
|
|
@ -140,7 +140,7 @@ netconf_get_config(clicon_handle h,
|
|||
cxobj *xconf;
|
||||
|
||||
/* ie <filter>...</filter> */
|
||||
if ((xfilter = xpath_first(xn, NULL, "filter")) != NULL)
|
||||
if ((xfilter = xpath_first(xn, "filter")) != NULL)
|
||||
ftype = xml_find_value(xfilter, "type");
|
||||
if (ftype == NULL || strcmp(ftype, "xpath")==0){
|
||||
if (clicon_rpc_netconf_xml(h, xml_parent(xn), xret, NULL) < 0)
|
||||
|
|
@ -154,8 +154,8 @@ netconf_get_config(clicon_handle h,
|
|||
if (clicon_rpc_netconf_xml(h, xml_parent(xn), xret, NULL) < 0)
|
||||
goto done;
|
||||
if (xfilter &&
|
||||
(xfilterconf = xpath_first(xfilter, NULL, "//configuration"))!= NULL &&
|
||||
(xconf = xpath_first(*xret, NULL, "/rpc-reply/data")) != NULL){
|
||||
(xfilterconf = xpath_first(xfilter, "//configuration"))!= NULL &&
|
||||
(xconf = xpath_first(*xret, "/rpc-reply/data")) != NULL){
|
||||
/* xml_filter removes parts of xml tree not matching */
|
||||
if ((strcmp(xml_name(xfilterconf), xml_name(xconf))!=0) ||
|
||||
xml_filter(xfilterconf, xconf) < 0){
|
||||
|
|
@ -208,7 +208,7 @@ get_edit_opts(cxobj *xn,
|
|||
cxobj *x;
|
||||
char *optstr;
|
||||
|
||||
if ((x = xpath_first(xn, NULL, "test-option")) != NULL){
|
||||
if ((x = xpath_first(xn, "test-option")) != NULL){
|
||||
if ((optstr = xml_body(x)) != NULL){
|
||||
if (strcmp(optstr, "test-then-set") == 0)
|
||||
*testopt = TEST_THEN_SET;
|
||||
|
|
@ -220,7 +220,7 @@ get_edit_opts(cxobj *xn,
|
|||
goto parerr;
|
||||
}
|
||||
}
|
||||
if ((x = xpath_first(xn, NULL, "error-option")) != NULL){
|
||||
if ((x = xpath_first(xn, "error-option")) != NULL){
|
||||
if ((optstr = xml_body(x)) != NULL){
|
||||
if (strcmp(optstr, "stop-on-error") == 0)
|
||||
*erropt = STOP_ON_ERROR;
|
||||
|
|
@ -352,7 +352,7 @@ netconf_get(clicon_handle h,
|
|||
cxobj *xconf;
|
||||
|
||||
/* ie <filter>...</filter> */
|
||||
if ((xfilter = xpath_first(xn, NULL, "filter")) != NULL)
|
||||
if ((xfilter = xpath_first(xn, "filter")) != NULL)
|
||||
ftype = xml_find_value(xfilter, "type");
|
||||
if (ftype == NULL || strcmp(ftype, "xpath")==0){
|
||||
if (clicon_rpc_netconf_xml(h, xml_parent(xn), xret, NULL) < 0)
|
||||
|
|
@ -366,8 +366,8 @@ netconf_get(clicon_handle h,
|
|||
if (clicon_rpc_netconf_xml(h, xml_parent(xn), xret, NULL) < 0)
|
||||
goto done;
|
||||
if (xfilter &&
|
||||
(xfilterconf = xpath_first(xfilter, NULL, "//configuration"))!= NULL &&
|
||||
(xconf = xpath_first(*xret, NULL, "/rpc-reply/data")) != NULL){
|
||||
(xfilterconf = xpath_first(xfilter, "//configuration"))!= NULL &&
|
||||
(xconf = xpath_first(*xret, "/rpc-reply/data")) != NULL){
|
||||
/* xml_filter removes parts of xml tree not matching */
|
||||
if ((strcmp(xml_name(xfilterconf), xml_name(xconf))!=0) ||
|
||||
xml_filter(xfilterconf, xconf) < 0){
|
||||
|
|
@ -448,7 +448,7 @@ netconf_notification_cb(int s,
|
|||
|
||||
if ((nsc = xml_nsctx_init(NULL, "urn:ietf:params:xml:ns:netconf:notification:1.0")) == NULL)
|
||||
goto done;
|
||||
if ((xn = xpath_first(xt, nsc, "notification")) == NULL)
|
||||
if ((xn = xpath_first_nsc(xt, nsc, "notification")) == NULL)
|
||||
goto ok;
|
||||
/* create netconf message */
|
||||
if ((cb = cbuf_new()) == NULL){
|
||||
|
|
@ -500,7 +500,7 @@ netconf_create_subscription(clicon_handle h,
|
|||
int s;
|
||||
char *ftype;
|
||||
|
||||
if ((xfilter = xpath_first(xn, NULL, "//filter")) != NULL){
|
||||
if ((xfilter = xpath_first(xn, "//filter")) != NULL){
|
||||
if ((ftype = xml_find_value(xfilter, "type")) != NULL){
|
||||
if (strcmp(ftype, "xpath") != 0){
|
||||
xml_parse_va(xret, NULL, "<rpc-reply><rpc-error>"
|
||||
|
|
@ -516,7 +516,7 @@ netconf_create_subscription(clicon_handle h,
|
|||
}
|
||||
if (clicon_rpc_netconf_xml(h, xml_parent(xn), xret, &s) < 0)
|
||||
goto done;
|
||||
if (xpath_first(*xret, NULL, "rpc-reply/rpc-error") != NULL)
|
||||
if (xpath_first(*xret, "rpc-reply/rpc-error") != NULL)
|
||||
goto ok;
|
||||
if (event_reg_fd(s,
|
||||
netconf_notification_cb,
|
||||
|
|
@ -622,7 +622,7 @@ netconf_application_rpc(clicon_handle h,
|
|||
*/
|
||||
if (0)
|
||||
if ((youtput = yang_find(yrpc, Y_OUTPUT, NULL)) != NULL){
|
||||
xoutput=xpath_first(*xret, NULL, "/");
|
||||
xoutput=xpath_first(*xret, "/");
|
||||
xml_spec_set(xoutput, youtput); /* needed for xml_spec_populate */
|
||||
if (xml_apply(xoutput, CX_ELMNT, xml_spec_populate, yspec) < 0)
|
||||
goto done;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue