sonic-buildimage/src/sonic-yang-models/yang-models/sonic-loopback-interface.yang
Praveen Chaudhary 2b7a3ac6c0
[yang-models]: Change name-space from Azure to sonic-net. (#12416)
Changes:
-- Change name-space from Azure to sonic-net.
-- Sort yang list in setup.py for yang-models list.

#### Why I did it
Sonic repo has moved to Linux-foundation.

#### How I did it
[yang-models]: Change name-space from Azure to sonic-net.

#### How to verify it
PR Tests are good enough to verify.
2022-10-31 16:37:25 -07:00

104 lines
2.7 KiB
YANG

module sonic-loopback-interface {
yang-version 1.1;
namespace "http://github.com/sonic-net/sonic-loopback-interface";
prefix lointf;
import sonic-types {
prefix stypes;
}
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";
}
}
leaf nat_zone {
description "NAT Zone for the loopback interface";
type uint8 {
range "0..3" {
error-message "Invalid nat zone for the loopback interface.";
error-app-tag nat-zone-invalid;
}
}
default "0";
}
}
/* end of LOOPBACK_INTERFACE_LIST */
list LOOPBACK_INTERFACE_IPPREFIX_LIST {
key "name ip-prefix";
leaf name{
description "Loopback interface name";
type leafref {
path "../../LOOPBACK_INTERFACE_LIST/name";
}
}
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 */
}
}