Skip to content

Commit 5f235a9

Browse files
[yang_models]: Update extension yang and types yang with new yang ext… (#6861)
* [yang_models]: Update extension yang and types yang with new yang extensions and types respectively. * [YANG] Added CVL specific type and moved sonic-types to j2 template.
1 parent 368b038 commit 5f235a9

12 files changed

+101
-28
lines changed

src/sonic-yang-models/yang-models/sonic-breakout_cfg.yang

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ module sonic-breakout_cfg {
77

88
import sonic-extension {
99
prefix ext;
10-
revision-date 2019-07-01;
1110
}
1211

1312
description "BREAKOUT_CFG YANG Module for SONiC OS";

src/sonic-yang-models/yang-models/sonic-crm.yang

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ module sonic-crm {
77

88
import sonic-types {
99
prefix stypes;
10-
revision-date 2019-07-01;
1110
}
1211

1312
description "CRM YANG Module for SONiC OS";

src/sonic-yang-models/yang-models/sonic-device_metadata.yang

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ module sonic-device_metadata {
1515

1616
import sonic-types {
1717
prefix stypes;
18-
revision-date 2019-07-01;
1918
}
2019

2120
description "DEVICE_METADATA YANG Module for SONiC OS";

src/sonic-yang-models/yang-models/sonic-device_neighbor.yang

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ module sonic-device_neighbor {
1111

1212
import sonic-extension {
1313
prefix ext;
14-
revision-date 2019-07-01;
1514
}
1615

1716
import sonic-port {

src/sonic-yang-models/yang-models/sonic-extension.yang

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/sonic-yang-models/yang-models/sonic-interface.yang

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@ module sonic-interface {
77

88
import sonic-types {
99
prefix stypes;
10-
revision-date 2019-07-01;
1110
}
1211

1312
import sonic-extension {
1413
prefix ext;
15-
revision-date 2019-07-01;
1614
}
1715

1816
import sonic-port {

src/sonic-yang-models/yang-models/sonic-loopback-interface.yang

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@ module sonic-loopback-interface {
77

88
import sonic-types {
99
prefix stypes;
10-
revision-date 2019-07-01;
1110
}
1211

1312
import sonic-extension {
1413
prefix ext;
15-
revision-date 2019-07-01;
1614
}
1715

1816
import sonic-vrf {

src/sonic-yang-models/yang-models/sonic-port.yang

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@ module sonic-port{
77

88
import sonic-types {
99
prefix stypes;
10-
revision-date 2019-07-01;
1110
}
1211

1312
import sonic-extension {
1413
prefix ext;
15-
revision-date 2019-07-01;
1614
}
1715

1816
description "PORT yang Module for SONiC OS";

src/sonic-yang-models/yang-models/sonic-portchannel.yang

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@ module sonic-portchannel {
77

88
import sonic-types {
99
prefix stypes;
10-
revision-date 2019-07-01;
1110
}
1211

1312
import sonic-extension {
1413
prefix ext;
15-
revision-date 2019-07-01;
1614
}
1715

1816
import sonic-port {
@@ -138,7 +136,7 @@ module sonic-portchannel {
138136
path "/lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:name";
139137
}
140138
}
141-
139+
142140
leaf port {
143141
/* key elements are mandatory by default */
144142
type leafref {

src/sonic-yang-models/yang-models/sonic-vlan.yang

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@ module sonic-vlan {
1111

1212
import sonic-types {
1313
prefix stypes;
14-
revision-date 2019-07-01;
1514
}
1615

1716
import sonic-extension {
1817
prefix ext;
19-
revision-date 2019-07-01;
2018
}
2119

2220
import sonic-port {
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
module sonic-extension {
2+
3+
yang-version 1.1;
4+
5+
namespace "http://github.com/Azure/sonic-extension";
6+
prefix sonic-extension;
7+
8+
description "Extension yang Module for SONiC OS";
9+
10+
revision 2019-07-01 {
11+
description "First Revision";
12+
}
13+
14+
/* For complete guide of using these extensions in SONiC yangs, refer
15+
SONiC yang guidelines at
16+
https://github.com/Azure/SONiC/blob/master/doc/mgmt/SONiC_YANG_Model_Guidelines.md */
17+
18+
extension db-name {
19+
description "DB name, e.g. APPL_DB, CONFIG_DB";
20+
argument "value";
21+
}
22+
23+
{% if yang_model_type == "cvl" %}
24+
extension custom-validation-cvl {
25+
description "Extension for registering cvl based custom validation handler.";
26+
argument "handler";
27+
}
28+
29+
extension dependent-on {
30+
description
31+
"Extension to define dependency on other table. During CREATE/UPDATE,
32+
the action will be performed first on the Parent table and then on the
33+
Dependent table. In DELETE operation, the Dependent table will be
34+
deleted first and then the Parent table. This extension can be defined
35+
only under List nodes. Table name should always be suffixed with '_LIST'
36+
as modeled in yang. e.g. - dependent-on STP_LIST";
37+
argument "value";
38+
}
39+
{% else %}
40+
{% endif %}
41+
}

src/sonic-yang-models/yang-models/sonic-types.yang renamed to src/sonic-yang-models/yang-templates/sonic-types.yang.j2

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,42 @@ module sonic-types {
155155
}
156156
}
157157

158+
typedef oper-status {
159+
type enumeration {
160+
enum unknown;
161+
enum up;
162+
enum down;
163+
}
164+
description "Operational status of an entity such as Port, MCLAG etc";
165+
}
166+
167+
typedef mode-status {
168+
type enumeration {
169+
enum enable;
170+
enum disable;
171+
}
172+
description
173+
"This type can be used where toggle functionality required.
174+
For ex. IPv6-link-local-only, Dhcp-replay-link-select, SNMP traps etc";
175+
}
176+
177+
typedef dhcp-relay-policy-action {
178+
type enumeration {
179+
enum discard;
180+
enum append;
181+
enum replace;
182+
}
183+
description "DHCP relay policy action value";
184+
}
185+
186+
typedef percentage {
187+
type uint8 {
188+
range "0..100";
189+
}
190+
description
191+
"Integer indicating a percentage value";
192+
}
193+
158194
typedef tpid_type {
159195
type string {
160196
pattern "0x8100|0x9100|0x9200|0x88a8|0x88A8";
@@ -185,4 +221,27 @@ module sonic-types {
185221
enum transit;
186222
}
187223
}
224+
225+
226+
227+
/* Required for CVL */
228+
{% if yang_model_type == "cvl" %}
229+
container operation {
230+
description
231+
"This definition is used internally by CVL and
232+
is not exposed in NBI. Leaf 'operation' allows
233+
evaluation of must expression for
234+
CREATE/UPDATE/DELETE operation.";
235+
236+
leaf operation {
237+
type enumeration {
238+
enum NOP;
239+
enum CREATE;
240+
enum UPDATE;
241+
enum DELETE;
242+
}
243+
}
244+
}
245+
{% else %}
246+
{% endif %}
188247
}

0 commit comments

Comments
 (0)