ConfD User Community

How to restrict leaf to display if present in list


#1

Hi Team,

I have below structure ,

grouping config-dial-peer-grouping {
    container dial-peer {
      description
        "Dial Map (Peer) configuration commands";
      tailf:info
        "Dial Map (Peer) configuration commands";
      list voice {
        description
          "Voice type";
        tailf:info
          "Voice type";
        tailf:cli-mode-name "config-dial-peer";
        key "dialpeertag";
        leaf dialpeertag {
          description
            "Voice dial-peer tag";
          tailf:info
            "Voice dial-peer tag";
          tailf:cli-suppress-range;
          tailf:cli-hide-in-submode;
          type uint32 {
            range "1..1073741823" {
              error-message "Input dial-peer tag is out of range.It should be in range of 1..1073741823";
            }
          }
        }
        leaf type {
          description
            "Dial peer type";
          tailf:cli-hide-in-submode;
          tailf:cli-drop-node-name;
          //tailf:cli-full-command;
          type enumeration {
            enum "pots";
            enum "voip" {
              tailf:info "Voice over IP";
            }
          }
        }
 leaf description {
          description
            "Dial peer specific description";
          tailf:cli-multi-value;
          tailf:cli-full-command;
          tailf:cli-preformatted;
          tailf:cli-no-value-on-delete;
          type string {
            pattern '.*';
            length "1..64";
          }
        }
leaf destination-pattern{
  type string;
}

So When I configure ,

ubuntu-xenial(config)# native dial-peer voice 500 ?
Possible completions:
  description
  destination-pattern

It is showing me , description and destination during configuring dialpeer tag and i want these options to be visible only when voip /pots is configured(when it enters into sub-mode)

So i can do that?

I want something like this,

vcme-s(config)#dial-peer voice 300 ?
  pots  Telephony
  voip  Voice over IP
vcme-s(config-dial-peer)#?
description            Dialpeer specific description                                                
  destination-pattern    A full E.164 telephone number prefix

#2

Try following:

leaf description {
when “…/type = ‘pots’”;
}


#3

After doing this , not visible.

But once created let say (400 tag) , now when doing further configuration it started showing me again .
dial-peer voice 400 ?
possible combinations
[voip]
description
pots
destination-pattern

This time I want only voip should be visible . Also this is allowing pots to have same tag value that also i want to restrict as it dialpeertag should be unique for pots and voip.

How i can do that now?

want something like this,
dial-peer voice 400 ?
voip