-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
Copy pathsonic-interface.yang
141 lines (109 loc) · 2.92 KB
/
sonic-interface.yang
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
module sonic-interface {
yang-version 1.1;
namespace "http://github.com/sonic-net/sonic-interface";
prefix intf;
import sonic-types {
prefix stypes;
}
import sonic-extension {
prefix ext;
}
import sonic-port {
prefix port;
revision-date 2019-07-01;
}
import sonic-vrf {
prefix vrf;
}
description "INTERFACE yang Module for SONiC OS";
revision 2021-03-30 {
description "Modify the type of vrf name";
}
revision 2019-07-01 {
description "First Revision";
}
container sonic-interface {
container INTERFACE {
description "INTERFACE part of config_db.json";
list INTERFACE_LIST {
description "INTERFACE part of config_db.json with vrf";
key "name";
leaf name {
type leafref {
path /port:sonic-port/port:PORT/port:PORT_LIST/port:name;
}
}
leaf vrf_name {
type leafref {
path "/vrf:sonic-vrf/vrf:VRF/vrf:VRF_LIST/vrf:name";
}
}
leaf nat_zone {
description "NAT Zone for the interface";
type uint8 {
range "0..3" {
error-message "Invalid nat zone for the interface.";
error-app-tag nat-zone-invalid;
}
}
default "0";
}
leaf mpls {
description "Enable/disable MPLS routing for the interface";
type enumeration {
enum enable;
enum disable;
}
}
leaf ipv6_use_link_local_only {
description "Enable/Disable IPv6 link local address on interface";
type stypes:mode-status;
default disable;
}
leaf loopback_action {
description "Packet action when a packet ingress and gets routed on the same IP interface";
type stypes:loopback_action;
}
}
/* end of INTERFACE_LIST */
list INTERFACE_IPPREFIX_LIST {
description "INTERFACE part of config_db.json with ip-prefix";
key "name ip-prefix";
leaf name {
/* This node must be present in INTERFACE_LIST */
must "(current() = ../../INTERFACE_LIST[name=current()]/name)"
{
error-message "Must condition not satisfied, Try adding PORT: {}, Example: 'Ethernet0': {}";
}
type leafref {
path /port:sonic-port/port:PORT/port:PORT_LIST/port: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 INTERFACE_IPPREFIX_LIST */
}
/* end of INTERFACE container */
}
}