* Fixed: [comma in yang list name will lead to cli setting error #186](https://github.com/clicon/clixon/issues/186)
This commit is contained in:
parent
a8d29b1e7e
commit
608f298ed9
11 changed files with 94 additions and 48 deletions
|
|
@ -50,6 +50,7 @@ Developers may need to change their code
|
||||||
|
|
||||||
### Corrected Bugs
|
### Corrected Bugs
|
||||||
|
|
||||||
|
* Fixed: [comma in yang list name will lead to cli setting error #186](https://github.com/clicon/clixon/issues/186)
|
||||||
* Reverted blocked signal behavior introduced in 5.0.
|
* Reverted blocked signal behavior introduced in 5.0.
|
||||||
|
|
||||||
## 5.0.0
|
## 5.0.0
|
||||||
|
|
|
||||||
|
|
@ -214,7 +214,7 @@ get_user_cookie(char *cookiestr,
|
||||||
cvec *cvv = NULL;
|
cvec *cvv = NULL;
|
||||||
char *c;
|
char *c;
|
||||||
|
|
||||||
if (str2cvec(cookiestr, ';', '=', &cvv) < 0)
|
if (uri_str2cvec(cookiestr, ';', '=', 1, &cvv) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if ((c = cvec_find_str(cvv, attribute)) != NULL){
|
if ((c = cvec_find_str(cvv, attribute)) != NULL){
|
||||||
if ((*val = strdup(c)) == NULL)
|
if ((*val = strdup(c)) == NULL)
|
||||||
|
|
|
||||||
|
|
@ -363,7 +363,7 @@ evhtp_params_set(clicon_handle h,
|
||||||
goto done;
|
goto done;
|
||||||
/* SSL subject fields, eg CN (Common Name) , can add more here? */
|
/* SSL subject fields, eg CN (Common Name) , can add more here? */
|
||||||
if ((subject = (char*)htp_sslutil_subject_tostr(req->conn->ssl)) != NULL){
|
if ((subject = (char*)htp_sslutil_subject_tostr(req->conn->ssl)) != NULL){
|
||||||
if (str2cvec(subject, '/', '=', &cvv) < 0)
|
if (uri_str2cvec(subject, '/', '=', 1, &cvv) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if ((cn = cvec_find_str(cvv, "CN")) != NULL){
|
if ((cn = cvec_find_str(cvv, "CN")) != NULL){
|
||||||
if (restconf_param_set(h, "SSL_CN", cn) < 0)
|
if (restconf_param_set(h, "SSL_CN", cn) < 0)
|
||||||
|
|
|
||||||
|
|
@ -537,7 +537,7 @@ main(int argc,
|
||||||
cvec *qvec = NULL;
|
cvec *qvec = NULL;
|
||||||
query = restconf_param_get(h, "QUERY_STRING");
|
query = restconf_param_get(h, "QUERY_STRING");
|
||||||
if (query != NULL && strlen(query))
|
if (query != NULL && strlen(query))
|
||||||
if (str2cvec(query, '&', '=', &qvec) < 0)
|
if (uri_str2cvec(query, '&', '=', 1, &qvec) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
api_root_restconf(h, req, qvec); /* This is the function */
|
api_root_restconf(h, req, qvec); /* This is the function */
|
||||||
if (qvec){
|
if (qvec){
|
||||||
|
|
@ -550,7 +550,7 @@ main(int argc,
|
||||||
cvec *qvec = NULL;
|
cvec *qvec = NULL;
|
||||||
query = restconf_param_get(h, "QUERY_STRING");
|
query = restconf_param_get(h, "QUERY_STRING");
|
||||||
if (query != NULL && strlen(query))
|
if (query != NULL && strlen(query))
|
||||||
if (str2cvec(query, '&', '=', &qvec) < 0)
|
if (uri_str2cvec(query, '&', '=', 1, &qvec) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
api_stream(h, req, qvec, stream_path, &finish);
|
api_stream(h, req, qvec, stream_path, &finish);
|
||||||
if (qvec){
|
if (qvec){
|
||||||
|
|
|
||||||
|
|
@ -452,7 +452,7 @@ api_root_restconf(clicon_handle h,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
clicon_debug(1, "%s: api_resource=%s", __FUNCTION__, api_resource);
|
clicon_debug(1, "%s: api_resource=%s", __FUNCTION__, api_resource);
|
||||||
if (str2cvec(path, '/', '=', &pcvec) < 0) /* rest url eg /album=ricky/foo */
|
if (uri_str2cvec(path, '/', '=', 1, &pcvec) < 0) /* rest url eg /album=ricky/foo */
|
||||||
goto done;
|
goto done;
|
||||||
/* data */
|
/* data */
|
||||||
if ((cb = restconf_get_indata(req)) == NULL) /* XXX NYI ACTUALLY not always needed, do this later? */
|
if ((cb = restconf_get_indata(req)) == NULL) /* XXX NYI ACTUALLY not always needed, do this later? */
|
||||||
|
|
|
||||||
|
|
@ -418,7 +418,7 @@ api_stream(clicon_handle h,
|
||||||
}
|
}
|
||||||
clicon_debug(1, "%s: method=%s", __FUNCTION__, method);
|
clicon_debug(1, "%s: method=%s", __FUNCTION__, method);
|
||||||
|
|
||||||
if (str2cvec(path, '/', '=', &pcvec) < 0) /* rest url eg /album=ricky/foo */
|
if (uri_str2cvec(path, '/', '=', 1, &pcvec) < 0) /* rest url eg /album=ricky/foo */
|
||||||
goto done;
|
goto done;
|
||||||
/* data */
|
/* data */
|
||||||
if ((cb = restconf_get_indata(req)) == NULL)
|
if ((cb = restconf_get_indata(req)) == NULL)
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ static inline char * strdup4(char *str)
|
||||||
char **clicon_strsep(char *string, char *delim, int *nvec0);
|
char **clicon_strsep(char *string, char *delim, int *nvec0);
|
||||||
char *clicon_strjoin (int argc, char **argv, char *delim);
|
char *clicon_strjoin (int argc, char **argv, char *delim);
|
||||||
int clixon_strsplit(char *nodeid, const int delim, char **prefix, char **id);
|
int clixon_strsplit(char *nodeid, const int delim, char **prefix, char **id);
|
||||||
int str2cvec(char *string, char delim1, char delim2, cvec **cvp);
|
int uri_str2cvec(char *string, char delim1, char delim2, int decode, cvec **cvp);
|
||||||
#if defined(__GNUC__) && __GNUC__ >= 3
|
#if defined(__GNUC__) && __GNUC__ >= 3
|
||||||
int uri_percent_encode(char **encp, const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
|
int uri_percent_encode(char **encp, const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
|
||||||
int xml_chardata_encode(char **escp, const char *fmt, ... ) __attribute__ ((format (printf, 2, 3)));
|
int xml_chardata_encode(char **escp, const char *fmt, ... ) __attribute__ ((format (printf, 2, 3)));
|
||||||
|
|
|
||||||
|
|
@ -607,7 +607,7 @@ api_path_fmt2xpath(char *api_path_fmt,
|
||||||
* cbuf *xpath = cbuf_new();
|
* cbuf *xpath = cbuf_new();
|
||||||
* cvec *cvv = NULL;
|
* cvec *cvv = NULL;
|
||||||
* cvec *nsc = NULL;
|
* cvec *nsc = NULL;
|
||||||
* if (str2cvec("www.foo.com/restconf/a/b=c", '/', '=', &cvv) < 0)
|
* if (uri_str2cvec("www.foo.com/restconf/a/b=c", '/', '=', 0, &cvv) < 0)
|
||||||
* err;
|
* err;
|
||||||
* if ((ret = api_path2xpath_cvv(yspec, cvv, 0, cxpath, &nsc, NULL)) < 0)
|
* if ((ret = api_path2xpath_cvv(yspec, cvv, 0, cxpath, &nsc, NULL)) < 0)
|
||||||
* err;
|
* err;
|
||||||
|
|
@ -653,6 +653,8 @@ api_path2xpath_cvv(cvec *api_path,
|
||||||
cbuf *cberr = NULL;
|
cbuf *cberr = NULL;
|
||||||
char *namespace = NULL;
|
char *namespace = NULL;
|
||||||
cvec *nsc = NULL;
|
cvec *nsc = NULL;
|
||||||
|
char *val1;
|
||||||
|
char *decval;
|
||||||
|
|
||||||
cprintf(xpath, "/");
|
cprintf(xpath, "/");
|
||||||
/* Initialize namespace context */
|
/* Initialize namespace context */
|
||||||
|
|
@ -712,6 +714,7 @@ api_path2xpath_cvv(cvec *api_path,
|
||||||
}
|
}
|
||||||
/* Check if has value, means '=' */
|
/* Check if has value, means '=' */
|
||||||
if (cv2str(cv, NULL, 0) > 0){
|
if (cv2str(cv, NULL, 0) > 0){
|
||||||
|
/* val is uri percent encoded, eg x%2Cy,z */
|
||||||
if ((val = cv2str_dup(cv)) == NULL)
|
if ((val = cv2str_dup(cv)) == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
switch (yang_keyword_get(y)){
|
switch (yang_keyword_get(y)){
|
||||||
|
|
@ -737,7 +740,15 @@ api_path2xpath_cvv(cvec *api_path,
|
||||||
cprintf(xpath, "[");
|
cprintf(xpath, "[");
|
||||||
if (xprefix)
|
if (xprefix)
|
||||||
cprintf(xpath, "%s:", xprefix);
|
cprintf(xpath, "%s:", xprefix);
|
||||||
cprintf(xpath, "%s='%s']", cv_string_get(cvi), valvec[vi++]);
|
val1 = valvec[vi++];
|
||||||
|
/* valvec is uri encoded, needs decoding */
|
||||||
|
if (uri_percent_decode(val1, &decval) < 0)
|
||||||
|
goto done;
|
||||||
|
cprintf(xpath, "%s='%s']", cv_string_get(cvi), decval);
|
||||||
|
if (decval){
|
||||||
|
free(decval);
|
||||||
|
decval = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Y_LEAF_LIST: /* XXX: LOOP? */
|
case Y_LEAF_LIST: /* XXX: LOOP? */
|
||||||
|
|
@ -837,8 +848,9 @@ api_path2xpath(char *api_path,
|
||||||
clicon_err(OE_XML, EINVAL, "api_path is NULL");
|
clicon_err(OE_XML, EINVAL, "api_path is NULL");
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
/* Split api-path into cligen variable vector */
|
/* Split api-path into cligen variable vector,
|
||||||
if (str2cvec(api_path, '/', '=', &cvv) < 0)
|
* dont decode since api_path2xpath_cvv takes uri encode as input */
|
||||||
|
if (uri_str2cvec(api_path, '/', '=', 0, &cvv) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if ((xpath = cbuf_new()) == NULL)
|
if ((xpath = cbuf_new()) == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
@ -896,8 +908,7 @@ api_path2xml_vec(char **vec,
|
||||||
char *nodeid;
|
char *nodeid;
|
||||||
char *name = NULL;
|
char *name = NULL;
|
||||||
char *prefix = NULL;
|
char *prefix = NULL;
|
||||||
char *restval = NULL;
|
char *restval;
|
||||||
char *restval_enc;
|
|
||||||
cxobj *xn = NULL; /* new */
|
cxobj *xn = NULL; /* new */
|
||||||
cxobj *xb; /* body */
|
cxobj *xb; /* body */
|
||||||
cvec *cvk = NULL; /* vector of index keys */
|
cvec *cvk = NULL; /* vector of index keys */
|
||||||
|
|
@ -912,6 +923,7 @@ api_path2xml_vec(char **vec,
|
||||||
yang_stmt *ykey;
|
yang_stmt *ykey;
|
||||||
char *namespace = NULL;
|
char *namespace = NULL;
|
||||||
cbuf *cberr = NULL;
|
cbuf *cberr = NULL;
|
||||||
|
char *val = NULL;
|
||||||
|
|
||||||
if ((nodeid = vec[0]) == NULL || strlen(nodeid)==0){
|
if ((nodeid = vec[0]) == NULL || strlen(nodeid)==0){
|
||||||
if (xbotp)
|
if (xbotp)
|
||||||
|
|
@ -925,11 +937,9 @@ api_path2xml_vec(char **vec,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
/* restval is RFC 3896 encoded */
|
/* restval is RFC 3896 encoded */
|
||||||
if ((restval_enc = index(nodeid, '=')) != NULL){
|
if ((restval = index(nodeid, '=')) != NULL){
|
||||||
*restval_enc = '\0';
|
*restval = '\0';
|
||||||
restval_enc++;
|
restval++;
|
||||||
if (uri_percent_decode(restval_enc, &restval) < 0)
|
|
||||||
goto done;
|
|
||||||
}
|
}
|
||||||
/* Split into prefix and localname */
|
/* Split into prefix and localname */
|
||||||
if (nodeid_split(nodeid, &prefix, &name) < 0)
|
if (nodeid_split(nodeid, &prefix, &name) < 0)
|
||||||
|
|
@ -986,7 +996,11 @@ api_path2xml_vec(char **vec,
|
||||||
xml_spec_set(x, y);
|
xml_spec_set(x, y);
|
||||||
if ((xb = xml_new("body", x, CX_BODY)) == NULL)
|
if ((xb = xml_new("body", x, CX_BODY)) == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
if (restval && xml_value_set(xb, restval) < 0)
|
if (restval){
|
||||||
|
if (uri_percent_decode(restval, &val) < 0)
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
if (val && xml_value_set(xb, val) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
break;
|
break;
|
||||||
case Y_LIST:
|
case Y_LIST:
|
||||||
|
|
@ -1007,6 +1021,7 @@ api_path2xml_vec(char **vec,
|
||||||
else{
|
else{
|
||||||
/* Transform restval "a,b,c" to "a" "b" "c" (nvalvec=3)
|
/* Transform restval "a,b,c" to "a" "b" "c" (nvalvec=3)
|
||||||
* Note that vnr can be < length of cvk, due to empty or unset values
|
* Note that vnr can be < length of cvk, due to empty or unset values
|
||||||
|
* Note also that valvec entries are encoded
|
||||||
*/
|
*/
|
||||||
if ((valvec = clicon_strsep(restval, ",", &nvalvec)) == NULL)
|
if ((valvec = clicon_strsep(restval, ",", &nvalvec)) == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
@ -1044,8 +1059,16 @@ api_path2xml_vec(char **vec,
|
||||||
if ((xb = xml_new("body", xn, CX_BODY)) == NULL)
|
if ((xb = xml_new("body", xn, CX_BODY)) == NULL)
|
||||||
goto done;
|
goto done;
|
||||||
if (vi++ < nvalvec){
|
if (vi++ < nvalvec){
|
||||||
if (xml_value_set(xb, valvec[vi-1]) < 0)
|
/* Here assign and decode key values */
|
||||||
|
val = NULL;
|
||||||
|
if (uri_percent_decode(valvec[vi-1], &val) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
if (xml_value_set(xb, val) < 0)
|
||||||
|
goto done;
|
||||||
|
if (val){
|
||||||
|
free(val);
|
||||||
|
val = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1078,10 +1101,10 @@ api_path2xml_vec(char **vec,
|
||||||
free(prefix);
|
free(prefix);
|
||||||
if (name)
|
if (name)
|
||||||
free(name);
|
free(name);
|
||||||
if (restval)
|
|
||||||
free(restval);
|
|
||||||
if (valvec)
|
if (valvec)
|
||||||
free(valvec);
|
free(valvec);
|
||||||
|
if (val)
|
||||||
|
free(val);
|
||||||
return retval;
|
return retval;
|
||||||
fail:
|
fail:
|
||||||
retval = 0; /* invalid api-path or XML */
|
retval = 0; /* invalid api-path or XML */
|
||||||
|
|
|
||||||
|
|
@ -314,6 +314,10 @@ uri_percent_decode(char *enc,
|
||||||
int len;
|
int len;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
|
||||||
|
if (enc == NULL){
|
||||||
|
clicon_err(OE_UNIX, EINVAL, "enc is NULL");
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
/* This is max */
|
/* This is max */
|
||||||
len = strlen(enc)+1;
|
len = strlen(enc)+1;
|
||||||
if ((str = malloc(len)) == NULL){
|
if ((str = malloc(len)) == NULL){
|
||||||
|
|
@ -539,17 +543,20 @@ xml_chardata_cbuf_append(cbuf *cb,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Split a string into a cligen variable vector using 1st and 2nd delimiter
|
/*! Split a string into a cligen variable vector using 1st and 2nd delimiter
|
||||||
* Split a string first into elements delimited by delim1, then into
|
*
|
||||||
* pairs delimited by delim2.
|
* (1) Split a string into elements delimited by delim1,
|
||||||
|
* (2) split elements into pairs delimited by delim2,
|
||||||
|
* (3) Optionally URI-decode values
|
||||||
* @param[in] string String to split
|
* @param[in] string String to split
|
||||||
* @param[in] delim1 First delimiter char that delimits between elements
|
* @param[in] delim1 First delimiter char that delimits between elements
|
||||||
* @param[in] delim2 Second delimiter char for pairs within an element
|
* @param[in] delim2 Second delimiter char for pairs within an element
|
||||||
|
* @param[in] decode If set, URI decode values. The caller may want to decode, or add another level
|
||||||
* @param[out] cvp Created cligen variable vector, deallocate w cvec_free
|
* @param[out] cvp Created cligen variable vector, deallocate w cvec_free
|
||||||
* @retval 0 OK
|
* @retval 0 OK
|
||||||
* @retval -1 error
|
* @retval -1 error
|
||||||
* @code
|
* @code
|
||||||
* cvec *cvv = NULL;
|
* cvec *cvv = NULL;
|
||||||
* if (str2cvec("a=b&c=d", ';', '=', &cvv) < 0)
|
* if (uri_str2cvec("a=b&c=d", ';', '=', 1, &cvv) < 0)
|
||||||
* err;
|
* err;
|
||||||
* @endcode
|
* @endcode
|
||||||
*
|
*
|
||||||
|
|
@ -558,9 +565,10 @@ xml_chardata_cbuf_append(cbuf *cb,
|
||||||
* XXX differentiate between error and null cvec.
|
* XXX differentiate between error and null cvec.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
str2cvec(char *string,
|
uri_str2cvec(char *string,
|
||||||
char delim1,
|
char delim1,
|
||||||
char delim2,
|
char delim2,
|
||||||
|
int decode,
|
||||||
cvec **cvp)
|
cvec **cvp)
|
||||||
{
|
{
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
|
@ -593,8 +601,15 @@ str2cvec(char *string,
|
||||||
*(snext++) = '\0';
|
*(snext++) = '\0';
|
||||||
if ((val = index(s, delim2)) != NULL){
|
if ((val = index(s, delim2)) != NULL){
|
||||||
*(val++) = '\0';
|
*(val++) = '\0';
|
||||||
|
if (decode){
|
||||||
if (uri_percent_decode(val, &valu) < 0)
|
if (uri_percent_decode(val, &valu) < 0)
|
||||||
goto err;
|
goto err;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if ((valu = strdup(val)) == NULL){
|
||||||
|
clicon_err(OE_UNIX, errno, "strdup");
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
if ((cv = cvec_add(cvv, CGV_STRING)) == NULL){
|
if ((cv = cvec_add(cvv, CGV_STRING)) == NULL){
|
||||||
clicon_err(OE_UNIX, errno, "cvec_add");
|
clicon_err(OE_UNIX, errno, "cvec_add");
|
||||||
goto err;
|
goto err;
|
||||||
|
|
|
||||||
|
|
@ -2666,7 +2666,7 @@ yang_abs_schema_nodeid(yang_stmt *yn,
|
||||||
}
|
}
|
||||||
/* Split nodeid on the form /p0:i0/p1:i1 to a cvec with [name:p0 value:i0][...]
|
/* Split nodeid on the form /p0:i0/p1:i1 to a cvec with [name:p0 value:i0][...]
|
||||||
*/
|
*/
|
||||||
if (str2cvec(schema_nodeid, '/', ':', &nodeid_cvv) < 0)
|
if (uri_str2cvec(schema_nodeid, '/', ':', 1, &nodeid_cvv) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (cvec_len(nodeid_cvv) == 0)
|
if (cvec_len(nodeid_cvv) == 0)
|
||||||
goto ok;
|
goto ok;
|
||||||
|
|
@ -2749,7 +2749,7 @@ yang_desc_schema_nodeid(yang_stmt *yn,
|
||||||
}
|
}
|
||||||
/* Split nodeid on the form /p0:i0/p1:i1 to a cvec with [name:p0 value:i0][...]
|
/* Split nodeid on the form /p0:i0/p1:i1 to a cvec with [name:p0 value:i0][...]
|
||||||
*/
|
*/
|
||||||
if (str2cvec(schema_nodeid, '/', ':', &nodeid_cvv) < 0)
|
if (uri_str2cvec(schema_nodeid, '/', ':', 1, &nodeid_cvv) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (cvec_len(nodeid_cvv) == 0)
|
if (cvec_len(nodeid_cvv) == 0)
|
||||||
goto ok;
|
goto ok;
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ cat <<EOF > $cfg
|
||||||
<CLICON_SOCK>/usr/local/var/$APPNAME/$APPNAME.sock</CLICON_SOCK>
|
<CLICON_SOCK>/usr/local/var/$APPNAME/$APPNAME.sock</CLICON_SOCK>
|
||||||
<CLICON_BACKEND_PIDFILE>$dir/restconf.pidfile</CLICON_BACKEND_PIDFILE>
|
<CLICON_BACKEND_PIDFILE>$dir/restconf.pidfile</CLICON_BACKEND_PIDFILE>
|
||||||
<CLICON_XMLDB_DIR>/usr/local/var/$APPNAME</CLICON_XMLDB_DIR>
|
<CLICON_XMLDB_DIR>/usr/local/var/$APPNAME</CLICON_XMLDB_DIR>
|
||||||
|
<CLICON_MODULE_LIBRARY_RFC7895>false</CLICON_MODULE_LIBRARY_RFC7895>
|
||||||
$RESTCONFIG
|
$RESTCONFIG
|
||||||
</clixon-config>
|
</clixon-config>
|
||||||
EOF
|
EOF
|
||||||
|
|
@ -166,6 +167,12 @@ expectpart "$(curl $CURLOPTS -X PUT -H "Content-Type: application/yang-data+json
|
||||||
new "restconf PUT change list+leaf-list entry (expect fail)"
|
new "restconf PUT change list+leaf-list entry (expect fail)"
|
||||||
expectpart "$(curl $CURLOPTS -X PUT -H "Content-Type: application/yang-data+json" $RCPROTO://localhost/restconf/data/list:c/a=x,y/f=u -d '{"list:f":"w"}')" 0 '{"ietf-restconf:errors":{"error":{"error-type":"protocol","error-tag":"operation-failed","error-severity":"error","error-message":"api-path keys do not match data keys"}}}'
|
expectpart "$(curl $CURLOPTS -X PUT -H "Content-Type: application/yang-data+json" $RCPROTO://localhost/restconf/data/list:c/a=x,y/f=u -d '{"list:f":"w"}')" 0 '{"ietf-restconf:errors":{"error":{"error-type":"protocol","error-tag":"operation-failed","error-severity":"error","error-message":"api-path keys do not match data keys"}}}'
|
||||||
|
|
||||||
|
new "restconf PUT (x,y),z -> x%2Cy,z percent-encoded"
|
||||||
|
expectpart "$(curl $CURLOPTS -X PUT -H "Content-Type: application/yang-data+json" $RCPROTO://localhost/restconf/data/list:c/a=x%2Cy,z/nonkey -d '{"list:nonkey":"foo"}')" 0 "HTTP/1.1 201 Created"
|
||||||
|
|
||||||
|
new "restconf GET check percent-encoded"
|
||||||
|
expectpart "$(curl $CURLOPTS -X GET -H "Accept: application/yang-data+json" $RCPROTO://localhost/restconf/data/list:c/a=x%2Cy,z)" 0 "HTTP/1.1 200 OK" '{"list:a":\[{"b":"x,y","c":"z","nonkey":"foo"}\]}'
|
||||||
|
|
||||||
if [ $RC -ne 0 ]; then
|
if [ $RC -ne 0 ]; then
|
||||||
new "Kill restconf daemon"
|
new "Kill restconf daemon"
|
||||||
stop_restconf
|
stop_restconf
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue