[yang_models]: yang models for device_metadata, device_neighbor, flex… (#4442)
Changes: 1.) yang models for device_metadata, device_neighbor, flex_counters, crm, versions. 2.) Test cases for above yang models. Signed-off-by: Praveen Chaudhary pchaudhary@linkedin.com:
This commit is contained in:
parent
6c4092d0a2
commit
2fe79c2c61
@ -377,7 +377,8 @@ class SonicYangExtMixin:
|
||||
|
||||
## Handle other leaves in container,
|
||||
leafDict = self._createLeafDict(model)
|
||||
for vKey in configC.keys():
|
||||
vKeys = list(configC.keys())
|
||||
for vKey in vKeys:
|
||||
#vkey must be a leaf\leaf-list\choice in container
|
||||
if leafDict.get(vKey):
|
||||
self.sysLog(syslog.LOG_DEBUG, "xlateContainer vkey {}".format(vKey))
|
||||
|
@ -288,10 +288,13 @@ class Test_SonicYang(object):
|
||||
syc = sonic_yang_data['syc']
|
||||
|
||||
jIn = self.readIjsonInput(test_file, 'SAMPLE_CONFIG_DB_JSON')
|
||||
jIn = json.loads(jIn)
|
||||
numTables = len(jIn)
|
||||
|
||||
syc.loadData(json.loads(jIn))
|
||||
|
||||
# TODO: Make sure no extra table is loaded
|
||||
syc.loadData(jIn)
|
||||
# check all tables are loaded and no tables is without Yang Models
|
||||
assert len(syc.jIn) == numTables
|
||||
assert len(syc.tablesWithOutYang) == 0
|
||||
|
||||
syc.getData()
|
||||
|
||||
|
@ -41,13 +41,19 @@ setup(
|
||||
packages=find_packages(),
|
||||
version='1.0',
|
||||
data_files=[
|
||||
('yang-models', ['./yang-models/sonic-types.yang',
|
||||
('yang-models', ['./yang-models/sonic-acl.yang',
|
||||
'./yang-models/sonic-breakout_cfg.yang',
|
||||
'./yang-models/sonic-crm.yang',
|
||||
'./yang-models/sonic-device_metadata.yang',
|
||||
'./yang-models/sonic-device_neighbor.yang',
|
||||
'./yang-models/sonic-extension.yang',
|
||||
'./yang-models/sonic-acl.yang',
|
||||
'./yang-models/sonic-flex_counter.yang',
|
||||
'./yang-models/sonic-interface.yang',
|
||||
'./yang-models/sonic-loopback-interface.yang',
|
||||
'./yang-models/sonic-port.yang',
|
||||
'./yang-models/sonic-portchannel.yang',
|
||||
'./yang-models/sonic-types.yang',
|
||||
'./yang-models/sonic-versions.yang',
|
||||
'./yang-models/sonic-vlan.yang',
|
||||
'./yang-models/sonic_yang_tree']),
|
||||
],
|
||||
|
@ -125,6 +125,10 @@ class Test_yang_models:
|
||||
'desc': 'Loopback Ip-prefix port-name must condition failure.',
|
||||
'eStr': self.defaultYANGFailure['Must']
|
||||
},
|
||||
'CRM_BRK_CFG_FLEX_TABLE': {
|
||||
'desc': 'CRM BREAKOUT CFG FLEX COUNTER TABLE.',
|
||||
'eStr': self.defaultYANGFailure['None']
|
||||
},
|
||||
'INCORRECT_VLAN_NAME': {
|
||||
'desc': 'INCORRECT VLAN_NAME FIELD IN VLAN TABLE.',
|
||||
'eStr': self.defaultYANGFailure['Pattern'] + ["Vlan"]
|
||||
@ -168,6 +172,52 @@ class Test_yang_models:
|
||||
'PORT_NEG_TEST': {
|
||||
'desc': 'LOAD PORT TABLE FEC PATTERN FAILURE',
|
||||
'eStr': self.defaultYANGFailure['Pattern'] + ['rc']
|
||||
},
|
||||
'CRM_WITH_WRONG_PERCENTAGE': {
|
||||
'desc': 'CRM_WITH_WRONG_PERCENTAGE must condition failure.',
|
||||
'eStr': self.defaultYANGFailure['Must']
|
||||
},
|
||||
'CRM_WITH_HIGH_THRESHOLD_ERR': {
|
||||
'desc': 'CRM_WITH_HIGH_THRESHOLD_ERR must condition failure \
|
||||
about high threshold being lower than low threshold.',
|
||||
'eStr': self.defaultYANGFailure['high_threshold should be more \
|
||||
than low_threshold']
|
||||
},
|
||||
'CRM_WITH_CORRECT_USED_VALUE': {
|
||||
'desc': 'CRM_WITH_CORRECT_USED_VALUE no failure.',
|
||||
'eStr': self.defaultYANGFailure['None']
|
||||
},
|
||||
'FLEX_COUNTER_TABLE_WITH_CORRECT_USED_VALUE': {
|
||||
'desc': 'FLEX_COUNTER_TABLE_WITH_CORRECT_USED_VALUE no failure.',
|
||||
'eStr': self.defaultYANGFailure['None']
|
||||
},
|
||||
'VERSIONS_WITH_INCORRECT_PATTERN': {
|
||||
'desc': 'VERSIONS_WITH_INCORRECT_PATTERN pattern failure.',
|
||||
'eStr': self.defaultYANGFailure['Pattern']
|
||||
},
|
||||
'VERSIONS_WITH_INCORRECT_PATTERN2': {
|
||||
'desc': 'VERSIONS_WITH_INCORRECT_PATTERN pattern failure.',
|
||||
'eStr': self.defaultYANGFailure['Pattern']
|
||||
},
|
||||
'DEVICE_METADATA_DEFAULT_BGP_STATUS': {
|
||||
'desc': 'DEVICE_METADATA DEFAULT VALUE FOR BGP_STATUS FIELD.',
|
||||
'eStr': self.defaultYANGFailure['Verify'],
|
||||
'verify': {'xpath': '/sonic-device_metadata:sonic-device_metadata/DEVICE_METADATA/localhost/hostname',
|
||||
'key': 'sonic-device_metadata:default_bgp_status',
|
||||
'value': 'up'
|
||||
}
|
||||
},
|
||||
'DEVICE_METADATA_DEFAULT_PFCWD_STATUS': {
|
||||
'desc': 'DEVICE_METADATA DEFAULT VALUE FOR PFCWD FIELD.',
|
||||
'eStr': self.defaultYANGFailure['Verify'],
|
||||
'verify': {'xpath': '/sonic-device_metadata:sonic-device_metadata/DEVICE_METADATA/localhost/hostname',
|
||||
'key': 'sonic-device_metadata:default_pfcwd_status',
|
||||
'value': 'disable'
|
||||
}
|
||||
},
|
||||
'DEVICE_METADATA_TYPE_INCORRECT_PATTERN': {
|
||||
'desc': 'DEVICE_METADATA_TYPE_INCORRECT_PATTERN pattern failure.',
|
||||
'eStr': self.defaultYANGFailure['Pattern']
|
||||
}
|
||||
}
|
||||
|
||||
@ -260,20 +310,20 @@ class Test_yang_models:
|
||||
# verify the data tree if asked
|
||||
if verify is not None:
|
||||
xpath = verify['xpath']
|
||||
log.debug("Verify xpath: {}".format(xpath))
|
||||
log.info("Verify xpath: {}".format(xpath))
|
||||
set = node.find_path(xpath)
|
||||
for dnode in set.data():
|
||||
if (xpath == dnode.path()):
|
||||
log.debug("Verify dnode: {}".format(dnode.path()))
|
||||
log.info("Verify dnode: {}".format(dnode.path()))
|
||||
data = dnode.print_mem(ly.LYD_JSON, ly.LYP_WITHSIBLINGS \
|
||||
| ly.LYP_FORMAT | ly.LYP_WD_ALL)
|
||||
data = json.loads(data)
|
||||
log.debug("Verify data: {}".format(data))
|
||||
log.info("Verify data: {}".format(data))
|
||||
assert (data[verify['key']] == verify['value'])
|
||||
s = 'verified'
|
||||
except Exception as e:
|
||||
s = str(e)
|
||||
log.debug(s)
|
||||
log.info(s)
|
||||
return s
|
||||
|
||||
"""
|
||||
@ -294,7 +344,7 @@ class Test_yang_models:
|
||||
log.info(desc + " Passed\n")
|
||||
return PASS
|
||||
else:
|
||||
raise Exception("Unknown Error")
|
||||
raise Exception("Mismatch {} and {}".format(eStr, s))
|
||||
except Exception as e:
|
||||
printExceptionDetails()
|
||||
log.info(desc + " Failed\n")
|
||||
@ -336,10 +386,10 @@ class Test_yang_models:
|
||||
Run all tests from list self.tests
|
||||
"""
|
||||
def test_run_tests(self):
|
||||
ret = 0
|
||||
try:
|
||||
self.initTest()
|
||||
self.loadYangModel(self.yangDir)
|
||||
ret = 0
|
||||
for test in self.tests:
|
||||
test = test.strip()
|
||||
if test in self.ExceptionTests:
|
||||
@ -350,6 +400,7 @@ class Test_yang_models:
|
||||
raise Exception("Unexpected Test")
|
||||
except Exception as e:
|
||||
printExceptionDetails()
|
||||
|
||||
assert ret == 0
|
||||
return
|
||||
# End of Class
|
||||
|
@ -727,6 +727,218 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"CRM_WITH_WRONG_PERCENTAGE": {
|
||||
"sonic-crm:sonic-crm": {
|
||||
"sonic-crm:CRM": {
|
||||
"Config": {
|
||||
"acl_counter_high_threshold": 110,
|
||||
"acl_counter_low_threshold": 85,
|
||||
"acl_counter_threshold_type": "PERCENTAGE"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"CRM_WITH_HIGH_THRESHOLD_ERR": {
|
||||
"sonic-crm:sonic-crm": {
|
||||
"sonic-crm:CRM": {
|
||||
"Config": {
|
||||
"acl_counter_high_threshold": 80,
|
||||
"acl_counter_low_threshold": 81,
|
||||
"acl_counter_threshold_type": "PERCENTAGE"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"CRM_WITH_WRONG_THRESHOLD": {
|
||||
"sonic-crm:sonic-crm": {
|
||||
"sonic-crm:CRM": {
|
||||
"Config": {
|
||||
"acl_counter_high_threshold": 85,
|
||||
"acl_counter_low_threshold": 90,
|
||||
"acl_counter_threshold_type": "free"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"CRM_WITH_CORRECT_USED_VALUE": {
|
||||
"sonic-crm:sonic-crm": {
|
||||
"sonic-crm:CRM": {
|
||||
"Config": {
|
||||
"acl_counter_high_threshold": 85,
|
||||
"acl_counter_low_threshold": 25,
|
||||
"acl_counter_threshold_type": "used"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"DEVICE_METADATA_DEFAULT_BGP_STATUS": {
|
||||
"sonic-device_metadata:sonic-device_metadata": {
|
||||
"sonic-device_metadata:DEVICE_METADATA": {
|
||||
"sonic-device_metadata:localhost": {
|
||||
"docker_routing_config_mode": "separated",
|
||||
"platform": "Stone-DX010",
|
||||
"hostname": "DUT-ASW",
|
||||
"bgp_asn": "65000"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"DEVICE_METADATA_DEFAULT_PFCWD_STATUS": {
|
||||
"sonic-device_metadata:sonic-device_metadata": {
|
||||
"sonic-device_metadata:DEVICE_METADATA": {
|
||||
"sonic-device_metadata:localhost": {
|
||||
"platform": "DX010",
|
||||
"hostname": "DUT-CSW",
|
||||
"bgp_asn": "65001"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"DEVICE_METADATA_TYPE_INCORRECT_PATTERN": {
|
||||
"sonic-device_metadata:sonic-device_metadata": {
|
||||
"sonic-device_metadata:DEVICE_METADATA": {
|
||||
"sonic-device_metadata:localhost": {
|
||||
"bgp_asn": "65002",
|
||||
"type": "ToRrouter"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"VERSIONS_WITH_INCORRECT_PATTERN": {
|
||||
"sonic-versions:sonic-versions": {
|
||||
"sonic-versions:VERSIONS": {
|
||||
"DATABASE": {
|
||||
"VERSION": "version_1_2"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"VERSIONS_WITH_INCORRECT_PATTERN2": {
|
||||
"sonic-versions:sonic-versions": {
|
||||
"sonic-versions:VERSIONS": {
|
||||
"DATABASE": {
|
||||
"VERSION": "version_0_2_77"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"FLEX_COUNTER_TABLE_WITH_CORRECT_USED_VALUE": {
|
||||
"sonic-flex_counter:sonic-flex_counter": {
|
||||
"sonic-flex_counter:FLEX_COUNTER_TABLE": {
|
||||
"PFCWD": {
|
||||
"FLEX_COUNTER_STATUS": "enable"
|
||||
},
|
||||
"PG_WATERMARK": {
|
||||
"FLEX_COUNTER_STATUS": "enable"
|
||||
},
|
||||
"PORT": {
|
||||
"FLEX_COUNTER_STATUS": "enable"
|
||||
},
|
||||
"PORT_RATES": {
|
||||
"FLEX_COUNTER_STATUS": "enable"
|
||||
},
|
||||
"PORT_BUFFER_DROP": {
|
||||
"FLEX_COUNTER_STATUS": "enable"
|
||||
},
|
||||
"BUFFER_POOL_WATERMARK_KEY": {
|
||||
"FLEX_COUNTER_STATUS": "enable"
|
||||
},
|
||||
"QUEUE": {
|
||||
"FLEX_COUNTER_STATUS": "enable"
|
||||
},
|
||||
"QUEUE_WATERMARK": {
|
||||
"FLEX_COUNTER_STATUS": "enable"
|
||||
},
|
||||
"DEBUG_COUNTER": {
|
||||
"FLEX_COUNTER_STATUS": "enable"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"CRM_BRK_CFG_FLEX_TABLE": {
|
||||
"sonic-crm:sonic-crm": {
|
||||
"sonic-crm:CRM": {
|
||||
"Config": {
|
||||
"acl_counter_low_threshold": "70",
|
||||
"acl_counter_high_threshold": "85",
|
||||
"acl_counter_threshold_type": "percentage",
|
||||
"ipv6_neighbor_high_threshold": "67",
|
||||
"ipv6_neighbor_low_threshold": "56",
|
||||
"ipv6_neighbor_threshold_type": "percentage",
|
||||
"nexthop_group_high_threshold": "67",
|
||||
"nexthop_group_low_threshold": "56",
|
||||
"nexthop_group_threshold_type": "percentage",
|
||||
"polling_interval": "0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"sonic-breakout_cfg:sonic-breakout_cfg": {
|
||||
"sonic-breakout_cfg:BREAKOUT_CFG": {
|
||||
"BREAKOUT_CFG_LIST": [
|
||||
{
|
||||
"brkout_mode": "1x100G[40G]",
|
||||
"port": "Ethernet0"
|
||||
},
|
||||
{
|
||||
"brkout_mode": "4x25G[10G]",
|
||||
"port": "Ethernet8"
|
||||
},
|
||||
{
|
||||
"brkout_mode": "2x25G(2)+1x50G(2)",
|
||||
"port": "Ethernet4"
|
||||
},
|
||||
{
|
||||
"brkout_mode": "1x400G",
|
||||
"port": "Ethernet12"
|
||||
},
|
||||
{
|
||||
"brkout_mode": "2x200G",
|
||||
"port": "Ethernet16"
|
||||
},
|
||||
{
|
||||
"brkout_mode": "4x100G",
|
||||
"port": "Ethernet20"
|
||||
},
|
||||
{
|
||||
"brkout_mode": "8x50G",
|
||||
"port": "Ethernet24"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"sonic-flex_counter:sonic-flex_counter": {
|
||||
"sonic-flex_counter:FLEX_COUNTER_TABLE": {
|
||||
"QUEUE": {
|
||||
"FLEX_COUNTER_STATUS": "enable"
|
||||
},
|
||||
"PG_WATERMARK": {
|
||||
"FLEX_COUNTER_STATUS": "enable"
|
||||
},
|
||||
"QUEUE_WATERMARK": {
|
||||
"FLEX_COUNTER_STATUS": "enable"
|
||||
},
|
||||
"PFCWD": {
|
||||
"FLEX_COUNTER_STATUS": "enable"
|
||||
},
|
||||
"PORT": {
|
||||
"FLEX_COUNTER_STATUS": "enable"
|
||||
},
|
||||
"DEBUG_COUNTER": {
|
||||
"FLEX_COUNTER_STATUS": "enable"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ACL_RULE_WRONG_INNER_ETHER_TYPE": {
|
||||
"sonic-acl:sonic-acl": {
|
||||
"sonic-acl:ACL_RULE": {
|
||||
@ -962,7 +1174,7 @@
|
||||
},
|
||||
"DEVICE_METADATA": {
|
||||
"localhost": {
|
||||
"type": "ToR",
|
||||
"type": "ToRRouter",
|
||||
"mac": "00:11:22:33:dd:5a",
|
||||
"hostname": "asw.dc",
|
||||
"bgp_asn": "64850",
|
||||
@ -1450,7 +1662,7 @@
|
||||
"brkout_mode": "1x100G[40G]"
|
||||
},
|
||||
"Ethernet4": {
|
||||
"brkout_mode": "4x25G"
|
||||
"brkout_mode": "4x25G[10G]"
|
||||
},
|
||||
"Ethernet8": {
|
||||
"brkout_mode": "1x100G[40G]"
|
||||
@ -1471,11 +1683,23 @@
|
||||
"PORT": {
|
||||
"FLEX_COUNTER_STATUS": "enable"
|
||||
},
|
||||
"PORT_RATES": {
|
||||
"FLEX_COUNTER_STATUS": "enable"
|
||||
},
|
||||
"PORT_BUFFER_DROP": {
|
||||
"FLEX_COUNTER_STATUS": "enable"
|
||||
},
|
||||
"BUFFER_POOL_WATERMARK_KEY": {
|
||||
"FLEX_COUNTER_STATUS": "enable"
|
||||
},
|
||||
"QUEUE": {
|
||||
"FLEX_COUNTER_STATUS": "enable"
|
||||
},
|
||||
"QUEUE_WATERMARK": {
|
||||
"FLEX_COUNTER_STATUS": "enable"
|
||||
},
|
||||
"DEBUG_COUNTER": {
|
||||
"FLEX_COUNTER_STATUS": "enable"
|
||||
}
|
||||
},
|
||||
"CRM": {
|
||||
@ -1483,6 +1707,12 @@
|
||||
"acl_counter_high_threshold": "85",
|
||||
"acl_counter_low_threshold": "70",
|
||||
"acl_counter_threshold_type": "percentage",
|
||||
"ipv6_neighbor_high_threshold": "67",
|
||||
"ipv6_neighbor_low_threshold": "56",
|
||||
"ipv6_neighbor_threshold_type": "percentage",
|
||||
"nexthop_group_high_threshold": "67",
|
||||
"nexthop_group_low_threshold": "56",
|
||||
"nexthop_group_threshold_type": "percentage",
|
||||
"polling_interval": "0"
|
||||
}
|
||||
}
|
||||
|
@ -5,10 +5,6 @@ module sonic-acl {
|
||||
namespace "http://github.com/Azure/sonic-acl";
|
||||
prefix acl;
|
||||
|
||||
import ietf-yang-types {
|
||||
prefix yang;
|
||||
}
|
||||
|
||||
import ietf-inet-types {
|
||||
prefix inet;
|
||||
}
|
||||
|
64
src/sonic-yang-models/yang-models/sonic-breakout_cfg.yang
Normal file
64
src/sonic-yang-models/yang-models/sonic-breakout_cfg.yang
Normal file
@ -0,0 +1,64 @@
|
||||
module sonic-breakout_cfg {
|
||||
|
||||
yang-version 1.1;
|
||||
|
||||
namespace "http://github.com/Azure/sonic-breakout_cfg";
|
||||
prefix breakout_cfg;
|
||||
|
||||
import sonic-extension {
|
||||
prefix ext;
|
||||
revision-date 2019-07-01;
|
||||
}
|
||||
|
||||
description "BREAKOUT_CFG YANG Module for SONiC OS";
|
||||
|
||||
revision 2020-04-10 {
|
||||
description "First Revision";
|
||||
}
|
||||
|
||||
container sonic-breakout_cfg {
|
||||
|
||||
container BREAKOUT_CFG {
|
||||
|
||||
description "BREAKOUT_CFG part of config_db.json";
|
||||
|
||||
list BREAKOUT_CFG_LIST {
|
||||
|
||||
key "port";
|
||||
|
||||
ext:key-regex-configdb-to-yang "^([a-zA-Z0-9_-]+)$";
|
||||
|
||||
ext:key-regex-yang-to-configdb "<port>";
|
||||
|
||||
/*
|
||||
* This is leaf instead of a leafref towards port, because this
|
||||
* table will contains Parent ports and their current breakout-mode,
|
||||
* irrespective of port is present in PORT table or not. Specially
|
||||
* during Dynamic Port Breakout, Parent Port may not be present in
|
||||
* PORT table.
|
||||
*/
|
||||
leaf port {
|
||||
type string {
|
||||
length 1..255;
|
||||
}
|
||||
}
|
||||
|
||||
leaf brkout_mode {
|
||||
type string {
|
||||
length 1..64;
|
||||
/*
|
||||
* Below allowed patterns are based on most used Platforms,
|
||||
* Add any other breakout-mode to allow Dynamic Port
|
||||
* Breakout to that breakout-mode.
|
||||
*/
|
||||
pattern '1x100G\[40G\]|2x50G|4x25G\[10G\]|2x25G\(2\)\+1x50G\(2\)|1x50G\(2\)\+2x25G\(2\)|1x400G|2x200G|4x100G|8x50G';
|
||||
}
|
||||
}
|
||||
}
|
||||
/* end of list BREAKOUT_CFG_LIST */
|
||||
}
|
||||
/* end of container BREAKOUT_CFG */
|
||||
}
|
||||
/* end of top level container */
|
||||
}
|
||||
/* end of module sonic-breakout_cfg */
|
303
src/sonic-yang-models/yang-models/sonic-crm.yang
Normal file
303
src/sonic-yang-models/yang-models/sonic-crm.yang
Normal file
@ -0,0 +1,303 @@
|
||||
module sonic-crm {
|
||||
|
||||
yang-version 1.1;
|
||||
|
||||
namespace "http://github.com/Azure/sonic-crm";
|
||||
prefix crm;
|
||||
|
||||
import sonic-types {
|
||||
prefix stypes;
|
||||
revision-date 2019-07-01;
|
||||
}
|
||||
|
||||
description "CRM YANG Module for SONiC OS";
|
||||
|
||||
revision 2020-04-10 {
|
||||
description "First Revision";
|
||||
}
|
||||
|
||||
container sonic-crm {
|
||||
|
||||
container CRM {
|
||||
|
||||
description "CRM part of config_db.json";
|
||||
|
||||
container Config {
|
||||
|
||||
/* typedef specific to CRM */
|
||||
typedef threshold {
|
||||
type uint16;
|
||||
}
|
||||
|
||||
leaf acl_counter_threshold_type {
|
||||
must "(((current()='PERCENTAGE' or current()='percentage') and
|
||||
../acl_counter_high_threshold<100 and
|
||||
../acl_counter_low_threshold<100) or
|
||||
(current()!='PERCENTAGE' and current()!='percentage'))";
|
||||
type stypes:crm_threshold_type;
|
||||
}
|
||||
|
||||
leaf acl_counter_high_threshold {
|
||||
must "(current() > ../acl_counter_low_threshold)"
|
||||
{
|
||||
error-message "high_threshold should be more than low_threshold";
|
||||
}
|
||||
type threshold;
|
||||
}
|
||||
|
||||
leaf acl_counter_low_threshold {
|
||||
type threshold;
|
||||
}
|
||||
|
||||
leaf acl_group_threshold_type {
|
||||
must "(((current()='PERCENTAGE' or current()='percentage') and
|
||||
../acl_group_high_threshold<100 and
|
||||
../acl_group_low_threshold<100) or
|
||||
(current()!='PERCENTAGE' and current()!='percentage'))";
|
||||
type stypes:crm_threshold_type;
|
||||
}
|
||||
|
||||
leaf acl_group_high_threshold {
|
||||
must "(current() > ../acl_group_low_threshold)"
|
||||
{
|
||||
error-message "high_threshold should be more that low_threshold";
|
||||
}
|
||||
type threshold;
|
||||
}
|
||||
|
||||
leaf acl_group_low_threshold {
|
||||
type threshold;
|
||||
}
|
||||
|
||||
leaf acl_entry_threshold_type {
|
||||
must "(((current()='PERCENTAGE' or current()='percentage') and
|
||||
../acl_entry_high_threshold<100 and
|
||||
../acl_entry_low_threshold<100) or
|
||||
(current()!='PERCENTAGE' and current()!='percentage'))";
|
||||
type stypes:crm_threshold_type;
|
||||
}
|
||||
|
||||
leaf acl_entry_high_threshold {
|
||||
must "(current() > ../acl_entry_low_threshold)"
|
||||
{
|
||||
error-message "high_threshold should be more that low_threshold";
|
||||
}
|
||||
type threshold;
|
||||
}
|
||||
|
||||
leaf acl_entry_low_threshold {
|
||||
type threshold;
|
||||
}
|
||||
|
||||
leaf acl_table_threshold_type {
|
||||
must "(((current()='PERCENTAGE' or current()='percentage') and
|
||||
../acl_table_high_threshold<100 and
|
||||
../acl_table_low_threshold<100) or
|
||||
(current()!='PERCENTAGE' and current()!='percentage'))";
|
||||
type stypes:crm_threshold_type;
|
||||
}
|
||||
|
||||
leaf acl_table_high_threshold {
|
||||
must "(current() > ../acl_table_low_threshold)"
|
||||
{
|
||||
error-message "high_threshold should be more that low_threshold";
|
||||
}
|
||||
type threshold;
|
||||
}
|
||||
|
||||
leaf acl_table_low_threshold {
|
||||
type threshold;
|
||||
}
|
||||
|
||||
leaf fdb_entry_threshold_type {
|
||||
must "(((current()='PERCENTAGE' or current()='percentage') and
|
||||
../fdb_entry_high_threshold<100 and
|
||||
../fdb_entry_low_threshold<100) or
|
||||
(current()!='PERCENTAGE' and current()!='percentage'))";
|
||||
type stypes:crm_threshold_type;
|
||||
}
|
||||
|
||||
leaf fdb_entry_high_threshold {
|
||||
must "(current() > ../fdb_entry_low_threshold)"
|
||||
{
|
||||
error-message "high_threshold should be more that low_threshold";
|
||||
}
|
||||
type threshold;
|
||||
}
|
||||
|
||||
leaf fdb_entry_low_threshold {
|
||||
type threshold;
|
||||
}
|
||||
|
||||
leaf ipv4_neighbor_threshold_type {
|
||||
must "(((current()='PERCENTAGE' or current()='percentage') and
|
||||
../ipv4_neighbor_high_threshold<100 and
|
||||
../ipv4_neighbor_low_threshold<100) or
|
||||
(current()!='PERCENTAGE' and current()!='percentage'))";
|
||||
type stypes:crm_threshold_type;
|
||||
}
|
||||
|
||||
leaf ipv4_neighbor_high_threshold {
|
||||
must "(current() > ../ipv4_neighbor_low_threshold)"
|
||||
{
|
||||
error-message "high_threshold should be more that low_threshold";
|
||||
}
|
||||
type threshold;
|
||||
}
|
||||
|
||||
leaf ipv4_neighbor_low_threshold {
|
||||
type threshold;
|
||||
}
|
||||
|
||||
leaf ipv4_nexthop_threshold_type {
|
||||
must "(((current()='PERCENTAGE' or current()='percentage') and
|
||||
../ipv4_nexthop_high_threshold<100 and
|
||||
../ipv4_nexthop_low_threshold<100) or
|
||||
(current()!='PERCENTAGE' and current()!='percentage'))";
|
||||
type stypes:crm_threshold_type;
|
||||
}
|
||||
|
||||
leaf ipv4_nexthop_high_threshold {
|
||||
must "(current() > ../ipv4_nexthop_low_threshold)"
|
||||
{
|
||||
error-message "high_threshold should be more that low_threshold";
|
||||
}
|
||||
type threshold;
|
||||
}
|
||||
|
||||
leaf ipv4_nexthop_low_threshold {
|
||||
type threshold;
|
||||
}
|
||||
|
||||
leaf ipv4_route_threshold_type {
|
||||
must "(((current()='PERCENTAGE' or current()='percentage') and
|
||||
../ipv4_route_high_threshold<100 and
|
||||
../ipv4_route_low_threshold<100) or
|
||||
(current()!='PERCENTAGE' and current()!='percentage'))";
|
||||
type stypes:crm_threshold_type;
|
||||
}
|
||||
|
||||
leaf ipv4_route_high_threshold {
|
||||
must "(current() > ../ipv4_route_low_threshold)"
|
||||
{
|
||||
error-message "high_threshold should be more that low_threshold";
|
||||
}
|
||||
type threshold;
|
||||
}
|
||||
|
||||
leaf ipv4_route_low_threshold {
|
||||
type threshold;
|
||||
}
|
||||
|
||||
leaf ipv6_neighbor_threshold_type {
|
||||
must "(((current()='PERCENTAGE' or current()='percentage') and
|
||||
../ipv6_neighbor_high_threshold<100 and
|
||||
../ipv6_neighbor_low_threshold<100) or
|
||||
(current()!='PERCENTAGE' and current()!='percentage'))";
|
||||
type stypes:crm_threshold_type;
|
||||
}
|
||||
|
||||
leaf ipv6_neighbor_high_threshold {
|
||||
must "(current() > ../ipv6_neighbor_low_threshold)"
|
||||
{
|
||||
error-message "high_threshold should be more that low_threshold";
|
||||
}
|
||||
type threshold;
|
||||
}
|
||||
|
||||
leaf ipv6_neighbor_low_threshold {
|
||||
type threshold;
|
||||
}
|
||||
|
||||
leaf ipv6_nexthop_threshold_type {
|
||||
must "(((current()='PERCENTAGE' or current()='percentage') and
|
||||
../ipv6_nexthop_high_threshold<100 and
|
||||
../ipv6_nexthop_low_threshold<100) or
|
||||
(current()!='PERCENTAGE' and current()!='percentage'))";
|
||||
type stypes:crm_threshold_type;
|
||||
}
|
||||
|
||||
leaf ipv6_nexthop_high_threshold {
|
||||
must "(current() > ../ipv6_nexthop_low_threshold)"
|
||||
{
|
||||
error-message "high_threshold should be more that low_threshold";
|
||||
}
|
||||
type threshold;
|
||||
}
|
||||
|
||||
leaf ipv6_nexthop_low_threshold {
|
||||
type threshold;
|
||||
}
|
||||
|
||||
leaf ipv6_route_threshold_type {
|
||||
must "(((current()='PERCENTAGE' or current()='percentage') and
|
||||
../ipv6_route_high_threshold<100 and
|
||||
../ipv6_route_low_threshold<100) or
|
||||
(current()!='PERCENTAGE' and current()!='percentage'))";
|
||||
type stypes:crm_threshold_type;
|
||||
}
|
||||
|
||||
leaf ipv6_route_high_threshold {
|
||||
must "(current() > ../ipv6_route_low_threshold)"
|
||||
{
|
||||
error-message "high_threshold should be more that low_threshold";
|
||||
}
|
||||
type threshold;
|
||||
}
|
||||
|
||||
leaf ipv6_route_low_threshold {
|
||||
type threshold;
|
||||
}
|
||||
|
||||
leaf nexthop_group_threshold_type {
|
||||
must "(((current()='PERCENTAGE' or current()='percentage') and
|
||||
../nexthop_group_high_threshold<100 and
|
||||
../nexthop_group_low_threshold<100) or
|
||||
(current()!='PERCENTAGE' and current()!='percentage'))";
|
||||
type stypes:crm_threshold_type;
|
||||
}
|
||||
|
||||
leaf nexthop_group_high_threshold {
|
||||
must "(current() > ../nexthop_group_low_threshold)"
|
||||
{
|
||||
error-message "high_threshold should be more that low_threshold";
|
||||
}
|
||||
type threshold;
|
||||
}
|
||||
|
||||
leaf nexthop_group_low_threshold {
|
||||
type threshold;
|
||||
}
|
||||
|
||||
leaf nexthop_group_member_threshold_type {
|
||||
must "(((current()='PERCENTAGE' or current()='percentage') and
|
||||
../nexthop_group_member_high_threshold<100 and
|
||||
../nexthop_group_member_low_threshold<100) or
|
||||
(current()!='PERCENTAGE' and current()!='percentage'))";
|
||||
type stypes:crm_threshold_type;
|
||||
}
|
||||
|
||||
leaf nexthop_group_member_high_threshold {
|
||||
must "(current() > ../nexthop_group_member_low_threshold)"
|
||||
{
|
||||
error-message "high_threshold should be more that low_threshold";
|
||||
}
|
||||
type threshold;
|
||||
}
|
||||
|
||||
leaf nexthop_group_member_low_threshold {
|
||||
type threshold;
|
||||
}
|
||||
|
||||
leaf polling_interval {
|
||||
type threshold;
|
||||
}
|
||||
|
||||
}
|
||||
/* end of Config */
|
||||
}
|
||||
/* end of container CRM */
|
||||
}
|
||||
/* end of top level container */
|
||||
}
|
||||
/* end of module sonic-crm */
|
99
src/sonic-yang-models/yang-models/sonic-device_metadata.yang
Normal file
99
src/sonic-yang-models/yang-models/sonic-device_metadata.yang
Normal file
@ -0,0 +1,99 @@
|
||||
module sonic-device_metadata {
|
||||
|
||||
yang-version 1.1;
|
||||
|
||||
namespace "http://github.com/Azure/sonic-device_metadata";
|
||||
prefix device_metadata;
|
||||
|
||||
import ietf-yang-types {
|
||||
prefix yang;
|
||||
}
|
||||
|
||||
import ietf-inet-types {
|
||||
prefix inet;
|
||||
}
|
||||
|
||||
import sonic-types {
|
||||
prefix stypes;
|
||||
revision-date 2019-07-01;
|
||||
}
|
||||
|
||||
description "DEVICE_METADATA YANG Module for SONiC OS";
|
||||
|
||||
revision 2020-04-10 {
|
||||
description "First Revision";
|
||||
}
|
||||
|
||||
container sonic-device_metadata {
|
||||
|
||||
container DEVICE_METADATA {
|
||||
|
||||
description "DEVICE_METADATA part of config_db.json";
|
||||
|
||||
container localhost{
|
||||
|
||||
leaf hwsku {
|
||||
type stypes:hwsku;
|
||||
}
|
||||
|
||||
leaf default_bgp_status {
|
||||
type enumeration {
|
||||
enum up;
|
||||
enum down;
|
||||
}
|
||||
default up;
|
||||
}
|
||||
|
||||
leaf docker_routing_config_mode {
|
||||
type string {
|
||||
pattern "unified|split|separated";
|
||||
}
|
||||
default "unified";
|
||||
}
|
||||
|
||||
leaf hostname {
|
||||
type string {
|
||||
length 1..255;
|
||||
}
|
||||
}
|
||||
|
||||
leaf platform {
|
||||
type string {
|
||||
length 1..255;
|
||||
}
|
||||
}
|
||||
|
||||
leaf mac {
|
||||
type yang:mac-address;
|
||||
}
|
||||
|
||||
leaf default_pfcwd_status {
|
||||
type enumeration {
|
||||
enum disable;
|
||||
enum enable;
|
||||
}
|
||||
default disable;
|
||||
}
|
||||
|
||||
leaf bgp_asn {
|
||||
type inet:as-number;
|
||||
}
|
||||
|
||||
leaf deployment_id {
|
||||
type uint32;
|
||||
}
|
||||
|
||||
leaf type {
|
||||
type string {
|
||||
length 1..255;
|
||||
pattern "ToRRouter|LeafRouter|SpineChassisFrontendRouter|ChassisBackendRouter|ASIC";
|
||||
}
|
||||
}
|
||||
}
|
||||
/* end of container localhost */
|
||||
}
|
||||
/* end of container DEVICE_METADATA */
|
||||
}
|
||||
/* end of top level container */
|
||||
}
|
||||
/* end of module sonic-device_metadata */
|
82
src/sonic-yang-models/yang-models/sonic-device_neighbor.yang
Normal file
82
src/sonic-yang-models/yang-models/sonic-device_neighbor.yang
Normal file
@ -0,0 +1,82 @@
|
||||
module sonic-device_neighbor {
|
||||
|
||||
yang-version 1.1;
|
||||
|
||||
namespace "http://github.com/Azure/sonic-device_neighbor";
|
||||
prefix device_neighbor;
|
||||
|
||||
import ietf-inet-types {
|
||||
prefix inet;
|
||||
}
|
||||
|
||||
import sonic-extension {
|
||||
prefix ext;
|
||||
revision-date 2019-07-01;
|
||||
}
|
||||
|
||||
import sonic-port {
|
||||
prefix port;
|
||||
revision-date 2019-07-01;
|
||||
}
|
||||
|
||||
description "DEVICE_NEIGHBOR YANG Module for SONiC OS";
|
||||
|
||||
revision 2020-04-10 {
|
||||
description "First Revision";
|
||||
}
|
||||
|
||||
container sonic-device_neighbor {
|
||||
|
||||
container DEVICE_NEIGHBOR {
|
||||
|
||||
description "DEVICE_NEIGHBOR part of config_db.json";
|
||||
|
||||
list DEVICE_NEIGHBOR_LIST {
|
||||
|
||||
key "peer_name";
|
||||
|
||||
ext:key-regex-configdb-to-yang "^([a-zA-Z0-9_-]+)$";
|
||||
|
||||
ext:key-regex-yang-to-configdb "<peer_name>";
|
||||
|
||||
leaf peer_name {
|
||||
type string {
|
||||
length 1..255;
|
||||
}
|
||||
}
|
||||
|
||||
leaf name {
|
||||
type string {
|
||||
length 1..255;
|
||||
}
|
||||
}
|
||||
|
||||
leaf mgmt_addr {
|
||||
type inet:ip-address;
|
||||
}
|
||||
|
||||
leaf local_port {
|
||||
type leafref {
|
||||
path /port:sonic-port/port:PORT/port:PORT_LIST/port:port_name;
|
||||
}
|
||||
}
|
||||
|
||||
leaf port {
|
||||
type string {
|
||||
length 1..255;
|
||||
}
|
||||
}
|
||||
|
||||
leaf type {
|
||||
type string {
|
||||
length 1..255;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* end of list DEVICE_NEIGHBOR_LIST */
|
||||
}
|
||||
/* end of container DEVICE_NEIGHBOR */
|
||||
}
|
||||
/* end of top level container */
|
||||
}
|
||||
/* end of module sonic-device_neighbor */
|
112
src/sonic-yang-models/yang-models/sonic-flex_counter.yang
Normal file
112
src/sonic-yang-models/yang-models/sonic-flex_counter.yang
Normal file
@ -0,0 +1,112 @@
|
||||
module sonic-flex_counter {
|
||||
|
||||
yang-version 1.1;
|
||||
|
||||
namespace "http://github.com/Azure/sonic-flex_counter";
|
||||
prefix flex_counter;
|
||||
|
||||
description "FLEX COUNTER YANG Module for SONiC OS";
|
||||
|
||||
revision 2020-04-10 {
|
||||
description "First Revision";
|
||||
}
|
||||
|
||||
container sonic-flex_counter {
|
||||
|
||||
container FLEX_COUNTER_TABLE {
|
||||
|
||||
/* typedef specific to FLEX_COUNTER_TABLE */
|
||||
typedef flex_status {
|
||||
type enumeration {
|
||||
enum enable;
|
||||
enum disable;
|
||||
}
|
||||
}
|
||||
|
||||
description "FLEX_COUNTER_TABLE part of config_db.json";
|
||||
|
||||
/* below are in alphabetical order */
|
||||
|
||||
container BUFFER_POOL_WATERMARK_KEY {
|
||||
/* BUFFER_POOL_WATERMARK_STAT_COUNTER_FLEX_COUNTER_GROUP */
|
||||
leaf FLEX_COUNTER_STATUS {
|
||||
type flex_status;
|
||||
}
|
||||
}
|
||||
|
||||
container DEBUG_COUNTER {
|
||||
/* DEBUG_COUNTER_FLEX_COUNTER_GROUP */
|
||||
leaf FLEX_COUNTER_STATUS {
|
||||
type flex_status;
|
||||
}
|
||||
}
|
||||
|
||||
container PFCWD {
|
||||
/* PFC_WD_FLEX_COUNTER_GROUP */
|
||||
leaf FLEX_COUNTER_STATUS {
|
||||
type flex_status;
|
||||
}
|
||||
}
|
||||
|
||||
container PG_WATERMARK {
|
||||
/* PG_WATERMARK_STAT_COUNTER_FLEX_COUNTER_GROUP */
|
||||
leaf FLEX_COUNTER_STATUS {
|
||||
type flex_status;
|
||||
}
|
||||
}
|
||||
|
||||
container PORT {
|
||||
/* PORT_STAT_COUNTER_FLEX_COUNTER_GROUP */
|
||||
leaf FLEX_COUNTER_STATUS {
|
||||
type flex_status;
|
||||
}
|
||||
}
|
||||
|
||||
container PORT_RATES {
|
||||
/* PORT_BUFFER_DROP_COUNTER_FLEX_COUNTER_GROUP */
|
||||
leaf FLEX_COUNTER_STATUS {
|
||||
type flex_status;
|
||||
}
|
||||
}
|
||||
|
||||
container PORT_BUFFER_DROP {
|
||||
/* PORT_BUFFER_DROP_COUNTER_FLEX_COUNTER_GROUP */
|
||||
leaf FLEX_COUNTER_STATUS {
|
||||
type flex_status;
|
||||
}
|
||||
}
|
||||
|
||||
container QUEUE {
|
||||
/* QUEUE_STAT_COUNTER_FLEX_COUNTER_GROUP */
|
||||
leaf FLEX_COUNTER_STATUS {
|
||||
type flex_status;
|
||||
}
|
||||
}
|
||||
|
||||
container QUEUE_WATERMARK {
|
||||
/* QUEUE_WATERMARK_STAT_COUNTER_FLEX_COUNTER_GROUP */
|
||||
leaf FLEX_COUNTER_STATUS {
|
||||
type flex_status;
|
||||
}
|
||||
}
|
||||
|
||||
container RIF {
|
||||
/* RIF_STAT_COUNTER_FLEX_COUNTER_GROUP */
|
||||
leaf FLEX_COUNTER_STATUS {
|
||||
type flex_status;
|
||||
}
|
||||
}
|
||||
|
||||
container RIF_RATES {
|
||||
/* RIF_RATE_COUNTER_FLEX_COUNTER_GROUP */
|
||||
leaf FLEX_COUNTER_STATUS {
|
||||
type flex_status;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/* end of container FLEX_COUNTER_TABLE */
|
||||
}
|
||||
/* end of top level container */
|
||||
}
|
||||
/* end of module sonic-flex_counter */
|
@ -5,14 +5,6 @@ module sonic-interface {
|
||||
namespace "http://github.com/Azure/sonic-interface";
|
||||
prefix intf;
|
||||
|
||||
import ietf-yang-types {
|
||||
prefix yang;
|
||||
}
|
||||
|
||||
import ietf-inet-types {
|
||||
prefix inet;
|
||||
}
|
||||
|
||||
import sonic-types {
|
||||
prefix stypes;
|
||||
revision-date 2019-07-01;
|
||||
|
@ -5,10 +5,6 @@ module sonic-loopback-interface {
|
||||
namespace "http://github.com/Azure/sonic-loopback-interface";
|
||||
prefix lointf;
|
||||
|
||||
import ietf-inet-types {
|
||||
prefix inet;
|
||||
}
|
||||
|
||||
import sonic-types {
|
||||
prefix stypes;
|
||||
revision-date 2019-07-01;
|
||||
|
@ -5,14 +5,6 @@ module sonic-port{
|
||||
namespace "http://github.com/Azure/sonic-port";
|
||||
prefix port;
|
||||
|
||||
import ietf-yang-types {
|
||||
prefix yang;
|
||||
}
|
||||
|
||||
import ietf-inet-types {
|
||||
prefix inet;
|
||||
}
|
||||
|
||||
import sonic-types {
|
||||
prefix stypes;
|
||||
revision-date 2019-07-01;
|
||||
|
@ -5,14 +5,6 @@ module sonic-portchannel {
|
||||
namespace "http://github.com/Azure/sonic-portchannel";
|
||||
prefix lag;
|
||||
|
||||
import ietf-yang-types {
|
||||
prefix yang;
|
||||
}
|
||||
|
||||
import ietf-inet-types {
|
||||
prefix inet;
|
||||
}
|
||||
|
||||
import sonic-types {
|
||||
prefix stypes;
|
||||
revision-date 2019-07-01;
|
||||
|
@ -6,6 +6,10 @@ module sonic-types {
|
||||
prefix sonic-types;
|
||||
|
||||
description "SONiC type for yang Models of SONiC OS";
|
||||
/*
|
||||
* Try to define only sonic specific types here. Rest can be written in
|
||||
* respective YANG files.
|
||||
*/
|
||||
|
||||
revision 2019-07-01 {
|
||||
description "First Revision";
|
||||
@ -82,6 +86,13 @@ module sonic-types {
|
||||
}
|
||||
}
|
||||
|
||||
typedef hwsku {
|
||||
type string {
|
||||
length 1..255;
|
||||
/* Should we list all hwsku here */
|
||||
}
|
||||
}
|
||||
|
||||
typedef vlan_tagging_mode {
|
||||
type enumeration {
|
||||
enum tagged;
|
||||
@ -89,4 +100,11 @@ module sonic-types {
|
||||
enum priority_tagged;
|
||||
}
|
||||
}
|
||||
|
||||
typedef crm_threshold_type {
|
||||
type string {
|
||||
length 1..64;
|
||||
pattern "percentage|used|free|PERCENTAGE|USED|FREE";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
36
src/sonic-yang-models/yang-models/sonic-versions.yang
Normal file
36
src/sonic-yang-models/yang-models/sonic-versions.yang
Normal file
@ -0,0 +1,36 @@
|
||||
module sonic-versions {
|
||||
|
||||
yang-version 1.1;
|
||||
|
||||
namespace "http://github.com/Azure/sonic-versions";
|
||||
prefix versions;
|
||||
|
||||
|
||||
description "VERSIONS YANG Module for SONiC OS";
|
||||
|
||||
revision 2020-04-10 {
|
||||
description "First Revision";
|
||||
}
|
||||
|
||||
container sonic-versions {
|
||||
|
||||
container VERSIONS {
|
||||
|
||||
description "DATABASE SCHEMA VERSIONS part of config_db.json";
|
||||
|
||||
container DATABASE {
|
||||
|
||||
leaf VERSION {
|
||||
type string {
|
||||
length 1..255;
|
||||
pattern 'version_([1-9]|[1-9]{1}[0-9]{1})_([0-9]{1,2})_([0-9]{1,2})';
|
||||
}
|
||||
}
|
||||
}
|
||||
/* end of container DATABASE */
|
||||
}
|
||||
/* end of container VERSIONS */
|
||||
}
|
||||
/* end of top level container */
|
||||
}
|
||||
/* end of module sonic-versions */
|
@ -5,10 +5,6 @@ module sonic-vlan {
|
||||
namespace "http://github.com/Azure/sonic-vlan";
|
||||
prefix vlan;
|
||||
|
||||
import ietf-yang-types {
|
||||
prefix yang;
|
||||
}
|
||||
|
||||
import ietf-inet-types {
|
||||
prefix inet;
|
||||
}
|
||||
|
Reference in New Issue
Block a user