ConfD User Community

Displaying all leaf if condition statisfies


#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 {
         when "../type = 'voip'";
          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{
  when  "../type = 'voip'";
  type string;
}

Configuration part:
Assumption : 400 dial-peertag already created.

Now, When I am doing further configuration for dial-peer 400 this is how it id displaying,

ubuntu-xenial(config)# native dial-peer voice ?
Possible completions:
  <dialpeertag:unsignedInt, 1 .. 1073741823>  400
ubuntu-xenial(config)# native dial-peer voice 400 ?
Possible completions:
  [voip]
  description           Dial peer specific description
  destination-pattern   A full E.164 telephone number prefix
   pots

It is displaying all the nodes which statisfy voip when condition after dialpeer tag which is not expected behaviour.

I want something like below,

vcme-s(config)#dial-peer voice 500 ?
  voip  Voice over IP
  <cr>  <cr>

where 500 dialpeer already created . It should not other display nodes. not infact pots also as pots can’t have same tag no which is assigned to voip.

How I can achieve above behaviour. ? Any help would be appreciated.


#2

I see almost exactly the behavior you require:

box(config)# dial-peer voice 400 ?
Possible completions:
  pots   
  voip   Voice over IP
  <cr>   
box(config)# 

Maybe an old ConfD version? I am using 6.7.3.

Now to your request that the value pots is not available: does it mean you do not want the operator to change the type once it has been configured? In the “simplest” form it can be done through a validation callback, would that be enough?