Below is my yang file.
container auth {
tailf:info "Configure NTP authentication keys";
list server {
tailf:info "Configured ip addresses";
tailf:cli-incomplete-command;
tailf:cli-compact-syntax;
tailf:cli-sequence-commands;
tailf:cli-suppress-mode;
key "serverip";
leaf serverip {
tailf:info "ip address";
type leafref {
path "/gw-system:ntp/gw-system:server" ;
}
}
leaf key {
tailf:cli-incomplete-command;
tailf:info "Authentication key ID for this server";
type uint32 {
range "1..65535";
}
}
choice authtype {
mandatory "true";
case sha256 {
leaf en-sha256 {
tailf:info "SHA256 encryption";
type tailf:aes-cfb-128-encrypted-string {
tailf:info "Cleartext Secret";
}
tailf:suppress-echo true;
tailf:validate validate_ntp_auth_key_pwd {
tailf:dependency '.';
}
}
}
case md5 {
leaf en-md5 {
tailf:info "MD5 encryption";
type tailf:aes-cfb-128-encrypted-string {
tailf:info "Cleartext Secret";
}
}
}
case md5 {
leaf en-md5 {
tailf:info "MD5 encryption";
type tailf:aes-cfb-128-encrypted-string {
tailf:info "Cleartext Secret";
}
tailf:suppress-echo true;
tailf:validate validate_ntp_auth_key_pwd {
tailf:dependency '.';
}
}
}
case sha1 {
leaf en-sha1 {
tailf:info "SHA1 encryption";
type tailf:aes-cfb-128-encrypted-string {
tailf:info "Cleartext Secret";
}
tailf:suppress-echo true;
tailf:validate validate_ntp_auth_key_pwd {
tailf:dependency '.';
}
}
}
}
}
}
I am facing one small issue with yang.
When I reconfigure the command with different values then yang sends the previous values first before sending the new values.
For example:
ntp auth server 1.1.1.1 key 1 en-sha1 cisco
commit
ntp auth server 1.1.1.1 key 1 en-sha256 cisco
commit
when I try to configure the same command with different values then I receive old values first followed by new values.
The problem with this is that yang sends the old values with confd_vtype as 1 which is C_NOEXISTS because of this my applciation gets crash because my application expect that the type will always be C_BUF
How can I make yang to understand that if the same command is configured with different values then always send new values instead of sending old values first?