Skip to content

Commit 814badb

Browse files
author
Mati Alfaro
authored
[Yang-models] Update sonic-vlan.yang to better constrain Vlan name (#18207)
Related to #3155 Update sonic-vlan.yang model to match requirement as described in #16975 Signed-off-by: matiAlfaro <[email protected]>
1 parent 7bd83cc commit 814badb

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def runVlanSpecialTest(self, test):
235235
self.logStartTest(desc)
236236
jInput = json.loads(self.readJsonInput(test))
237237
# check all Vlan from 1 to 4094
238-
for i in range(4095):
238+
for i in range(1,4095):
239239
vlan = 'Vlan'+str(i)
240240
jInput["sonic-vlan:sonic-vlan"]["sonic-vlan:VLAN"]["VLAN_LIST"]\
241241
[0]["name"] = vlan

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ module sonic-vlan {
3636

3737
description "VLAN yang Module for SONiC OS";
3838

39+
revision 2021-04-28 {
40+
description "Modify Vlan name constraint to allow only legal Vlan names";
41+
}
42+
3943
revision 2021-04-22 {
4044
description "Modify Vlan Member to include PortChannel along with Port";
4145
}
@@ -178,7 +182,7 @@ module sonic-vlan {
178182

179183
leaf name {
180184
type string {
181-
pattern 'Vlan([0-9]{1,3}|[1-3][0-9]{3}|[4][0][0-8][0-9]|[4][0][9][0-4])';
185+
pattern 'Vlan(409[0-5]|40[0-8][0-9]|[1-3][0-9]{3}|[1-9][0-9]{2}|[1-9][0-9]|[1-9])';
182186
}
183187
}
184188

0 commit comments

Comments
 (0)