Skip to content

Commit cc36a14

Browse files
[yang]: SONiC Yang model for PORTCHANNEL_INTERFACE table (sonic-net#7034)
* SONiC Yang model for PORTCHANNEL_INTERFACE table Signed-off-by: Arthi Sivanantham <[email protected]>
1 parent d3d0c26 commit cc36a14

5 files changed

Lines changed: 78 additions & 2 deletions

File tree

src/sonic-yang-models/tests/yang_model_tests/test_yang_model.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ def initTest(self):
6565
'desc': 'Configure a member port in PORT_CHANNEL table.',
6666
'eStr': self.defaultYANGFailure['None']
6767
},
68+
'PORTCHANNEL_INTERFACE_IP_ADDR_TEST': {
69+
'desc': 'Configure IP address on PORTCHANNEL_INTERFACE table.',
70+
'eStr': self.defaultYANGFailure['None']
71+
},
72+
'PORTCHANNEL_INTERFACE_IP_ADDR_ON_NON_EXIST_PO': {
73+
'desc': 'Configure IP address on a non existent PortChannel.',
74+
'eStr': self.defaultYANGFailure['LeafRef']
75+
},
6876
'VLAN_MEMEBER_WITH_NON_EXIST_VLAN': {
6977
'desc': 'Configure vlan-id in VLAN_MEMBER table which does not exist in VLAN table.',
7078
'eStr': self.defaultYANGFailure['LeafRef']

src/sonic-yang-models/tests/yang_model_tests/yangTest.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,39 @@
137137
}
138138
},
139139

140+
"PORTCHANNEL_INTERFACE_IP_ADDR_TEST": {
141+
"sonic-portchannel:sonic-portchannel": {
142+
"sonic-portchannel:PORTCHANNEL": {
143+
"PORTCHANNEL_LIST": [{
144+
"name": "PortChannel0001",
145+
"admin_status": "up"
146+
}]
147+
},
148+
"sonic-portchannel:PORTCHANNEL_INTERFACE": {
149+
"PORTCHANNEL_INTERFACE_IPPREFIX_LIST": [{
150+
"name": "PortChannel0001",
151+
"ip_prefix": "1.1.1.1/24"
152+
}]
153+
}
154+
}
155+
},
156+
157+
"PORTCHANNEL_INTERFACE_IP_ADDR_ON_NON_EXIST_PO": {
158+
"sonic-portchannel:sonic-portchannel": {
159+
"sonic-portchannel:PORTCHANNEL": {
160+
"PORTCHANNEL_LIST": [{
161+
"name": "PortChannel0001"
162+
}]
163+
},
164+
"sonic-portchannel:PORTCHANNEL_INTERFACE": {
165+
"PORTCHANNEL_INTERFACE_IPPREFIX_LIST": [{
166+
"name": "PortChannel0002",
167+
"ip_prefix": "2.2.2.2/24"
168+
}]
169+
}
170+
}
171+
},
172+
140173
"PORT_CHANNEL_WRONG_PATTERN": {
141174
"sonic-portchannel:sonic-portchannel": {
142175
"sonic-portchannel:PORTCHANNEL": {

src/sonic-yang-models/yang-models/sonic-acl.yang

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

2727
import sonic-portchannel {
2828
prefix lag;
29-
revision-date 2019-07-01;
3029
}
3130

3231
description "ACL YANG Module for SONiC OS";

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

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,15 @@ module sonic-portchannel {
2222

2323
description "PORTCHANNEL yang Module for SONiC OS";
2424

25+
revision 2021-03-15 {
26+
description "Add SONiC PortChannel Interface model";
27+
}
28+
2529
revision 2019-07-01 {
2630
description "First Revision";
2731
}
2832

33+
2934
container sonic-portchannel {
3035
container PORTCHANNEL {
3136

@@ -85,6 +90,30 @@ module sonic-portchannel {
8590

8691
} /* end of container PORTCHANNEL */
8792

93+
94+
container PORTCHANNEL_INTERFACE {
95+
96+
description "PORTCHANNEL_INTERFACE part of config_db.json";
97+
98+
list PORTCHANNEL_INTERFACE_IPPREFIX_LIST {
99+
100+
key "name ip_prefix";
101+
102+
leaf name {
103+
/* key elements are mandatory by default */
104+
type leafref {
105+
path "/lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:name";
106+
}
107+
}
108+
109+
leaf ip_prefix {
110+
/* key elements are mandatory by default */
111+
type stypes:sonic-ip-prefix;
112+
}
113+
} /* end of list PORTCHANNEL_INTERFACE_IPPREFIX_LIST */
114+
115+
} /* end of container PORTCHANNEL_INTERFACE */
116+
88117
} /* end of container sonic-portchannel */
89118

90-
} /* end of module sonic-port */
119+
} /* end of module sonic-portchannel */

src/sonic-yang-models/yang-models/sonic-types.yang

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ module sonic-types {
4444
}
4545
}
4646

47+
typedef sonic-ip-prefix {
48+
type union {
49+
type sonic-ip4-prefix;
50+
type sonic-ip6-prefix;
51+
}
52+
}
53+
4754
typedef admin_status {
4855
type enumeration {
4956
enum up;

0 commit comments

Comments
 (0)