- Added transaction_arg_set()

- Modifed coverage script
This commit is contained in:
Olof hagsand 2021-09-27 16:31:21 +02:00
parent 51278d5901
commit 9b6bb3ecbf
6 changed files with 40 additions and 26 deletions

View file

@ -33,7 +33,7 @@
## 5.3.0 ## 5.3.0
27 September, 2021 27 September, 2021
The 5.3 release has pagination support, YANG/auto-clilinkref changes and lots of bug fixes. The 5.3 release has pagination support, Linkref changes in validation and auto-cli, and lots of bug fixes.
### New features ### New features
@ -50,10 +50,10 @@ The 5.3 release has pagination support, YANG/auto-clilinkref changes and lots of
* New http media: application/yang-collection+xml/json * New http media: application/yang-collection+xml/json
* Updated state callback signature containing parameters for pagination * Updated state callback signature containing parameters for pagination
* See API changes below * See API changes below
* See [User manual pagination](https://clixon-docs.readthedocs.io/en/latest/misc.html#pagination)
* Work-in-progress * Work-in-progress
* Enable remaining attriute with LIST_PAGINATION_REMAINING compile-time option * Enable remaining attriute with LIST_PAGINATION_REMAINING compile-time option
* sort/direction/where etc not supported * sort/direction/where etc not supported
* For documentation: [User manual pagination](https://clixon-docs.readthedocs.io/en/latest/misc.html#pagination)
* YANG Leafref feature update * YANG Leafref feature update
* Closer adherence to RFC 7950. Some of this is changed behavior, some is new feature. * Closer adherence to RFC 7950. Some of this is changed behavior, some is new feature.
* Validation uses referred node * Validation uses referred node
@ -75,12 +75,12 @@ Users may have to change how they access the system
* Looser leafref validation checks * Looser leafref validation checks
* Leafref required-instance must be set to make strict data-node check * Leafref required-instance must be set to make strict data-node check
* See changes under new feature "YANG leafref feature update" * See changes under new feature "YANG leafref feature update" above
* Native Restconf * Native Restconf
* Native restconf is now default, not fcgi/nginx * Native restconf is now default, not fcgi/nginx
* To configure with fcgi, you need to explicitly configure: `--with-restconf=fcgi` * To configure with fcgi, you need to explicitly configure: `--with-restconf=fcgi`
* SSL client certs failures are returned as http 405 errors, not fail during SSL negotiation * SSL client certs failures are returned as http `405` errors, not fail during SSL negotiation
* New clixon-config@2021-07-11.yang revision * New `clixon-config@2021-07-11.yang` revision
* Added: `CLICON_RESTCONF_HTTP2_PLAIN` * Added: `CLICON_RESTCONF_HTTP2_PLAIN`
* Removed default of `CLICON_RESTCONF_INSTALLDIR` * Removed default of `CLICON_RESTCONF_INSTALLDIR`
* The default behaviour is changed to use the config `$(sbindir)` to locate `clixon_restconf` when starting restconf internally * The default behaviour is changed to use the config `$(sbindir)` to locate `clixon_restconf` when starting restconf internally

View file

@ -506,7 +506,7 @@ transaction_free(transaction_data_t *td)
* @retval -1 Error * @retval -1 Error
*/ */
int int
plugin_transaction_begin_one(clixon_plugin_t *cp, plugin_transaction_begin_one(clixon_plugin_t *cp,
clicon_handle h, clicon_handle h,
transaction_data_t *td) transaction_data_t *td)
{ {

View file

@ -43,14 +43,14 @@
*/ */
/*! Transaction data describing a system transition from a src to target state /*! Transaction data describing a system transition from a src to target state
* Clicon internal, presented as void* to app's callback in the 'transaction_data' * Clixon internal, presented as void* to app's callback in the 'transaction_data'
* type in clicon_backend_api.h * type in clicon_backend_api.h
* The struct contains source and target XML tree (e.g. candidate/running) * The struct contains source and target XML tree (e.g. candidate/running)
* But primarily a set of XML tree vectors (dvec, avec, cvec) and associated lengths * But primarily a set of XML tree vectors (dvec, avec, cvec) and associated lengths
* These contain the difference between src and target XML, ie "what has changed". * These contain the difference between src and target XML, ie "what has changed".
* It is up to the validate callbacks to ensure that these changes are OK * It is up to the validate callbacks to ensure that these changes are OK
* It is up to the commit callbacks to enforce these changes in the "state" of * It is up to the commit callbacks to enforce these changes in the "state" of
*the system. * the system.
*/ */
typedef struct { typedef struct {
uint64_t td_id; /* Transaction id */ uint64_t td_id; /* Transaction id */

View file

@ -81,12 +81,23 @@ transaction_id(transaction_data td)
/*! Get plugin/application specific callback argument /*! Get plugin/application specific callback argument
* @param[in] td transaction_data * @param[in] td transaction_data
* @retval arg callback argument * @retval arg callback argument
* @note NYI
*/ */
void * void *
transaction_arg(transaction_data td) transaction_arg(transaction_data td)
{ {
return ((transaction_data_t *)td)->td_arg; return ((transaction_data_t *)td)->td_arg;
}
/*! Set plugin/application specific callback argument
* @param[in] td transaction_data
* @param[in] arg callback argument
*/
int
transaction_arg_set(transaction_data td,
void *arg)
{
((transaction_data_t *)td)->td_arg = arg;
return 0;
} }
/*! Get source database xml tree /*! Get source database xml tree
@ -96,7 +107,7 @@ transaction_arg(transaction_data td)
cxobj * cxobj *
transaction_src(transaction_data td) transaction_src(transaction_data td)
{ {
return ((transaction_data_t *)td)->td_src; return ((transaction_data_t *)td)->td_src;
} }
/*! Get target database xml tree /*! Get target database xml tree
@ -106,7 +117,7 @@ transaction_src(transaction_data td)
cxobj * cxobj *
transaction_target(transaction_data td) transaction_target(transaction_data td)
{ {
return ((transaction_data_t *)td)->td_target; return ((transaction_data_t *)td)->td_target;
} }
/*! Get delete xml vector, ie vector of xml nodes that are deleted src->target /*! Get delete xml vector, ie vector of xml nodes that are deleted src->target
@ -116,7 +127,7 @@ transaction_target(transaction_data td)
cxobj ** cxobj **
transaction_dvec(transaction_data td) transaction_dvec(transaction_data td)
{ {
return ((transaction_data_t *)td)->td_dvec; return ((transaction_data_t *)td)->td_dvec;
} }
/*! Get length of delete xml vector /*! Get length of delete xml vector
@ -127,7 +138,7 @@ transaction_dvec(transaction_data td)
size_t size_t
transaction_dlen(transaction_data td) transaction_dlen(transaction_data td)
{ {
return ((transaction_data_t *)td)->td_dlen; return ((transaction_data_t *)td)->td_dlen;
} }
/*! Get add xml vector, ie vector of xml nodes that are added src->target /*! Get add xml vector, ie vector of xml nodes that are added src->target
@ -137,7 +148,7 @@ transaction_dlen(transaction_data td)
cxobj ** cxobj **
transaction_avec(transaction_data td) transaction_avec(transaction_data td)
{ {
return ((transaction_data_t *)td)->td_avec; return ((transaction_data_t *)td)->td_avec;
} }
/*! Get length of add xml vector /*! Get length of add xml vector
@ -148,7 +159,7 @@ transaction_avec(transaction_data td)
size_t size_t
transaction_alen(transaction_data td) transaction_alen(transaction_data td)
{ {
return ((transaction_data_t *)td)->td_alen; return ((transaction_data_t *)td)->td_alen;
} }
/*! Get source changed xml vector, ie vector of xml nodes that changed /*! Get source changed xml vector, ie vector of xml nodes that changed
@ -162,7 +173,7 @@ transaction_alen(transaction_data td)
cxobj ** cxobj **
transaction_scvec(transaction_data td) transaction_scvec(transaction_data td)
{ {
return ((transaction_data_t *)td)->td_scvec; return ((transaction_data_t *)td)->td_scvec;
} }
/*! Get target changed xml vector, ie vector of xml nodes that changed /*! Get target changed xml vector, ie vector of xml nodes that changed
@ -176,7 +187,7 @@ transaction_scvec(transaction_data td)
cxobj ** cxobj **
transaction_tcvec(transaction_data td) transaction_tcvec(transaction_data td)
{ {
return ((transaction_data_t *)td)->td_tcvec; return ((transaction_data_t *)td)->td_tcvec;
} }
/*! Get length of changed xml vector /*! Get length of changed xml vector
@ -187,7 +198,7 @@ transaction_tcvec(transaction_data td)
size_t size_t
transaction_clen(transaction_data td) transaction_clen(transaction_data td)
{ {
return ((transaction_data_t *)td)->td_clen; return ((transaction_data_t *)td)->td_clen;
} }
/*! Print transaction on FILE for debug /*! Print transaction on FILE for debug

View file

@ -51,6 +51,7 @@
*/ */
uint64_t transaction_id(transaction_data td); uint64_t transaction_id(transaction_data td);
void *transaction_arg(transaction_data td); void *transaction_arg(transaction_data td);
int transaction_arg_set(transaction_data td, void *arg);
cxobj *transaction_src(transaction_data td); cxobj *transaction_src(transaction_data td);
cxobj *transaction_target(transaction_data td); cxobj *transaction_target(transaction_data td);
cxobj **transaction_dvec(transaction_data td); cxobj **transaction_dvec(transaction_data td);

View file

@ -13,8 +13,8 @@ TOKEN=$1
# LINKAGE=static # LINKAGE=static
# Configure (clixon) # Configure (clixon)
CFLAGS="-g -Wall" INSTALLFLAGS="" ./configure #CFLAGS="-g -Wall" INSTALLFLAGS="" ./configure
sudo ldconfig #sudo ldconfig
LDFLAGS=-coverage LINKAGE=static CFLAGS="-g -Wall -coverage" INSTALLFLAGS="" ./configure LDFLAGS=-coverage LINKAGE=static CFLAGS="-g -Wall -coverage" INSTALLFLAGS="" ./configure
# Build # Build
@ -27,17 +27,19 @@ sudo make install-include
(cd example; sudo make install) (cd example; sudo make install)
(cd util; sudo make install) (cd util; sudo make install)
# Kludge for netconf to add as non-root # Kludge for netconf to touch all gcda files as root
(cd test; ./test_netconf_hello.sh) (cd test; sudo ./test_netconf_hello.sh) || true
find . -name "*.gcda" | xargs sudo chmod 777 find . -name "*.gcda" | xargs sudo chmod 777
# Run restconf as root
(cd test; clixon_restconf="clixon_restconf -r" ./sum.sh) (cd test; clixon_restconf="clixon_restconf -r" ./sum.sh)
# Push coverage # Push coverage
# PUSH $TOKEN bash <(curl -s https://codecov.io/bash) -t ${TOKEN}
# remove all coverage files (after gcov push) # Remove all coverage files (after gcov push)
find . -name "*.gcda" | xargs rm find . -name "*.gcda" | xargs rm
find . -name "*.gcno" | xargs rm
sleep 1 # ensure OK is last sleep 1 # ensure OK is last
echo OK echo OK