Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def runVlanSpecialTest(self, test):
self.logStartTest(desc)
jInput = json.loads(self.readJsonInput(test))
# check all Vlan from 1 to 4094
for i in range(4095):
for i in range(1,4095):
vlan = 'Vlan'+str(i)
jInput["sonic-vlan:sonic-vlan"]["sonic-vlan:VLAN"]["VLAN_LIST"]\
[0]["name"] = vlan
Expand Down
6 changes: 5 additions & 1 deletion src/sonic-yang-models/yang-models/sonic-vlan.yang
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ module sonic-vlan {

description "VLAN yang Module for SONiC OS";

revision 2021-04-28 {
description "Modify Vlan name constraint to allow only legal Vlan names";
}

revision 2021-04-22 {
description "Modify Vlan Member to include PortChannel along with Port";
}
Expand Down Expand Up @@ -178,7 +182,7 @@ module sonic-vlan {

leaf name {
type string {
pattern 'Vlan([0-9]{1,3}|[1-3][0-9]{3}|[4][0][0-8][0-9]|[4][0][9][0-4])';

This comment was marked as resolved.

Copy link
Author

@matiAlfaro matiAlfaro Feb 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original regex allows for Vlan0, Vlan00, Vlan000, Vlan01 ext...
I'll have a go at #12256

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're right, the first group in original regex was too broad. And thanks!

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])';
}
}

Expand Down