Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mstp_yang_co_pr #21197

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from
Draft
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
1,018 changes: 1,018 additions & 0 deletions SONiC_YANG_Model_Guidelines.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/sonic-yang-mgmt/sonic_yang_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
'EXP_TO_FC_MAP_LIST',
'CABLE_LENGTH_LIST',
'MPLS_TC_TO_TC_MAP_LIST',
'TC_TO_DSCP_MAP_LIST'
'TC_TO_DSCP_MAP_LIST',
]

# Workaround for those fields who is defined as leaf-list in YANG model but have string value in config DB.
Expand Down
2 changes: 2 additions & 0 deletions src/sonic-yang-models/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ def run(self):
'./yang-models/sonic-xcvrd-log.yang',
'./yang-models/sonic-grpcclient.yang',
'./yang-models/sonic-serial-console.yang',
'./yang-models/sonic-spanning-tree.yang',
'./yang-models/sonic-smart-switch.yang',
'./yang-models/sonic-srv6.yang']),
('cvlyang-models', ['./cvlyang-models/sonic-acl.yang',
Expand Down Expand Up @@ -292,6 +293,7 @@ def run(self):
'./cvlyang-models/sonic-macsec.yang',
'./cvlyang-models/sonic-bmp.yang',
'./cvlyang-models/sonic-serial-console.yang',
'./cvlyang-models/sonic-spanning-tree.yang',
'./cvlyang-models/sonic-bgp-sentinel.yang']),
],
zip_safe=False,
Expand Down
130 changes: 130 additions & 0 deletions src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -2363,6 +2363,136 @@
}
},

"STP": {
"GLOBAL": {
"mode": "pvst",
"rootguard_timeout": "30",
"forward_delay": "15",
"hello_time": "2",
"max_age": "20",
"priority": "32768"
}
},
"STP_VLAN": {
"Vlan100": {
"forward_delay": "15",
"hello_time": "2",
"max_age": "20",
"priority": "32768",
"enabled": "true",
"vlanid": "100"
},
"Vlan200": {
"forward_delay": "16",
"hello_time": "3",
"max_age": "22",
"priority": "16384",
"enabled": "true",
"vlanid": "200"
}
},
"STP_VLAN_PORT": {
"Vlan100|Ethernet0": {
"path_cost": "200000",
"priority": "128"
},
"Vlan100|PortChannel2": {
"path_cost": "20000",
"priority": "64"
},
"Vlan200|Ethernet4": {
"path_cost": "200000",
"priority": "128"
}
},
"STP_PORT": {
"Ethernet0": {
"enabled": "true",
"root_guard": "false",
"bpdu_guard": "false",
"bpdu_guard_do_disable": "false",
"path_cost": "200000",
"priority": "128",
"portfast": "true",
"uplink_fast": "false"
},
"Ethernet4": {
"enabled": "true",
"root_guard": "false",
"bpdu_guard": "true",
"bpdu_guard_do_disable": "true",
"path_cost": "200000",
"priority": "128",
"portfast": "false",
"uplink_fast": "false"
},
"PortChannel2": {
"enabled": "true",
"root_guard": "true",
"bpdu_guard": "false",
"bpdu_guard_do_disable": "false",
"path_cost": "20000",
"priority": "64",
"portfast": "false",
"uplink_fast": "true"
}
},
"STP": {
"GLOBAL": {
"mode": "mst",
"forward_delay": 15,
"hello_time": 2,
"max_age": 20,
"priority": 32768
}
},
"STP_MST": {
"GLOBAL": {
"name": "region1",
"revision": "0",
"max_hops": "20",
"max_age": "20",
"hello_time": "2",
"forward_delay": "15",
"hold_count": "6"
}
},
"STP_MST_INST": {
"0": {
"bridge_priority": "32768",
"vlan": ["1-99", "4000-4094"]
},
"1": {
"bridge_priority": "16384",
"vlan": ["100-199"]
},
"2": {
"bridge_priority": "20480",
"vlan": ["200-299"]
},
"3": {
"bridge_priority": "24576",
"vlan": ["300-399"]
}
},
"STP_MST_PORT": {
"0|Ethernet0": {
"path_cost": "200000",
"priority": "128"
},
"1|Ethernet0": {
"path_cost": "200000",
"priority": "128"
},
"2|Ethernet4": {
"path_cost": "200000",
"priority": "128"
},
"3|PortChannel2": {
"path_cost": "20000",
"priority": "64"
}
},

"MCLAG_DOMAIN": {
"123": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,9 @@ def test_run_tests(self):
for test in self.tests:
test = test.strip()
if test in self.ExceptionTests:
ret = ret + self.runExceptionTest(test);
ret = ret + self.runExceptionTest(test)
elif test in self.SpecialTests:
ret = ret + self.runSpecialTest(test);
ret = ret + self.runSpecialTest(test)
else:
raise Exception("Unexpected Test")
except Exception as e:
Expand Down
6 changes: 6 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests/stp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"PVST_GLOBAL_VALID": {
"desc": "Configure valid global PVST settings",
"eStr": []
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"PVST_GLOBAL_VALID": {
"sonic-spanning-tree:sonic-spanning-tree": {
"sonic-spanning-tree:STP": {
"STP_LIST": [
{
"keyleaf": "GLOBAL",
"mode": "pvst",
"rootguard_timeout": 30,
"forward_delay": 15,
"hello_time": 2,
"max_age": 20,
"priority": 32768
}
]
}
}
}
}
Loading
Loading