- Updated code to clixon 5.2 status
- Added LIST_PAGINATION clixon_custom constant - Fix: leafs added as augments on rpc input/output lacked cv:s
This commit is contained in:
parent
2485bec483
commit
77bacc93bb
13 changed files with 87 additions and 33 deletions
|
|
@ -101,6 +101,7 @@ Users may have to change how they access the system
|
||||||
* YANG when was not properly implemented for default values
|
* YANG when was not properly implemented for default values
|
||||||
* Fixed: SEGV in clixon_netconf_lib functions from internal errors including validation.
|
* Fixed: SEGV in clixon_netconf_lib functions from internal errors including validation.
|
||||||
* Check xerr argument both before and after call on netconf lib functions
|
* Check xerr argument both before and after call on netconf lib functions
|
||||||
|
* Fixed: Leafs added as augments on NETCONF RPC input/output lacked cv:s causing error in default handling
|
||||||
* Fixed: RFC 8040 yang-data extension allows non-key lists
|
* Fixed: RFC 8040 yang-data extension allows non-key lists
|
||||||
* Added YANG_FLAG_NOKEY as exception to mandatory key lists
|
* Added YANG_FLAG_NOKEY as exception to mandatory key lists
|
||||||
* Fixed: mandatory leaf in a uses statement caused abort
|
* Fixed: mandatory leaf in a uses statement caused abort
|
||||||
|
|
|
||||||
|
|
@ -1335,6 +1335,7 @@ from_client_kill_session(clicon_handle h,
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef LIST_PAGINATION
|
||||||
/*! Help function for parsing restconf query parameter and setting netconf attribute
|
/*! Help function for parsing restconf query parameter and setting netconf attribute
|
||||||
*
|
*
|
||||||
* If not "unbounded", parse and set a numeric value
|
* If not "unbounded", parse and set a numeric value
|
||||||
|
|
@ -1660,6 +1661,7 @@ from_client_get_pageable_list(clicon_handle h,
|
||||||
xml_free(xret);
|
xml_free(xret);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
#endif /* LIST_PAGINATION */
|
||||||
|
|
||||||
/*! Create a notification subscription
|
/*! Create a notification subscription
|
||||||
* @param[in] h Clicon handle
|
* @param[in] h Clicon handle
|
||||||
|
|
@ -2286,10 +2288,12 @@ backend_rpc_init(clicon_handle h)
|
||||||
if (rpc_callback_register(h, from_client_validate, NULL,
|
if (rpc_callback_register(h, from_client_validate, NULL,
|
||||||
NETCONF_BASE_NAMESPACE, "validate") < 0)
|
NETCONF_BASE_NAMESPACE, "validate") < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
#ifdef LIST_PAGINATION
|
||||||
/* draft-ietf-netconf-restconf-collection-00 */
|
/* draft-ietf-netconf-restconf-collection-00 */
|
||||||
if (rpc_callback_register(h, from_client_get_pageable_list, NULL,
|
if (rpc_callback_register(h, from_client_get_pageable_list, NULL,
|
||||||
NETCONF_COLLECTION_NAMESPACE, "get-pageable-list") < 0)
|
NETCONF_COLLECTION_NAMESPACE, "get-pageable-list") < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
#endif
|
||||||
/* In backend_client.? RPC from RFC 5277 */
|
/* In backend_client.? RPC from RFC 5277 */
|
||||||
if (rpc_callback_register(h, from_client_create_subscription, NULL,
|
if (rpc_callback_register(h, from_client_create_subscription, NULL,
|
||||||
EVENT_RFC5277_NAMESPACE, "create-subscription") < 0)
|
EVENT_RFC5277_NAMESPACE, "create-subscription") < 0)
|
||||||
|
|
|
||||||
|
|
@ -1312,6 +1312,7 @@ cli_help(clicon_handle h, cvec *vars, cvec *argv)
|
||||||
return cligen_help(ch, stdout, pt);
|
return cligen_help(ch, stdout, pt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef LIST_PAGINATION
|
||||||
/*! Show pagination/collection
|
/*! Show pagination/collection
|
||||||
* XXX: This is hardcoded only for test_pagination.sh
|
* XXX: This is hardcoded only for test_pagination.sh
|
||||||
* @param[in] h Clicon handle
|
* @param[in] h Clicon handle
|
||||||
|
|
@ -1383,4 +1384,12 @@ cli_pagination(clicon_handle h, cvec *vars, cvec *argv)
|
||||||
cbuf_free(cb);
|
cbuf_free(cb);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
int
|
||||||
|
cli_pagination(clicon_handle h, cvec *vars, cvec *argv)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Not yet implemented\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif /* LIST_PAGINATION */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -309,6 +309,8 @@ api_return_err(clicon_handle h,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: /* Just ignore the body so that there is a reply */
|
default: /* Just ignore the body so that there is a reply */
|
||||||
|
clicon_err(OE_YANG, EINVAL, "Invalid media type %d", media);
|
||||||
|
goto done;
|
||||||
break;
|
break;
|
||||||
} /* switch media */
|
} /* switch media */
|
||||||
assert(cbuf_len(cb));
|
assert(cbuf_len(cb));
|
||||||
|
|
|
||||||
|
|
@ -311,6 +311,7 @@ api_data_get2(clicon_handle h,
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef LIST_PAGINATION
|
||||||
/*! GET Collection
|
/*! GET Collection
|
||||||
* According to restconf collection draft. Lists, work in progress
|
* According to restconf collection draft. Lists, work in progress
|
||||||
* @param[in] h Clixon handle
|
* @param[in] h Clixon handle
|
||||||
|
|
@ -528,6 +529,7 @@ api_data_collection(clicon_handle h,
|
||||||
free(xvec);
|
free(xvec);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
#endif /* LIST_PAGINATION */
|
||||||
|
|
||||||
/*! REST HEAD method
|
/*! REST HEAD method
|
||||||
* @param[in] h Clixon handle
|
* @param[in] h Clixon handle
|
||||||
|
|
@ -605,8 +607,13 @@ api_data_get(clicon_handle h,
|
||||||
break;
|
break;
|
||||||
case YANG_COLLECTION_XML:
|
case YANG_COLLECTION_XML:
|
||||||
case YANG_COLLECTION_JSON:
|
case YANG_COLLECTION_JSON:
|
||||||
|
#ifdef LIST_PAGINATION
|
||||||
if (api_data_collection(h, req, api_path, pcvec, pi, qvec, pretty, media_out) < 0)
|
if (api_data_collection(h, req, api_path, pcvec, pi, qvec, pretty, media_out) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
#else
|
||||||
|
if (restconf_notimplemented(h, req, pretty, media_out) < 0)
|
||||||
|
goto done;
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -117,3 +117,10 @@
|
||||||
* Remove this when regression test
|
* Remove this when regression test
|
||||||
*/
|
*/
|
||||||
#undef YANG_PATCH
|
#undef YANG_PATCH
|
||||||
|
|
||||||
|
/*! Enable list pagination drafts
|
||||||
|
* draft-wwlh-netconf-list-pagination-00,
|
||||||
|
* draft-wwlh-netconf-list-pagination-nc-00
|
||||||
|
* draft-wwlh-netconf-list-pagination-rc-00
|
||||||
|
*/
|
||||||
|
#define LIST_PAGINATION
|
||||||
|
|
|
||||||
|
|
@ -1526,9 +1526,11 @@ netconf_module_load(clicon_handle h)
|
||||||
if (clicon_option_bool(h, "CLICON_NETCONF_MESSAGE_ID_OPTIONAL") == 1)
|
if (clicon_option_bool(h, "CLICON_NETCONF_MESSAGE_ID_OPTIONAL") == 1)
|
||||||
xml_bind_netconf_message_id_optional(1);
|
xml_bind_netconf_message_id_optional(1);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef LIST_PAGINATION
|
||||||
/* Load netconf list pagination */
|
/* Load netconf list pagination */
|
||||||
if (yang_spec_parse_module(h, "ietf-netconf-list-pagination", NULL, yspec)< 0)
|
if (yang_spec_parse_module(h, "ietf-netconf-list-pagination", NULL, yspec)< 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
#endif
|
||||||
retval = 0;
|
retval = 0;
|
||||||
done:
|
done:
|
||||||
return retval;
|
return retval;
|
||||||
|
|
|
||||||
|
|
@ -878,6 +878,7 @@ clicon_rpc_get(clicon_handle h,
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef LIST_PAGINATION
|
||||||
/*! Get database configuration and state data collection
|
/*! Get database configuration and state data collection
|
||||||
* @param[in] h Clicon handle
|
* @param[in] h Clicon handle
|
||||||
* @param[in] xpath To identify a list/leaf-list
|
* @param[in] xpath To identify a list/leaf-list
|
||||||
|
|
@ -939,6 +940,7 @@ clicon_rpc_get_pageable_list(clicon_handle h,
|
||||||
cprintf(cb, " username=\"%s\"", username);
|
cprintf(cb, " username=\"%s\"", username);
|
||||||
cprintf(cb, " xmlns:%s=\"%s\"",
|
cprintf(cb, " xmlns:%s=\"%s\"",
|
||||||
NETCONF_BASE_PREFIX, NETCONF_BASE_NAMESPACE);
|
NETCONF_BASE_PREFIX, NETCONF_BASE_NAMESPACE);
|
||||||
|
cprintf(cb, " %s", NETCONF_MESSAGE_ID_ATTR);
|
||||||
cprintf(cb, "><get-pageable-list xmlns=\"%s\"", NETCONF_COLLECTION_NAMESPACE);
|
cprintf(cb, "><get-pageable-list xmlns=\"%s\"", NETCONF_COLLECTION_NAMESPACE);
|
||||||
/* Clixon extension, content=all,config, or nonconfig */
|
/* Clixon extension, content=all,config, or nonconfig */
|
||||||
if ((int)content != -1)
|
if ((int)content != -1)
|
||||||
|
|
@ -1012,6 +1014,7 @@ clicon_rpc_get_pageable_list(clicon_handle h,
|
||||||
free(msg);
|
free(msg);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
#endif /* LIST_PAGINATION */
|
||||||
|
|
||||||
/*! Send a close a netconf user session. Socket is also closed if still open
|
/*! Send a close a netconf user session. Socket is also closed if still open
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -199,8 +199,9 @@ ys_grouping_resolve(yang_stmt *yuses,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! This is an augment node, augment the original datamodel.
|
/*! This is an augment node, augment the original datamodel.
|
||||||
* @param[in] ys The augment statement
|
*
|
||||||
* @param[in] yspec Yang specification
|
* @param[in] h Clicon handle
|
||||||
|
* @param[in] ys The augment statement
|
||||||
* @see RFC7950 Sec 7.17
|
* @see RFC7950 Sec 7.17
|
||||||
* The target node MUST be either a container, list, choice, case, input,
|
* The target node MUST be either a container, list, choice, case, input,
|
||||||
* output, or notification node.
|
* output, or notification node.
|
||||||
|
|
@ -215,7 +216,8 @@ ys_grouping_resolve(yang_stmt *yuses,
|
||||||
* struct to the yang statements being inserted.
|
* struct to the yang statements being inserted.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
yang_augment_node(yang_stmt *ys)
|
yang_augment_node(clicon_handle h,
|
||||||
|
yang_stmt *ys)
|
||||||
{
|
{
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
char *schema_nodeid;
|
char *schema_nodeid;
|
||||||
|
|
@ -352,6 +354,13 @@ yang_augment_node(yang_stmt *ys)
|
||||||
if (yang_when_nsc_set(yc, wnsc) < 0)
|
if (yang_when_nsc_set(yc, wnsc) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
/* Note: ys_populate2 called as a special case here since the inserted child is
|
||||||
|
* not covered by Step 9 in yang_parse_post
|
||||||
|
*/
|
||||||
|
if (ys_populate2(yc, h) < 0)
|
||||||
|
goto done;
|
||||||
|
if (yang_apply(yc, -1, ys_populate2, 1, (void*)h) < 0)
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
ok:
|
ok:
|
||||||
retval = 0;
|
retval = 0;
|
||||||
|
|
@ -362,6 +371,8 @@ yang_augment_node(yang_stmt *ys)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Find all top-level augments in a module and change original datamodels.
|
/*! Find all top-level augments in a module and change original datamodels.
|
||||||
|
*
|
||||||
|
* @param[in] h Clicon handle
|
||||||
* @param[in] ymod Yang statement of type module/sub-module
|
* @param[in] ymod Yang statement of type module/sub-module
|
||||||
* @retval 0 OK
|
* @retval 0 OK
|
||||||
* @retval -1 Error
|
* @retval -1 Error
|
||||||
|
|
@ -369,7 +380,8 @@ yang_augment_node(yang_stmt *ys)
|
||||||
* another module not yet augmented.
|
* another module not yet augmented.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
yang_augment_module(yang_stmt *ymod)
|
yang_augment_module(clicon_handle h,
|
||||||
|
yang_stmt *ymod)
|
||||||
|
|
||||||
{
|
{
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
|
@ -379,7 +391,7 @@ yang_augment_module(yang_stmt *ymod)
|
||||||
while ((ys = yn_each(ymod, ys)) != NULL){
|
while ((ys = yn_each(ymod, ys)) != NULL){
|
||||||
switch (yang_keyword_get(ys)){
|
switch (yang_keyword_get(ys)){
|
||||||
case Y_AUGMENT: /* top-level */
|
case Y_AUGMENT: /* top-level */
|
||||||
if (yang_augment_node(ys) < 0)
|
if (yang_augment_node(h, ys) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -1463,7 +1475,7 @@ yang_parse_post(clicon_handle h,
|
||||||
* another module not yet augmented.
|
* another module not yet augmented.
|
||||||
*/
|
*/
|
||||||
for (i=0; i<ylen; i++)
|
for (i=0; i<ylen; i++)
|
||||||
if (yang_augment_module(ylist[i]) < 0)
|
if (yang_augment_module(h, ylist[i]) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
/* 8: Check deviations: not-supported add/delete/replace statements
|
/* 8: Check deviations: not-supported add/delete/replace statements
|
||||||
|
|
@ -1473,7 +1485,11 @@ yang_parse_post(clicon_handle h,
|
||||||
if (yang_apply(yang_child_i(yspec, i), -1, yang_deviation, 1, (void*)h) < 0)
|
if (yang_apply(yang_child_i(yspec, i), -1, yang_deviation, 1, (void*)h) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
/* 9: Go through parse tree and do 2nd step populate (eg default) */
|
/* 9: Go through parse tree and do 2nd step populate (eg default)
|
||||||
|
* Note that augments in step 7 are not covered here since they apply to
|
||||||
|
* modules already loaded. Therefore the call to ys_populate2 is made inline in
|
||||||
|
* yang_augment_node()
|
||||||
|
*/
|
||||||
for (i=0; i<ylen; i++)
|
for (i=0; i<ylen; i++)
|
||||||
if (yang_apply(ylist[i], -1, ys_populate2, 1, (void*)h) < 0)
|
if (yang_apply(ylist[i], -1, ys_populate2, 1, (void*)h) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,14 @@ cfg=$dir/conf.xml
|
||||||
fexample=$dir/example-module.yang
|
fexample=$dir/example-module.yang
|
||||||
fstate=$dir/mystate.xml
|
fstate=$dir/mystate.xml
|
||||||
|
|
||||||
|
# Define default restconfig config: RESTCONFIG
|
||||||
|
RESTCONFIG=$(restconf_config none false)
|
||||||
|
|
||||||
cat <<EOF > $cfg
|
cat <<EOF > $cfg
|
||||||
<clixon-config xmlns="http://clicon.org/config">
|
<clixon-config xmlns="http://clicon.org/config">
|
||||||
<CLICON_CONFIGFILE>$cfg</CLICON_CONFIGFILE>
|
<CLICON_CONFIGFILE>$cfg</CLICON_CONFIGFILE>
|
||||||
<CLICON_FEATURE>ietf-netconf:startup</CLICON_FEATURE>
|
<CLICON_FEATURE>ietf-netconf:startup</CLICON_FEATURE>
|
||||||
|
<CLICON_FEATURE>clixon-restconf:allow-auth-none</CLICON_FEATURE> <!-- Use auth-type=none -->
|
||||||
<CLICON_YANG_DIR>/usr/local/share/clixon</CLICON_YANG_DIR>
|
<CLICON_YANG_DIR>/usr/local/share/clixon</CLICON_YANG_DIR>
|
||||||
<CLICON_YANG_DIR>$IETFRFC</CLICON_YANG_DIR>
|
<CLICON_YANG_DIR>$IETFRFC</CLICON_YANG_DIR>
|
||||||
<CLICON_YANG_MAIN_DIR>$dir</CLICON_YANG_MAIN_DIR>
|
<CLICON_YANG_MAIN_DIR>$dir</CLICON_YANG_MAIN_DIR>
|
||||||
|
|
@ -26,6 +30,7 @@ cat <<EOF > $cfg
|
||||||
<CLICON_CLI_MODE>$APPNAME</CLICON_CLI_MODE>
|
<CLICON_CLI_MODE>$APPNAME</CLICON_CLI_MODE>
|
||||||
<CLICON_CLI_DIR>/usr/local/lib/$APPNAME/cli</CLICON_CLI_DIR>
|
<CLICON_CLI_DIR>/usr/local/lib/$APPNAME/cli</CLICON_CLI_DIR>
|
||||||
<CLICON_CLISPEC_DIR>/usr/local/lib/$APPNAME/clispec</CLICON_CLISPEC_DIR>
|
<CLICON_CLISPEC_DIR>/usr/local/lib/$APPNAME/clispec</CLICON_CLISPEC_DIR>
|
||||||
|
$RESTCONFIG
|
||||||
</clixon-config>
|
</clixon-config>
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
@ -303,22 +308,23 @@ if [ $RC -ne 0 ]; then
|
||||||
|
|
||||||
new "start restconf daemon"
|
new "start restconf daemon"
|
||||||
start_restconf -f $cfg
|
start_restconf -f $cfg
|
||||||
|
|
||||||
new "wait restconf"
|
|
||||||
wait_restconf
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
new "wait restconf"
|
||||||
|
wait_restconf
|
||||||
|
|
||||||
# draft-wwlh-netconf-list-pagination-nc-00.txt
|
# draft-wwlh-netconf-list-pagination-nc-00.txt
|
||||||
new "C.1. 'count' Parameter NETCONF"
|
new "C.1. 'count' Parameter NETCONF"
|
||||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc message-id=\"101\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"><get-pageable-list xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-list-pagination\"><datastore xmlns:ds=\"urn:ietf:params:xml:ns:yang:ietf-datastores\">ds:running</datastore><list-target xmlns:exm=\"http://example.com/ns/example-module\">/exm:admins/exm:admin[exm:name='Bob']/exm:skill</list-target><count>2</count></get-pageable-list></rpc>]]>]]>" '<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101"><pageable-list xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-list-pagination"><skill xmlns="http://example.com/ns/example-module"><name>Conflict Resolution</name><rank>93</rank></skill><skill xmlns="http://example.com/ns/example-module"><name>Management</name><rank>23</rank></skill></pageable-list></rpc-reply>]]>]]>$'
|
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><get-pageable-list xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-list-pagination\"><datastore xmlns:ds=\"urn:ietf:params:xml:ns:yang:ietf-datastores\">ds:running</datastore><list-target xmlns:exm=\"http://example.com/ns/example-module\">/exm:admins/exm:admin[exm:name='Bob']/exm:skill</list-target><count>2</count></get-pageable-list></rpc>]]>]]>" "<rpc-reply $DEFAULTNS><pageable-list xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-list-pagination\"><skill xmlns=\"http://example.com/ns/example-module\"><name>Conflict Resolution</name><rank>93</rank></skill><skill xmlns=\"http://example.com/ns/example-module\"><name>Management</name><rank>23</rank></skill></pageable-list></rpc-reply>]]>]]>$"
|
||||||
|
|
||||||
new "C.2. 'skip' Parameter NETCONF"
|
new "C.2. 'skip' Parameter NETCONF"
|
||||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc message-id=\"101\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"><get-pageable-list xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-list-pagination\"><datastore xmlns:ds=\"urn:ietf:params:xml:ns:yang:ietf-datastores\">ds:running</datastore><list-target xmlns:exm=\"http://example.com/ns/example-module\">/exm:admins/exm:admin[exm:name='Bob']/exm:skill</list-target><count>2</count><skip>2</skip></get-pageable-list></rpc>]]>]]>" '<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="101"><pageable-list xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-list-pagination"><skill xmlns="http://example.com/ns/example-module"><name>Organization</name><rank>44</rank></skill><skill xmlns="http://example.com/ns/example-module"><name>Problem Solving</name><rank>98</rank></skill></pageable-list></rpc-reply>]]>]]>$'
|
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><get-pageable-list xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-list-pagination\"><datastore xmlns:ds=\"urn:ietf:params:xml:ns:yang:ietf-datastores\">ds:running</datastore><list-target xmlns:exm=\"http://example.com/ns/example-module\">/exm:admins/exm:admin[exm:name='Bob']/exm:skill</list-target><count>2</count><skip>2</skip></get-pageable-list></rpc>]]>]]>" "<rpc-reply $DEFAULTNS><pageable-list xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-list-pagination\"><skill xmlns=\"http://example.com/ns/example-module\"><name>Organization</name><rank>44</rank></skill><skill xmlns=\"http://example.com/ns/example-module\"><name>Problem Solving</name><rank>98</rank></skill></pageable-list></rpc-reply>]]>]]>$"
|
||||||
|
|
||||||
# CLI
|
# CLI
|
||||||
# XXX This relies on a very specific clispec command: need a more generic test
|
# XXX This relies on a very specific clispec command: need a more generic test
|
||||||
new "cli show"
|
new "cli show"
|
||||||
expectpart "$($clixon_cli -1 -f $cfg -l o show pagination)" 0 "<skill xmlns=\"http://example.com/ns/example-module\"><name>Conflict Resolution</name><rank>93</rank></skill>" "<skill xmlns=\"http://example.com/ns/example-module\"><name>Management</name><rank>23</rank></skill>" --not-- "<skill xmlns=\"http://example.com/ns/example-module\"><name>Organization</name><rank>44</rank></skill>"
|
echo "$clixon_cli -1 -f $cfg -l o show pagination"
|
||||||
|
expectpart "$($clixon_cli -1 -f $cfg -l o show pagination)" 0 "<skill xmlns=\"http://example.com/ns/example-module\">" "<name>Conflict Resolution</name>" "<rank>93</rank>" "<name>Management</name>" "<rank>23</rank>" --not-- "<name>Organization</name>" "<rank>44</rank></skill>"
|
||||||
|
|
||||||
# draft-wwlh-netconf-list-pagination-rc-00.txt
|
# draft-wwlh-netconf-list-pagination-rc-00.txt
|
||||||
#new "A.1. 'count' Parameter RESTCONF"
|
#new "A.1. 'count' Parameter RESTCONF"
|
||||||
|
|
@ -329,17 +335,20 @@ if [ $RC -ne 0 ]; then
|
||||||
stop_restconf
|
stop_restconf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $BE -eq 0 ]; then
|
if [ $BE -ne 0 ]; then
|
||||||
exit # BE
|
new "Kill backend"
|
||||||
|
# Check if premature kill
|
||||||
|
pid=$(pgrep -u root -f clixon_backend)
|
||||||
|
if [ -z "$pid" ]; then
|
||||||
|
err "backend already dead"
|
||||||
|
fi
|
||||||
|
# kill backend
|
||||||
|
stop_backend -f $cfg
|
||||||
fi
|
fi
|
||||||
|
|
||||||
new "Kill backend"
|
unset RESTCONFIG
|
||||||
# Check if premature kill
|
|
||||||
pid=$(pgrep -u root -f clixon_backend)
|
|
||||||
if [ -z "$pid" ]; then
|
|
||||||
err "backend already dead"
|
|
||||||
fi
|
|
||||||
# kill backend
|
|
||||||
stop_backend -f $cfg
|
|
||||||
|
|
||||||
rm -rf $dir
|
rm -rf $dir
|
||||||
|
|
||||||
|
new "endtest"
|
||||||
|
endtest
|
||||||
|
|
|
||||||
|
|
@ -300,10 +300,6 @@ function testrun()
|
||||||
new "restconf empty rpc JSON"
|
new "restconf empty rpc JSON"
|
||||||
expectpart "$(curl $CURLOPTS -X POST -H "Content-Type: application/yang-data+json" -d {\"clixon-example:input\":null} $proto://$addr/restconf/operations/clixon-example:empty)" 0 "HTTP/$HVER 204"
|
expectpart "$(curl $CURLOPTS -X POST -H "Content-Type: application/yang-data+json" -d {\"clixon-example:input\":null} $proto://$addr/restconf/operations/clixon-example:empty)" 0 "HTTP/$HVER 204"
|
||||||
|
|
||||||
# -I / --head get headers only HEAD
|
|
||||||
new "restconf HEAD. RFC 8040 4.2"
|
|
||||||
expectpart "$(curl $CURLOPTS -I --head "Accept: application/yang-data+json" $RCPROTO://localhost/restconf/data)" 0 "HTTP/1.1 200 OK" "Content-Type: application/yang-data+json"
|
|
||||||
|
|
||||||
new "restconf empty rpc XML"
|
new "restconf empty rpc XML"
|
||||||
expectpart "$(curl $CURLOPTS -X POST -H "Content-Type: application/yang-data+xml" -d '<input xmlns="urn:example:clixon"></input>' $proto://$addr/restconf/operations/clixon-example:empty)" 0 "HTTP/$HVER 204"
|
expectpart "$(curl $CURLOPTS -X POST -H "Content-Type: application/yang-data+xml" -d '<input xmlns="urn:example:clixon"></input>' $proto://$addr/restconf/operations/clixon-example:empty)" 0 "HTTP/$HVER 204"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,13 +81,15 @@ if [ $BE -ne 0 ]; then
|
||||||
err
|
err
|
||||||
fi
|
fi
|
||||||
sudo pkill -f clixon_backend # to be sure
|
sudo pkill -f clixon_backend # to be sure
|
||||||
|
|
||||||
new "start backend -s init -f $cfg"
|
new "start backend -s init -f $cfg"
|
||||||
start_backend -s init -f $cfg
|
start_backend -s init -f $cfg
|
||||||
fi
|
fi
|
||||||
|
|
||||||
new "waiting"
|
new "wait backend"
|
||||||
wait_backend
|
wait_backend
|
||||||
|
|
||||||
|
|
||||||
if [ $RC -ne 0 ]; then
|
if [ $RC -ne 0 ]; then
|
||||||
new "kill old restconf daemon"
|
new "kill old restconf daemon"
|
||||||
stop_restconf_pre
|
stop_restconf_pre
|
||||||
|
|
|
||||||
|
|
@ -54,13 +54,9 @@ YANGSPECS += ietf-yang-patch@2017-02-22.yang
|
||||||
YANGSPECS += ietf-origin@2018-02-14.yang
|
YANGSPECS += ietf-origin@2018-02-14.yang
|
||||||
YANGSPECS += ietf-yang-metadata@2016-08-05.yang
|
YANGSPECS += ietf-yang-metadata@2016-08-05.yang
|
||||||
YANGSPECS += ietf-netconf-with-defaults@2011-06-01.yang
|
YANGSPECS += ietf-netconf-with-defaults@2011-06-01.yang
|
||||||
<<<<<<< HEAD
|
|
||||||
# in draft-wwlh-netconf-list-pagination:
|
# in draft-wwlh-netconf-list-pagination:
|
||||||
YANGSPECS += ietf-netconf-list-pagination@2020-10-30.yang
|
YANGSPECS += ietf-netconf-list-pagination@2020-10-30.yang
|
||||||
|
|
||||||
=======
|
|
||||||
>>>>>>> fixes for compilation
|
|
||||||
|
|
||||||
all:
|
all:
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue