clicon / clixon-controller

Clixon network controller
Apache License 2.0
12 stars 4 forks source link

Weird things happen when piping set command #33

Closed krihal closed 10 months ago

krihal commented 10 months ago

We start with an empty diff, no changes:

debian@khn-dev[/]# operation show devices r* diff
debian@khn-dev[/]# commit diff
r1:
r2:
OK

Piping a set command, this shouldn't make any sense:

debian@khn-dev[/]# set devices device * config | display cli

But...

debian@khn-dev[/]# commit diff
r1:
<config>
-  <messages xmlns="http://openconfig.net/yang/messages">
-     <config>
-        <severity>ALERT</severity>
-     </config>
-  </messages>
</config>
r2:
<config>
-  <messages xmlns="http://openconfig.net/yang/messages">
-     <config>
-        <severity>ALERT</severity>
-     </config>
-  </messages>
</config>
OK
debian@khn-dev[/]#
olofhagsand commented 10 months ago

This has nothing to do with the display command. Instead it has to do with the CLI "set" command that maps directly to NETCONF operation REPLACE. This may be confusing since here, it resukts in the complete wipe-oiut of the sub-config. Instead, replace the underlying function to NETCONF MERGE.

krihal commented 10 months ago

Verified.