Preparations for Clixon 6.0 release

Test:
- netconf-monitoring using http-data disabled for restconf=fcgi
- updated cicd.sh script with detail and change logfile
This commit is contained in:
Olof hagsand 2022-11-29 09:15:30 +01:00
parent c94e9dad67
commit 67e6e5e5e1
7 changed files with 82 additions and 178 deletions

View file

@ -42,12 +42,6 @@ Expected: Nov 2022
### New features ### New features
* Netconf monitoring
* First part: Capabilities and schema state and get-schema
* Remains: Datastore, sessions and statistics state
* Standards
* RFC 6022 "YANG Module for NETCONF Monitoring"
* See [Feature Request: Support RFC 6022 (NETCONF Monitoring)](https://github.com/clicon/clixon/issues/370)
* Confirmed-commit capability * Confirmed-commit capability
* Standards * Standards
* RFC 4741 "NETCONF Configuration Protocol": Section 8.4 * RFC 4741 "NETCONF Configuration Protocol": Section 8.4
@ -58,6 +52,12 @@ Expected: Nov 2022
* Added support for relevant arguments to CLI commit * Added support for relevant arguments to CLI commit
* See [example_cli.cli](https://github.com/clicon/clixon/blob/master/example/main/example_cli.cli) * See [example_cli.cli](https://github.com/clicon/clixon/blob/master/example/main/example_cli.cli)
* See [Netconf Confirmed Commit Capability](https://github.com/clicon/clixon/issues/255) * See [Netconf Confirmed Commit Capability](https://github.com/clicon/clixon/issues/255)
* Netconf monitoring, part 1
* Capabilities and schema state and get-schema
* Remaining: Datastore, sessions and statistics state
* Standards
* RFC 6022 "YANG Module for NETCONF Monitoring"
* See [Feature Request: Support RFC 6022 (NETCONF Monitoring)](https://github.com/clicon/clixon/issues/370)
### API changes on existing protocol/config features ### API changes on existing protocol/config features
@ -67,7 +67,7 @@ Users may have to change how they access the system
* Added option: * Added option:
* `CLICON_NETCONF_MONITORING` * `CLICON_NETCONF_MONITORING`
* `CLICON_NETCONF_MONITORING_LOCATION` * `CLICON_NETCONF_MONITORING_LOCATION`
* Added `PRETTYPRINT_INDENT` compile-time option controlling indentation level for XML,JSON and TEXT * Added `PRETTYPRINT_INDENT` compile-time option controlling indentation level for XML, JSON, TEXT and YANG
* Default value is `3` * Default value is `3`
* NETCONF: Removed `message-id` from hello protocol following RFC 6241 * NETCONF: Removed `message-id` from hello protocol following RFC 6241
* See [message-id present on netconf app "hello"](https://github.com/clicon/clixon/issues/369) * See [message-id present on netconf app "hello"](https://github.com/clicon/clixon/issues/369)
@ -78,7 +78,7 @@ Developers may need to change their code
* [Code formatting: Change indentation style to space](https://github.com/clicon/clixon/issues/379) * [Code formatting: Change indentation style to space](https://github.com/clicon/clixon/issues/379)
* Applies to all c/h/y/l/sh files and .editorconfig * Applies to all c/h/y/l/sh files and .editorconfig
* C API changes * C API changes:
* Added `expanddefault` parameter to `xml_yang_validate_rpc()` * Added `expanddefault` parameter to `xml_yang_validate_rpc()`
* Added `defaults` parameter to `clicon_rpc_get_pageable_list()` * Added `defaults` parameter to `clicon_rpc_get_pageable_list()`
* `clicon_rpc_commit()` and `cli_commit` * `clicon_rpc_commit()` and `cli_commit`
@ -91,9 +91,10 @@ Developers may need to change their code
### Minor features ### Minor features
* Removed `YANG_ORDERING_WHEN_LAST` compile-time option (obsolete since 5.4) * Removed obsoleted compile-time options since 5.4:
* `YANG_ORDERING_WHEN_LAST`
* See https://github.com/clicon/clixon/issues/287 * See https://github.com/clicon/clixon/issues/287
* Removed `JSON_CDATA_STRIP` compile-time option (obsolete since 5.4) * `JSON_CDATA_STRIP`
* Added fuzz code for xpath * Added fuzz code for xpath
* List-pagination: Follow ietf-draft 100%: Removed list-pagination "presence" * List-pagination: Follow ietf-draft 100%: Removed list-pagination "presence"
* Main example: Removed dependency of external IETF RFCs * Main example: Removed dependency of external IETF RFCs

View file

@ -13,7 +13,7 @@ Note especially, the contribution license agreement (CLA) is described in the CL
## C style ## C style
Clixon uses 4-char indentation, a la emacs "cc-mode". Clixon uses 4-char space indentation.
### Function declarations ### Function declarations
@ -28,9 +28,7 @@ Functions in C code are written as follows:
ms = NULL; ms = NULL;
``` ```
Notes: Notes:
1. The return type of the function and all qualifers on first line (`static int`) 1. The return type of the function and all qualifers on first line (`static int`)
2. Function name and first parameter on second line, thereafter each parameter on own line 2. Function name and first parameter on second line, thereafter each parameter on own line
3. Each parameter indented to match the "longest" (`my_structure`) 3. Each parameter indented to match the "longest" (`my_structure`)
@ -57,19 +55,17 @@ Errors are typically declared as follows:
All function returns that have return values must be checked All function returns that have return values must be checked
Default return values form a function are: Default return values form a function are:
- `0` OK - `0` OK
- `-1` Fatal Error - `-1` Fatal Error
In some cases, Clixon uses three-value returns as follows: In some cases, Clixon uses three-value returns as follows:
- `1` OK - `1` OK
- `0` Invalid (and usually a cxobj* return value) - `0` Invalid
- `-1` Fatal error - `-1` Fatal error
### Return values ### Return values
Clixon uses goto:s only to get a single point of exit functions as follows:: Clixon uses goto:s only to get a single point of exit functions as follows:
``` ```
{ {
int retval = -1; int retval = -1;
@ -82,7 +78,6 @@ Clixon uses goto:s only to get a single point of exit functions as follows::
``` ```
Notes: Notes:
1. Use only a single return statement in a function 1. Use only a single return statement in a function
2. Do not use of goto:s in other ways 2. Do not use of goto:s in other ways
@ -90,30 +85,47 @@ Notes:
Use `/* */`. Use `//` only for temporal comments. Use `/* */`. Use `//` only for temporal comments.
Do not use `======`, `>>>>>` or `<<<<<<` in comments since git merge conflict uses that. Do not use "======", ">>>>>" or "<<<<<<" in comments since git merge conflict uses that.
## Documentation ### Format ints
How to document the code: Use:
- %zu for size_t
- PRIu64 for uint64
- %p for pointers
### Include files
Avoid include statements in .h files, place them in .c files whenever possible.
The reason is to avoid deep include chains where file dependencies are
difficult to analyze and understand. If include statements are only placed in .c
files, there is only a single level of include file dependencies.
The drawback is that the same include file may need to be repeated in many .c files.
### Structs
Struct fields should have a prefix to distinguish them from other struct fields. The prefix should use an abbreviation of the struct name.
Example:
``` ```
/*! This is a small comment on one line struct my_struct{
* int ms_foo;
* This is a detailed description char *ms_string[42];
* spanning several lines. }
*
* @param[in] src This is a description of the first parameter
* @param[in,out] dest This is a description of the second parameter
* @retval 0 This is a description of the return value
* @retval -1 This is a description of another return value
*
* Example usage:
* @code
* fn(a, &b);
* @endcode
*
* @see See also this function
*/
``` ```
where `ms_` is the prefix and is an abbreviation of `my_struct`.
### Global variables
Try to avoid global variables.
If you absolutely need a global variable, try to contain it as static within a
single C-file, ie do not declare it extern and use it elsewhere.
Also, always prepend a global variable with `_`, underscore.
## Testing ## Testing

View file

@ -13,10 +13,10 @@ See [documentation](https://clixon-docs.readthedocs.io), [project page](https://
Clixon is open-source and dual licensed. Either Apache License, Version 2.0 or GNU Clixon is open-source and dual licensed. Either Apache License, Version 2.0 or GNU
General Public License Version 2; you choose, see [LICENSE.md](LICENSE.md). General Public License Version 2; you choose, see [LICENSE.md](LICENSE.md).
Clixon has a master branch continuously tested with CI, but releases are made ca every second month. Latest 5.9.0 release is from September 2022. Next is planned for November 2022. See [CHANGELOG.md](CHANGELOG.md) release history. Clixon has a master branch continuously tested with CI, but releases are made ca every second month. Latest 6.0.0 release is from November 2022. Next is planned for January 2023. See [CHANGELOG.md](CHANGELOG.md) release history.
Clixon interaction is best done posting issues, pull requests, or joining the Clixon interaction is best done posting issues, pull requests, or joining the
[slack channel](https://clixondev.slack.com). [slack channel](https://clixondev.slack.com).
[Slack invite](https://join.slack.com/t/clixondev/shared_invite/zt-1fz8at20n-KGNmKD7KH2j2jIFGU_EhMQ)(updated 15/9 2022, valid 30d) [Slack invite](https://join.slack.com/t/clixondev/shared_invite/zt-1kl2nxe91-9vdsyYNjhU3ZP57nZq_2rw)(updated 29/11 2022, valid 30d)
Clixon is sponsored by [Rubicon Communications LLC(Netgate)](https://www.netgate.com/) and [Akamai Technologies, Inc.](https://www.akamai.com). Clixon is sponsored by [Rubicon Communications LLC(Netgate)](https://www.netgate.com/) and [Akamai Technologies, Inc.](https://www.akamai.com).

View file

@ -1,7 +1,6 @@
# README for Clixon developers # README for Clixon developers
* [Code documentation](#documentation) * [Code documentation](#documentation)
* [C style](#c-style)
* [How to work in git (how-to-work-in-git)](#how-to-work-in-git) * [How to work in git (how-to-work-in-git)](#how-to-work-in-git)
* [How the meta-configure stuff works](#meta-configure) * [How the meta-configure stuff works](#meta-configure)
* [How to debug](#debug) * [How to debug](#debug)
@ -29,121 +28,6 @@ How to document the code
*/ */
``` ```
## C style
Clixon uses 4-char indentation, a la emacs "cc-mode".
### Function declarations
Functions in C code are written as follows:
```
static int
myfn(int par1,
my_structure *par2)
{
int retval = -1;
my_structure *ms;
ms = NULL;
```
Notes:
1. The return type of the function and all qualifers on first line (`static int`)
2. Function name and first parameter on second line, thereafter each parameter on own line
3. Each parameter indented to match the "longest" (`my_structure`)
4. Pointer declarations written: `type *p`, not: `type* p`.
5. All local variables in a function declared at top of function, not inline with C-statements.
6. Local variables can be initialized with scalars or constants, not eg malloc or functions with return values that need to be checked for errors
7. There is a single empty line between local variable declarations and the first function statement.
Function signatures are declared in include files or in forward declaration using "one-line" syntax, unless very long:
```
static int myfn(int par1, my_structure *par2);
```
### Errors
Errors are typically declared as follows:
```
if (myfn(0) < 0){
clicon_err(OE_UNIX, EINVAL, "myfn");
goto done;
}
```
All function returns that have return values must be checked
Default return values form a function are:
- `0` OK
- `-1` Fatal Error
In some cases, Clixon uses three-value returns as follows:
- `1` OK
- `0` Invalid
- `-1` Fatal error
### Return values
Clixon uses goto:s only to get a single point of exit functions as follows:
```
{
int retval = -1;
...
retval = 0;
done:
return retval
}
```
Notes:
1. Use only a single return statement in a function
2. Do not use of goto:s in other ways
### Comments
Use `/* */`. Use `//` only for temporal comments.
Do not use "======", ">>>>>" or "<<<<<<" in comments since git merge conflict uses that.
### Format ints
Use:
- %zu for size_t
- PRIu64 for uint64
- %p for pointers
### Include files
Avoid include statements in .h files, place them in .c files whenever possible.
The reason is to avoid deep include chains where file dependencies are
difficult to analyze and understand. If include statements are only placed in .c
files, there is only a single level of include file dependencies.
The drawback is that the same include file may need to be repeated in many .c files.
### Structs
Struct fields should have a prefix to distinguish them from other struct fields. The prefix should use an abbreviation of the struct name.
Example:
```
struct my_struct{
int ms_foo;
char *ms_string[42];
}
```
where `ms_` is the prefix and is an abbreviation of `my_struct`.
### Global variables
Try to avoid global variables.
If you absolutely need one, try to contain it as static within a
single C-file, ie do not declare it extern and use it elsewhere.
Also, always prepend a global variable with `_`, underscore.
## How to work in git ## How to work in git
Clixon uses semantic versioning (https://semver.org). Clixon uses semantic versioning (https://semver.org).

View file

@ -58,9 +58,9 @@ all: $(HOSTS)
# Real hosts reachable by ssh # Real hosts reachable by ssh
$(HOSTS): $(HOSTS):
ifdef LOGDIR ifdef LOGDIR
./cicd.sh $@ $(RESTCONF) 2>&1 > $(LOGDIR)/$@-$(RESTCONF).log ./cicd.sh $@ $(RESTCONF) 2>&1 > $(LOGDIR)/host-$(RESTCONF)-$@.log
else else
./cicd.sh $@ $(RESTCONF) 2>&1 | tee /$@-$(RESTCONF).log ./cicd.sh $@ $(RESTCONF) 2>&1 | tee /host-$(RESTCONF)-$@.log
endif endif
clean: clean:

View file

@ -54,5 +54,5 @@ if [ "$restconf" = "fcgi" ]; then
else else
ssh -t $h sudo systemctl stop nginx ssh -t $h sudo systemctl stop nginx
fi fi
ssh -t $h "(cd src/clixon/test; ./sum.sh)" ssh -t $h "(cd src/clixon/test; detail=true ./sum.sh)"
exit 0 exit 0

View file

@ -1,12 +1,19 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Test for RFC6022 YANG Module for NETCONF Monitoring # Test for RFC6022 YANG Module for NETCONF Monitoring
# Tests the location scheme by using the clixon http-data feature # Tests the location scheme by using the clixon http-data feature (only restconf=native)
# Magic line must be first in script (see README.md) # Magic line must be first in script (see README.md)
s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi
APPNAME=example APPNAME=example
# Does not work with fcgi
if [ "${WITH_RESTCONF}" = "fcgi" ]; then
echo "...skipped: Must run with --with-restconf=native"
rm -rf $dir
if [ "$s" = $0 ]; then exit 0; else return 0; fi
fi
cfg=$dir/conf_yang.xml cfg=$dir/conf_yang.xml
fyang=$dir/clixon-example@2022-01-01.yang fyang=$dir/clixon-example@2022-01-01.yang