ConfD User Community

How to configure CLIs by default in Yang Model


#1

Hi Team,

I have below Yang model,

grouping config-dial-peer-grouping {
  container dial-peer {
    description
      "Dial Map (Peer) configuration commands";
    list voice {
      description
        "Voice type";
      tailf:cli-mode-name "config-dial-peer";
      key "dialpeertag";
      leaf dialpeertag {
        tailf:cli-suppress-range;
        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;
        type enumeration {
          enum "pots";
          enum "voip";
        }
      }
      container session {
        description
          "The session [ target | protocol | transport ] for this peer";
        when "../type = 'voip'";
        leaf protocol {
          description
            "The session protocol to be used in getting to this peer";
          type enumeration {
            enum cisco {
              description
              "Ciso Session Protocol";
            }
            enum sipv2 {
              description
              "IETF Session Initiation Protocol";
            }
            enum multicast {
              description
              "Multicast Session Protocol(voice conferencing)";
            }
          }
          default sipv2;
        }
        container class {
          presence true;
        }
      }
    }
  }
}

Requirement : If I have dial-peer voip then session protocol sipv2 CLI configured by default.

I want o/p something like below,

ubuntu-xenial(config)# dial-peer voice 4 voip
ubuntu-xenial(config-dial-peer)# show full-config
dial-peer voice 4 voip
 session protocol sipv2
!

Is there any way to achieve above thing. Please reply asap.

Thnx


#2

But it is already there, only the value is not shown in plain show full-config. Run this:

box(config)# dial-peer voice 4 voip
box(config-dial-peer)# show full-config | details
dial-peer voice 4 voip
 session protocol sipv2
!
box(config-dial-peer)# 

Also northbound interfaces/APIs would typically see the value there (depending on default value handling mode); isn’t that enough?