Problem of using tailf:link to link to confd_dyncfg.yang

Hi,
Following the guide in “28.4.2. Storing ConfD configuration parameters in CDB”, I write a YANG model as below, in order to allow operator modify the maximum CLI/netconf session number in runtime.

While I encounter a problem that deleting the /yang-server/session-limits/session-limit/max-cli-sessions cause the /yang-server/session-limits/session-limit/max-netconf-sessions is deleted as well.

My model is as below.

container yang-server {
   presence "";
   description "YANG server configuration.";
container session-limits {
     presence "";
     container session-limit{
       presence "";
       leaf max-cli-sessions {
         type dyncfg:limitType;
         tailf:link "/dyncfg:confdConfig/sessionLimits/sessionLimit[context='cli']/maxSessions";
       }
       leaf max-netconf-sessions {
         type dyncfg:limitType;
         tailf:link "/dyncfg:confdConfig/sessionLimits/sessionLimit[context='netconf']/maxSessions";
       }
     }
     container config-session-limit{
       presence "";
       leaf max-cli-sessions {
          type dyncfg:limitType;
          tailf:link "/dyncfg:confdConfig/sessionLimits/configSessionLimit[context='cli']/maxSessions";
        }
        leaf max-netconf-sessions {
          type dyncfg:limitType;
          tailf:link "/dyncfg:confdConfig/sessionLimits/configSessionLimit[context='netconf']/maxSessions";
        }
      }
    }
}


And I write the confd_dyncfg_init.xml as below.

<config xmlns="http://tail-f.com/ns/config/1.0">
  <confdConfig xmlns="http://tail-f.com/ns/confd_dyncfg/1.0">
      <sessionLimits>
        <sessionLimit>
                <context>cli</context>
                <maxSessions>16</maxSessions>
        </sessionLimit>
         <sessionLimit>
                 <context>netconf</context>
                 <maxSessions>16</maxSessions>
         </sessionLimit>
         <configSessionLimit>
                 <context>cli</context>
                 <maxSessions>16</maxSessions>
         </configSessionLimit>
         <configSessionLimit>
                  <context>netconf</context>
                  <maxSessions>16</maxSessions>
         </configSessionLimit>
      </sessionLimits>
  </confdConfig>
</config>

I firstly change the yang-server/session-limits/session-limit/max-cli-sessions to 8, the problem is not only the yang-server/session-limits/session-limit/max-cli-sessions is shown to user as the new configuration, but also the yang-server/session-limits/session-limit/max-netconf-sessions is shown to user, even though I do not explicitly configure the max-netconf-sessions.
My operation on Confd_cli is as below.

test# show running-config 
confdConfig sessionLimits sessionLimit netconf
 maxSessions 16
!
confdConfig sessionLimits configSessionLimit cli
 maxSessions 16
!
confdConfig sessionLimits configSessionLimit netconf
 maxSessions 16
!
confdConfig cli
test# config     
Entering configuration mode terminal
test(config)# yang-server session-limits session-limit max-cli-sessions 8
test(config)# show configuration 
yang-server session-limits session-limit max-cli-sessions 8
yang-server session-limits session-limit max-netconf-sessions 16
test(config)# commit
Commit complete.
test(config)# end   
test# show running-config 
confdConfig sessionLimits sessionLimit cli
 maxSessions 8
!
confdConfig sessionLimits sessionLimit netconf
 maxSessions 16
!
confdConfig sessionLimits configSessionLimit cli
 maxSessions 16
!
confdConfig sessionLimits configSessionLimit netconf
 maxSessions 16
!
confdConfig cli
yang-server session-limits session-limit max-cli-sessions 8
yang-server session-limits session-limit max-netconf-sessions 16

You can see that even though the max-netconf-sessions is not configured, it’s displayed as running configuration after I configure the max-cli-sessions.

Then I delete the max-cli-sessions, the problem is the max-netconf-sessions is deleted as well even though I do not delete max-netconf-sessions.

test# config
Entering configuration mode terminal
test(config)# no yang-server session-limits session-limit max-cli-sessions 
test(config)# show configuration 
no yang-server session-limits session-limit max-cli-sessions 8
no yang-server session-limits session-limit max-netconf-sessions 16
test(config)# commit
Commit complete.
test(config)# end
test# show running-config 
confdConfig sessionLimits sessionLimit cli
 maxSessions 8
!
confdConfig sessionLimits sessionLimit netconf
 maxSessions 16
!
confdConfig sessionLimits configSessionLimit cli
 maxSessions 16
!
confdConfig sessionLimits configSessionLimit netconf
 maxSessions 16
!
confdConfig cli
yang-server session-limits

Could you help on this? How could I separate the configuration on /yang-server/session-limits/session-limit/max-cli-sessions/ with the /yang-server/session-limits/session-limit/max-netconf-sessions/

Hi,

Seems normal since your presence containers, including “session-limit”, is also set when you set a list entry in it, therefore all leafs in the container will be shown.

Here it seems like the C-style CLI delete the presence container “session-limit” when you delete the “max-cli-sessions” leaf, and hence the “max-netconf-sessions leaf” is not shown anymore. This may be expected behaviour for a C-style CLI. But I would expect that ConfD should try to delete the “max-cli-sessions” leaf, but that should fail as the leaf that the “max-cli-sessions” link to is mandatory.

I verified that this works as expected in the J-style CLI. I.e. if you delete the “max-cli-sessions” and try to commit, ConfD will abort the commit in the validation phase since the leaf that “max-cli-sessions” link to is mandatory.

Please raise a RT ticket with our support team if you believe that the C-style CLI behaviour when deleting the “max-cli-sessions” leaf is not what you expect.

Thanks a lot for the support.