clicon / clixon-controller

Clixon network controller
Apache License 2.0
14 stars 5 forks source link

Unable to commit to device with warnings #71

Closed denniswa closed 10 months ago

denniswa commented 10 months ago

In a lab setup we do not always have all the licences installed and this causes some devices to throw some warnings when committing new configuration like this:

dennis@ptx# show |compare
[edit system]
-  domain-name sunet.se;
+  domain-name nordu.net;

[edit]
dennis@ptx# commit
[edit routing-instances CPE-LU protocols]
  'bgp'
    warning: requires 'bgp' license
[edit routing-instances CPE-LU protocols]
  'ospf'
    warning: requires 'ospf' license
commit complete

[edit]
dennis@ptx#

The controller does not allow the user to commit anything when the device returns error-severity warning

dennis@zoomie> show devices
Name                    State      Time                   Logmsg
=======================================================================================
ptx                     OPEN       2023-11-29T12:08:22
dennis@zoomie> set
dennis@zoomie> conf
dennis@zoomie> configure
dennis@zoomie[/]# sho
 compare               devices               processes             services              |
dennis@zoomie[/]# show com
 text                  xml                   |
dennis@zoomie[/]# show compare
               junos-conf-system:system {
-                 domain-name sunet.se;
+                 domain-name nordu.net;
               }
dennis@zoomie[/]# comm
 diff                  local                 push
dennis@zoomie[/]# commit di
dennis@zoomie[/]# commit diff
ptx:
ptx:
      <system xmlns="http://yang.juniper.net/junos/conf/system">
-       <domain-name>sunet.se</domain-name>
+       <domain-name>nordu.net</domain-name>
      </system>
OK
dennis@zoomie[/]# comm
 diff                  local                 push
dennis@zoomie[/]# commit
Nov 30 09:00:06: transaction_notification_handler: pid: 5842 Transaction 6 failed: Error mustd: requires 'bgp' license in state PUSH-VALIDATE of device ptx

from the log:

<nc:rpc-reply xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:junos="http://xml.juniper.net/junos/22.4R0/junos"  message-id="4">#012<nc:rpc-error>#012<nc:error-severity>warning</nc:error-severity>#012<nc:error-path>[edit routing-instances CPE-LU protocols]</nc:error-path>#012<nc:error-message>mustd: requires 'bgp' license</nc:error-message>#012<nc:error-info>#012<nc:bad-element>bgp</nc:bad-element>#012</nc:error-info>#012</nc:rpc-error>#012<nc:rpc-error>#012<nc:error-severity>warning</nc:error-severity>#012<nc:error-path>[edit routing-instances CPE-LU protocols]</nc:error-path>#012<nc:error-message>mustd: requires 'ospf' license</nc:error-message>#012<nc:error-info>#012<nc:bad-element>ospf</nc:bad-element>#012</nc:error-info>#012</nc:rpc-error>#012<nc:ok/>#012</nc:rpc-reply>
olofhagsand commented 10 months ago

Fixed by checking if the error-severity is "warning" and if so ignore it. Note that this fixes this specific intance of rpc-error warning return. Not in general for other cases where a netconf device may return a warning.

denniswa commented 10 months ago

Fix verified!