Yang: Force user to type full command and few doubts on leafref

Hello Experts,

I have few queries regarding yang. Can someone please help me to sort out this. Below is my yang file and I have few questions

     container ntp {
     tailf:info "NTP Configuration";
     tailf:cli-oper-info "Display NTP information";

     container auth {
       tailf:info "Configure NTP authentication keys";
       list server {
         tailf:info "Configured ip addresses";

         key "serverip";

         leaf serverip {
           tailf:info "ip address";
           type leafref {
           path "/gw-system:ntp/server";
       leaf key {
         tailf:info "Authentication key ID for this server";
         type uint32 {
         range "1..65535";
    choice authtype {
      leaf sha256 {
        tailf:info "Value of the sha256 key";
        type tailf:aes-cfb-128-encrypted-string {
        tailf:info "Cleartext or AES encrypted key";
  1. Don’t show <cr> until full command is completed.
    I am getting <cr> at choice authtype attribute. I have already used cli-incomplete-command with cli-sequence-command but still I am getting <cr> at choice authtype attribute.
    It works fine till attribute leaf key but after that I get <cr> along with leaf sha256. How to make sure user enters full command.

  2. I have used leafref serverip so that user can input only available options to which this leaf serverip is referring to it is working fine.
    But the problem is if user give any input which is not in the bucket to which leafref serverip is referring then it gives error while commit. Is there any way to restrict user during input only and not while commit.

  3. Is it possible to delete all leaf references automatically if the main leaf which is getting referred by other leafs get deleted.

Can someone please provide your input to the above questions

Placing the tailf:cli-incomplete-command extension in a choice should result in a confdc compile error. It should for example be placed in the leaf statement instead.

See the YANG 1.1 require-instance statement: https://datatracker.ietf.org/doc/html/rfc7950#section-9.9.3