Skip to content

Commit

Permalink
Improved error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
olofhagsand committed Sep 19, 2024
1 parent 5612713 commit 7b8f2a0
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 9 deletions.
17 changes: 16 additions & 1 deletion FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* [How to configure JunOS and the Clixon controller?](#how-to-configure-junos-and-the-clixon-controller)
* [How do I add a device in Clixon?](#how-do-i-add-a-device-in-clixon)
* [My device symbols do not appear in the CLI?](#my-device-symbols-do-not-appear-in-the-cli)
* [My device does not announce models?](#my-device-does-not-announce-models)
* [What about YANG features?](#what-about-yang-features)
* [What about the directory structure?](#what-about-the-directory-structure)
* [Candidate is locked](#candidate-is-locked)
Expand Down Expand Up @@ -35,7 +36,7 @@ supports NETCONF, RESTCONF and CLI.
If a device does not come up and shows something like:
```
cli>show device
Name State Time Logmsg
Name State Time Logmsg
=======================================================================================
clixon-example1 CLOSED 2023-05-25T11:12:29 Closed by device
Expand Down Expand Up @@ -95,6 +96,20 @@ Thereafter the device must be explicitly connected:
connection open
```

## My device does not announce models?

The main mechanism in the controller to get YANGs from devices is the RFC6022 `get-schema` mechanism.

If a device does not support this mechanism, the following error appears:
```
Netconf monitoring capability not announced in hello protocol and no local models found
```
If the device does not announce its models in this way, you can declare a local `module-set` which is loaded instead::
```
set devices device test modu
```
See the user-guide for details: https://clixon-controller-docs.readthedocs.io/en/latest/yang.html

## My device symbols do not appear in the CLI?

Connections are open but when you try to edit the device config, there are no symbols:
Expand Down
4 changes: 2 additions & 2 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ cd clixon-pyapi
### Optional: SystemD service
```console

# Copy clixon_controller.service
cp clixon_controller.service /etc/systemd/network/
# Copy clixon-controller.service
cp clixon-controller.service /etc/systemd/network/

# Enable and start the service
systemctl daemon-reload
Expand Down
3 changes: 2 additions & 1 deletion src/controller.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
<!-- Log to syslog and stderr. no log length limitation -->
<CLICON_LOG_DESTINATION>syslog stderr</CLICON_LOG_DESTINATION>
<CLICON_LOG_STRING_LIMIT>0</CLICON_LOG_STRING_LIMIT>
<!-- PYAPI specialization (see CLICON_CONFIG_EXTEND above) -->
<!-- PYAPI specialization (see CLICON_CONFIG_EXTEND above)
NOTE, cannot be broken out into separate dir -->
<CONTROLLER_ACTION_COMMAND xmlns="http://clicon.org/controller-config">@BINDIR@/clixon_server.py -f @SYSCONFDIR@/clixon/controller.xml -F</CONTROLLER_ACTION_COMMAND>
<CONTROLLER_PYAPI_MODULE_PATH xmlns="http://clicon.org/controller-config">@DATADIR@/controller/modules</CONTROLLER_PYAPI_MODULE_PATH>
<CONTROLLER_PYAPI_MODULE_FILTER xmlns="http://clicon.org/controller-config"></CONTROLLER_PYAPI_MODULE_FILTER>
Expand Down
11 changes: 7 additions & 4 deletions src/controller_device_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -1142,9 +1142,12 @@ device_state_handler(clixon_handle h,
}
}
if (!device_handle_capabilities_find(dh, NETCONF_MONITORING_NAMESPACE)){
clixon_debug(CLIXON_DBG_CTRL, "Device %s: Netconf monitoring capability not announced", name);
clixon_debug(CLIXON_DBG_CTRL, "Device %s: Netconf monitoring capability %s not announced in hello protocol",
name,
NETCONF_MONITORING_NAMESPACE);
if (xyanglib == NULL){
if (controller_transaction_failed(h, tid, ct, dh, TR_FAILED_DEV_CLOSE, name, "No YANG device lib") < 0)
if (controller_transaction_failed(h, tid, ct, dh, TR_FAILED_DEV_CLOSE, name,
"Netconf monitoring capability not announced in hello protocol and no local models found") < 0)
goto done;
break;
}
Expand Down Expand Up @@ -1214,7 +1217,7 @@ device_state_handler(clixon_handle h,
goto done;
}
if ((xyanglib = device_handle_yang_lib_get(dh)) == NULL){
if (controller_transaction_failed(h, tid, ct, dh, TR_FAILED_DEV_LEAVE, name, "No YANG device lib") < 0)
if (controller_transaction_failed(h, tid, ct, dh, TR_FAILED_DEV_LEAVE, name, "No YANG device lib 1") < 0)
goto done;
break;
}
Expand Down Expand Up @@ -1286,7 +1289,7 @@ device_state_handler(clixon_handle h,
if (ret == 0){ /* None sent, done */
/* All schemas ready, parse them */
if ((xyanglib = device_handle_yang_lib_get(dh)) == NULL){
if (controller_transaction_failed(h, tid, ct, dh, TR_FAILED_DEV_CLOSE, name, "No YANG device lib") < 0)
if (controller_transaction_failed(h, tid, ct, dh, TR_FAILED_DEV_CLOSE, name, "No YANG device lib 2") < 0)
goto done;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/controller_transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ controller_transaction_done(clixon_handle h,
char *db = "candidate";
device_handle dh;

clixon_debug(CLIXON_DBG_CTRL, "%s", transaction_result_int2str(ct->ct_state));
clixon_debug(CLIXON_DBG_CTRL, "");
controller_transaction_state_set(ct, TS_DONE, result);
iddb = xmldb_islocked(h, db);
if (iddb == TRANSACTION_CLIENT_ID){
Expand Down

0 comments on commit 7b8f2a0

Please sign in to comment.