module sonic-loopback-interface {
yang-version 1.1;
namespace "http://github.com/Azure/sonic-loopback-interface";
prefix lointf;
import sonic-types {
prefix stypes;
revision-date 2019-07-01;
}
import sonic-extension {
prefix ext;
import sonic-vrf {
prefix vrf;
description
"SONIC LOOPBACK INTERFACE";
revision 2021-04-05 {
description "Modify the type of vrf name";
revision 2020-02-05 {
description "First Revision";
container sonic-loopback-interface {
container LOOPBACK_INTERFACE {
list LOOPBACK_INTERFACE_LIST {
key "name";
leaf name{
type string;
leaf vrf_name {
type leafref {
path "/vrf:sonic-vrf/vrf:VRF/vrf:VRF_LIST/vrf:name";
/* end of LOOPBACK_INTERFACE_LIST */
list LOOPBACK_INTERFACE_IPPREFIX_LIST {
key "name ip-prefix";
/* This node must be present in LOOPBACK_INTERFACE_LIST */
must "(current() = ../../LOOPBACK_INTERFACE_LIST[name=current()]/name)"
{
error-message "Must condition not satisfied, Try adding lo<>: {}, Example: 'lo1': {}";
leaf ip-prefix {
type union {
type stypes:sonic-ip4-prefix;
type stypes:sonic-ip6-prefix;
leaf scope {
type enumeration {
enum global;
enum local;
leaf family {
/* family leaf needed for backward compatibility
Both ip4 and ip6 address are string in IETF RFC 6021,
so must statement can check based on : or ., family
should be IPv4 or IPv6 according.
*/
must "(contains(../ip-prefix, ':') and current()='IPv6') or
(contains(../ip-prefix, '.') and current()='IPv4')";
type stypes:ip-family;
/* end of LOOPBACK_INTERFACE_IPPREFIX_LIST */