ConfD User Community

When when-expression becomes false, why does CONFD not trigger deletion

Hi,

Below is our yang snippet:

===a.yang file

augment /exa:config/exa:interface/eth-cli:ethernet {
when “eth-cli:switchport = ‘DISABLED’”; //the default value for switchport is “ENABLED”
container ip{
description “Parameters for the IPv4 address family and VRF”;
}
}
augment /exa:config/exa:interface/eth:ethernet/ip {
//uses ip-management:eth-ip-container;
//uses rip:rip-interface-config;

        list address {
            max-elements 8;
            tailf:cli-suppress-mode;
            key "ip";
            description
                "The list of configured IPv4 addresses on the interface";

            leaf ip {
                type exa:ipv4-prefix;
                description
                    "The IPv4 address on the interface in CIDR format";
            }
        }
        ...

}

==b.yang file

augment “/exa:config/exa:interface/eth-cli:ethernet” {

  leaf switchport {	   		
  		description "Switchport Mode";	   		
  		type exa:ENABLED_DISABLED;	   		
  		default ENABLED;
  	}		
  	leaf role {   			
  		type exa:IF_ETH_SERVICE_ROLE;// without default value
  		description "Ethernet port service role";   
  }


}

In our case, when the above when switchport statement is fulfilled, ip address is configured.

and then run “no switchport”, CONFD doesn’t trigger delete ip address request to our EDP.

AXOS-22405-class-map(config)# interface ethernet 1/1/g5
AXOS-22405-class-map(config-ethernet-1/1/g5)# switchport DISABLED
AXOS-22405-class-map(config-ethernet-1/1/g5)# ip address 20.20.20.1/24
AXOS-22405-class-map(config-ethernet-1/1/g5)# no switchport
AXOS-22405-class-map(config-ethernet-1/1/g5)#

From below confd_developer.log, there is only set_elem request to set switchport
value to default value ENABLED and there is no delete ip request.

16-Dec-2020::09:47:47.201 AXOS-22405-class-map confd[7207]: devel-c write_start succeeded daemon id: 2 session id: 601
16-Dec-2020::09:47:47.205 AXOS-22405-class-map confd[7207]: devel-c set_elem request for callpoint imxs_cli_config_cp path /exa:config/interface/ethernet{1/1/g5}/switchport
16-Dec-2020::09:47:47.207 AXOS-22405-class-map confd[7207]: devel-c set_elem succeeded for callpoint imxs_cli_config_cp path /exa:config/interface/ethernet{1/1/g5}/switchport
16-Dec-2020::09:47:47.213 AXOS-22405-class-map confd[7207]: confd commit progress db=running usid=36 thandle=601: leaving write-start phase for running
16-Dec-2020::09:47:47.214 AXOS-22405-class-map confd[7207]: confd commit progress db=running usid=36 thandle=601: entering prepare phase for running…
16-Dec-2020::09:47:47.214 AXOS-22405-class-map confd[7207]: confd commit progress db=running usid=36 thandle=601: cdb: prepare

But if run “switchport ENABLED”, CONFD does trigger delete ip address request to our EDP.

AXOS-22405-class-map(config-ethernet-1/1/g5)# switchport DISABLED
AXOS-22405-class-map(config-ethernet-1/1/g5)# ip address 20.20.20.1/24
AXOS-22405-class-map(config-ethernet-1/1/g5)# switchport ENABLED
AXOS-22405-class-map(config-ethernet-1/1/g5)#

==confd_developer.log

16-Dec-2020::09:49:48.512 AXOS-22405-class-map confd[7207]: devel-c write_start request daemon id: 2 session id: 604
16-Dec-2020::09:49:48.513 AXOS-22405-class-map confd[7207]: confd commit progress db=running usid=36 thandle=604: entering write-start phase for running…
16-Dec-2020::09:49:48.513 AXOS-22405-class-map confd[7207]: confd commit progress db=running usid=36 thandle=604: cdb: write-start
16-Dec-2020::09:49:48.514 AXOS-22405-class-map confd[7207]: confd commit progress db=running usid=36 thandle=604: lmd: write-start
16-Dec-2020::09:49:48.515 AXOS-22405-class-map confd[7207]: devel-c write_start succeeded daemon id: 2 session id: 604
16-Dec-2020::09:49:48.519 AXOS-22405-class-map confd[7207]: devel-c set_elem request for callpoint imxs_cli_config_cp path /exa:config/interface/ethernet{1/1/g5}/switchport
16-Dec-2020::09:49:48.521 AXOS-22405-class-map confd[7207]: devel-c set_elem succeeded for callpoint imxs_cli_config_cp path /exa:config/interface/ethernet{1/1/g5}/switchport
16-Dec-2020::09:49:48.522 AXOS-22405-class-map confd[7207]: devel-c delete request for callpoint imxs_cli_config_cp path /exa:config/interface/ethernet{1/1/g5}/ip/address{20.20.20.1/24}
16-Dec-2020::09:49:48.524 AXOS-22405-class-map confd[7207]: devel-c delete succeeded for callpoint imxs_cli_config_cp path /exa:config/interface/ethernet{1/1/g5}/ip/address{20.20.20.1/24}
16-Dec-2020::09:49:48.530 AXOS-22405-class-map confd[7207]: confd commit progress db=running usid=36 thandle=604: leaving write-start phase for running
16-Dec-2020::09:49:48.531 AXOS-22405-class-map confd[7207]: confd commit progress db=running usid=36 thandle=604: entering prepare phase for running…

Any idea here? I’ve also tested another when-expression in our yang. Sounds like it has something to do with default value. If there is no default value, the delete request will also be triggered when running “no **”.

The CONFD vision is 6.7.5. Thanks a lot.

Hi,

It seems like you are using the C-style CLI. If so, you need to commit (transaction to CDB) the config after creating the IP address and then delete the switch port followed by another commit (to CDB) in order to have your data provider delete callback be called.

If you only commit (to CDB) after deleting the switchport, ConfD will commit the minimum diff so you will not see a delete and not a create of the IP address either

If you are using the I-style CLI, you would have seen a delete as every command is a transaction in the I-style CLI.

Best regards