Skip to content

Commit

Permalink
[Yang-models] Update sonic-vlan.yang to better constrain Vlan name (#…
Browse files Browse the repository at this point in the history
…18207)

Related to #3155
Update sonic-vlan.yang model to match requirement as described in #16975

Signed-off-by: matiAlfaro <mati@marvell.com>
  • Loading branch information
matiAlfaro authored Mar 30, 2024
1 parent 7bd83cc commit 814badb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
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])';
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

0 comments on commit 814badb

Please sign in to comment.