clicon / clixon-controller

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

CLI: show compare of template does not show correct diff while load merge xml #101

Open jjsson opened 8 months ago

jjsson commented 8 months ago

show compare does not show diff while load merge xml

Example adding 1653:8 :

SUNET-STATIC-CONNECTED-AGG 1653:8

pre -adding:

rikard@snc[/]# show devices template deploy-policy-options-shared-community

rikard@snc[/]#

addning

rikard@snc[/]# load merge xml

rikard@snc[/]# com diff local push rikard@snc[/]# show com text xml | rikard@snc[/]# show compare <-------- ! policy-options { + community { + name NDN-blackhole; <----- + members 2603:999; <------ + } } rikard@snc[/]# result is ok: rikard@snc[/]# commit local rikard@snc[/]# show devices template deploy-policy-options-shared-community
denniswa commented 7 months ago

When deleting first clients for example in the SNMP list the diff is funny:

snc@snc-lab[/]# show compare
                     clients {
-                       name "192.36.171.249/32";
+                       name "192.36.171.225/32";
                     }
                     clients {
-                       name "192.36.171.225/32";
+                       name "192.36.171.175/32";
                     }
                     clients {
-                       name "192.36.171.175/32";
+                       name "109.105.111.111/32";
                     }
                     clients {
-                       name "109.105.111.111/32";
+                       name "109.105.111.24/32";
                     }
                     clients {
-                       name "109.105.111.24/32";
+                       name "109.105.113.17/32";
                     }
                     clients {
-                       name "109.105.113.17/32";
+                       name "86.105.118.10/32";
                     }
                     clients {
-                       name "86.105.118.10/32";
+                       name "130.242.121.200/32";
                     }
                     clients {
-                       name "130.242.121.200/32";
+                       name "86.105.119.16/32";
                     }
                  community{
-                    clients {
-                       name 86.105.119.16/32;
-                    }
                  }
olofhagsand commented 7 months ago

The comparison algorithm in clixon assumes a yang-spec. But the "config" part of the template is anydata and lacks YANG. There are two obvious solutions to this: 1) Clixon should have a non-yang xml diff 2) The template should use YANG

olofhagsand commented 7 months ago

Document this as known issue: show compare of template configs is limited.