From 9b719222da4726bc5c49fa9fe4f5bd2f745a1741 Mon Sep 17 00:00:00 2001 From: Sudharsan Dhamal Gopalarathnam Date: Sat, 17 Jul 2021 03:17:39 +0000 Subject: [PATCH 1/6] Enabling tunnel counters --- dockers/docker-orchagent/enable_counters.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dockers/docker-orchagent/enable_counters.py b/dockers/docker-orchagent/enable_counters.py index a00bd3facce7..9bb28a6dc968 100755 --- a/dockers/docker-orchagent/enable_counters.py +++ b/dockers/docker-orchagent/enable_counters.py @@ -26,6 +26,8 @@ def enable_rates(): counters_db.set('COUNTERS_DB', 'RATES:PORT', 'PORT_ALPHA', DEFAULT_ALPHA) counters_db.set('COUNTERS_DB', 'RATES:RIF', 'RIF_SMOOTH_INTERVAL', DEFAULT_SMOOTH_INTERVAL) counters_db.set('COUNTERS_DB', 'RATES:RIF', 'RIF_ALPHA', DEFAULT_ALPHA) + counters_db.set('COUNTERS_DB', 'RATES:TUNNEL', 'TUNNEL_SMOOTH_INTERVAL', DEFAULT_SMOOTH_INTERVAL) + counters_db.set('COUNTERS_DB', 'RATES:TUNNEL', 'TUNNEL_ALPHA', DEFAULT_ALPHA) def enable_counters(): @@ -40,6 +42,7 @@ def enable_counters(): enable_counter_group(db, 'QUEUE_WATERMARK') enable_counter_group(db, 'BUFFER_POOL_WATERMARK') enable_counter_group(db, 'PORT_BUFFER_DROP') + enable_counter_group(db, 'TUNNEL') enable_rates() From 9c172a534a5bbf4bf8dd310a4309f66f5b10b372 Mon Sep 17 00:00:00 2001 From: Sudharsan Dhamal Gopalarathnam Date: Wed, 20 Oct 2021 04:48:04 +0000 Subject: [PATCH 2/6] Revert "SONiC QoS MAPs and PORT_QOS_MAP Yang (#7375)" This reverts commit 459d3d1f559e41f5fe9643eb7ef59bc4e6b4c2f0. --- src/sonic-yang-mgmt/sonic_yang_ext.py | 204 +---- src/sonic-yang-models/setup.py | 7 - .../tests/files/sample_config_db.json | 87 --- .../tests/yang_model_tests/tests/qosmaps.json | 104 --- .../tests_config/qosmaps.json | 724 ------------------ .../yang-models/sonic-dot1p-tc-map.yang | 68 -- .../yang-models/sonic-dscp-tc-map.yang | 68 -- ...sonic-pfc-priority-priority-group-map.yang | 68 -- .../sonic-pfc-priority-queue-map.yang | 68 -- .../yang-models/sonic-port-qos-map.yang | 110 --- .../sonic-tc-priority-group-map.yang | 68 -- .../yang-models/sonic-tc-queue-map.yang | 68 -- 12 files changed, 4 insertions(+), 1640 deletions(-) delete mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/qosmaps.json delete mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests_config/qosmaps.json delete mode 100644 src/sonic-yang-models/yang-models/sonic-dot1p-tc-map.yang delete mode 100644 src/sonic-yang-models/yang-models/sonic-dscp-tc-map.yang delete mode 100644 src/sonic-yang-models/yang-models/sonic-pfc-priority-priority-group-map.yang delete mode 100644 src/sonic-yang-models/yang-models/sonic-pfc-priority-queue-map.yang delete mode 100644 src/sonic-yang-models/yang-models/sonic-port-qos-map.yang delete mode 100644 src/sonic-yang-models/yang-models/sonic-tc-priority-group-map.yang delete mode 100644 src/sonic-yang-models/yang-models/sonic-tc-queue-map.yang diff --git a/src/sonic-yang-mgmt/sonic_yang_ext.py b/src/sonic-yang-mgmt/sonic_yang_ext.py index 845588d70dbd..5438c81fb745 100644 --- a/src/sonic-yang-mgmt/sonic_yang_ext.py +++ b/src/sonic-yang-mgmt/sonic_yang_ext.py @@ -4,17 +4,11 @@ from __future__ import print_function import yang as ly import syslog + from json import dump, dumps, loads from xmltodict import parse from glob import glob -qos_maps_model = ['DSCP_TO_TC_MAP_LIST', - 'DOT1P_TO_TC_MAP_LIST', - 'TC_TO_PRIORITY_GROUP_MAP_LIST', - 'TC_TO_QUEUE_MAP_LIST', - 'MAP_PFC_PRIORITY_TO_QUEUE_LIST', - 'PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_LIST'] - """ This is the Exception thrown out of all public function of this class. """ @@ -412,108 +406,6 @@ def _yangConvert(val): return vValue - """ - Xlate a Qos Maps list - This function will xlate from a dict in config DB to a Yang JSON list - using yang model. Output will be go in self.xlateJson - - Note: Exceptions from this function are collected in exceptionList and - are displayed only when an entry is not xlated properly from ConfigDB - to sonic_yang.json. - - QOS MAPS Yang has inner list, which is diffrent from config DB. - Each field value in config db should be converted to inner list with - key and value. - Example: - - Config DB: - "DSCP_TO_TC_MAP": { - "Dscp_to_tc_map1": { - "1": "1", - "2": "2" - } - } - - YANG Model: - module: sonic-dscp-tc-map - +--rw sonic-dscp-tc-map - +--rw DSCP_TO_TC_MAP - +--rw DSCP_TO_TC_MAP_LIST* [name] - +--rw name string - +--rw DSCP_TO_TC_MAP* [dscp] - +--rw dscp string - +--rw tc? string - - YANG JSON: - "sonic-dscp-tc-map:sonic-dscp-tc-map": { - "sonic-dscp-tc-map:DSCP_TO_TC_MAP": { - "DSCP_TO_TC_MAP_LIST": [ - { - "name": "map3", - "DSCP_TO_TC_MAP": [ - { - "dscp": "64", - "tc": "1" - }, - { - "dscp":"2", - "tc":"2" - } - ] - } - ] - } - } - """ - def _xlateQosMapList(self, model, yang, config, table, exceptionList): - - #create a dict to map each key under primary key with a dict yang model. - #This is done to improve performance of mapping from values of TABLEs in - #config DB to leaf in YANG LIST. - inner_clist = model.get('list') - if inner_clist: - inner_listKey = inner_clist['key']['@value'] - inner_leafDict = self._createLeafDict(inner_clist, table) - for lkey in inner_leafDict: - if inner_listKey != lkey: - inner_listVal = lkey - - # get keys from YANG model list itself - listKeys = model['key']['@value'] - self.sysLog(msg="xlateList keyList:{}".format(listKeys)) - primaryKeys = list(config.keys()) - for pkey in primaryKeys: - try: - vKey = None - self.sysLog(syslog.LOG_DEBUG, "xlateList Extract pkey:{}".\ - format(pkey)) - # Find and extracts key from each dict in config - keyDict = self._extractKey(pkey, listKeys) - - if inner_clist: - inner_yang_list = list() - for vKey in config[pkey]: - inner_keyDict = dict() - self.sysLog(syslog.LOG_DEBUG, "xlateList Key {} vkey {} Val {} vval {}".\ - format(inner_listKey, str(vKey), inner_listVal, str(config[pkey][vKey]))) - inner_keyDict[inner_listKey] = str(vKey) - inner_keyDict[inner_listVal] = str(config[pkey][vKey]) - inner_yang_list.append(inner_keyDict) - - keyDict[inner_clist['@name']] = inner_yang_list - yang.append(keyDict) - # delete pkey from config, done to match one key with one list - del config[pkey] - - except Exception as e: - # log debug, because this exception may occur with multilists - self.sysLog(msg="xlateList Exception:{}".format(str(e)), \ - debug=syslog.LOG_DEBUG, doPrint=True) - exceptionList.append(str(e)) - # with multilist, we continue matching other keys. - continue - return - """ Xlate a list This function will xlate from a dict in config DB to a Yang JSON list @@ -524,22 +416,16 @@ def _xlateQosMapList(self, model, yang, config, table, exceptionList): to sonic_yang.json. """ def _xlateList(self, model, yang, config, table, exceptionList): - - #Qos Map lists needs special handling because of inner yang list and - #config db format. - if model['@name'] in qos_maps_model: - self.sysLog(msg="_xlateQosMapList: {}".format(model['@name'])) - self._xlateQosMapList(model, yang,config, table, exceptionList) - return #create a dict to map each key under primary key with a dict yang model. #This is done to improve performance of mapping from values of TABLEs in #config DB to leaf in YANG LIST. - leafDict = self._createLeafDict(model, table) + # get keys from YANG model list itself listKeys = model['key']['@value'] self.sysLog(msg="xlateList keyList:{}".format(listKeys)) + primaryKeys = list(config.keys()) for pkey in primaryKeys: try: @@ -573,6 +459,7 @@ def _xlateList(self, model, yang, config, table, exceptionList): """ def _xlateListInContainer(self, model, yang, configC, table, exceptionList): clist = model + #print(clist['@name']) yang[clist['@name']] = list() self.sysLog(msg="xlateProcessListOfContainer: {}".format(clist['@name'])) self._xlateList(clist, yang[clist['@name']], configC, table, exceptionList) @@ -742,93 +629,10 @@ def _revYangConvert(val): return vValue - """ - Rev xlate from _LIST to table in config DB - QOS MAP Yang has inner list, each inner list key:val should - be mapped to field:value in Config DB. - Example: - - YANG: - module: sonic-dscp-tc-map - +--rw sonic-dscp-tc-map - +--rw DSCP_TO_TC_MAP - +--rw DSCP_TO_TC_MAP_LIST* [name] - +--rw name string - +--rw DSCP_TO_TC_MAP* [dscp] - +--rw dscp string - +--rw tc? string - - YANG JSON: - "sonic-dscp-tc-map:sonic-dscp-tc-map": { - "sonic-dscp-tc-map:DSCP_TO_TC_MAP": { - "DSCP_TO_TC_MAP_LIST": [ - { - "name": "map3", - "DSCP_TO_TC_MAP": [ - { - "dscp": "64", - "tc": "1" - }, - { - "dscp":"2", - "tc":"2" - } - ] - } - ] - } - } - - Config DB: - "DSCP_TO_TC_MAP": { - "Dscp_to_tc_map1": { - "1": "1", - "2": "2" - } - } - """ - - def _revQosMapXlateList(self, model, yang, config, table): - # get keys from YANG model list itself - listKeys = model['key']['@value'] - # create a dict to map each key under primary key with a dict yang model. - # This is done to improve performance of mapping from values of TABLEs in - # config DB to leaf in YANG LIST. - - # Gather inner list key and value from model - inner_clist = model.get('list') - if inner_clist: - inner_listKey = inner_clist['key']['@value'] - inner_leafDict = self._createLeafDict(inner_clist, table) - for lkey in inner_leafDict: - if inner_listKey != lkey: - inner_listVal = lkey - - # list with name _LIST should be removed, - if "_LIST" in model['@name']: - for entry in yang: - # create key of config DB table - pkey, pkeydict = self._createKey(entry, listKeys) - self.sysLog(syslog.LOG_DEBUG, "revXlateList pkey:{}".format(pkey)) - config[pkey]= dict() - # fill rest of the entries - inner_list = entry[inner_clist['@name']] - for index in range(len(inner_list)): - self.sysLog(syslog.LOG_DEBUG, "revXlateList fkey:{} fval {}".\ - format(str(inner_list[index][inner_listKey]),\ - str(inner_list[index][inner_listVal]))) - config[pkey][str(inner_list[index][inner_listKey])] = str(inner_list[index][inner_listVal]) - return - """ Rev xlate from
_LIST to table in config DB """ def _revXlateList(self, model, yang, config, table): - - # special processing for QOS Map table. - if model['@name'] in qos_maps_model: - self._revQosMapXlateList(model, yang, config, table) - return # get keys from YANG model list itself listKeys = model['key']['@value'] diff --git a/src/sonic-yang-models/setup.py b/src/sonic-yang-models/setup.py index a5a74f1b4cba..0ffc2dfd3ab8 100644 --- a/src/sonic-yang-models/setup.py +++ b/src/sonic-yang-models/setup.py @@ -79,13 +79,6 @@ './yang-models/sonic-scheduler.yang', './yang-models/sonic-wred-profile.yang', './yang-models/sonic-queue.yang', - './yang-models/sonic-dscp-tc-map.yang', - './yang-models/sonic-dot1p-tc-map.yang', - './yang-models/sonic-tc-priority-group-map.yang', - './yang-models/sonic-tc-queue-map.yang', - './yang-models/sonic-pfc-priority-queue-map.yang', - './yang-models/sonic-pfc-priority-priority-group-map.yang', - './yang-models/sonic-port-qos-map.yang', './yang-models/sonic_yang_tree']), ], zip_safe=False, diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index 35cb22074106..a53c58eae7e9 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -1188,93 +1188,6 @@ "scheduler": "TEST@1", "wred_profile": "Wred1" } - }, - - "DSCP_TO_TC_MAP": { - "Dscp_to_tc_map1": { - "1": "1", - "2": "2" - }, - "Dscp_to_tc_map2": { - "3": "3", - "4": "4" - } - }, - - "DOT1P_TO_TC_MAP": { - "Dot1p_to_tc_map1": { - "1": "1", - "2": "2" - }, - "Dot1p_to_tc_map2": { - "3": "3", - "4": "4" - } - }, - - "TC_TO_PRIORITY_GROUP_MAP": { - "tc_to_pg_map1": { - "1": "1", - "2": "2" - }, - "tc_to_pg_map2": { - "3": "3", - "4": "4" - } - }, - - "TC_TO_QUEUE_MAP": { - "tc_to_q_map1": { - "1": "1", - "2": "2" - }, - "tc_to_q_map2": { - "3": "3", - "4": "4" - } - }, - - "MAP_PFC_PRIORITY_TO_QUEUE": { - "pfc_prio_to_q_map1": { - "1": "1", - "2": "2" - }, - "pfc_prio_to_q_map2": { - "3": "3", - "4": "4" - } - }, - - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { - "pfc_prio_to_pg_map1": { - "1": "1", - "2": "2" - }, - "pfc_prio_to_pg_map2": { - "3": "3", - "4": "4" - } - }, - - "PORT_QOS_MAP": { - "Ethernet0": { - "dot1p_to_tc_map" : "Dot1p_to_tc_map1", - "dscp_to_tc_map": "Dscp_to_tc_map1", - "tc_to_queue_map": "tc_to_q_map1", - "tc_to_pg_map": "tc_to_pg_map1", - "pfc_to_queue_map": "pfc_prio_to_q_map1", - "pfc_to_pg_map" : "pfc_prio_to_pg_map1", - "pfc_enable" : "3,4" - }, - "Ethernet4": { - "dot1p_to_tc_map" : "Dot1p_to_tc_map2", - "dscp_to_tc_map": "Dscp_to_tc_map2", - "tc_to_queue_map": "tc_to_q_map2", - "tc_to_pg_map": "tc_to_pg_map2", - "pfc_to_queue_map": "pfc_prio_to_q_map2", - "pfc_to_pg_map" : "pfc_prio_to_pg_map2", - "pfc_enable" : "3,4" - } } }, diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/qosmaps.json b/src/sonic-yang-models/tests/yang_model_tests/tests/qosmaps.json deleted file mode 100644 index 90344d8f119d..000000000000 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/qosmaps.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "DSCP_TO_TC_MAP_CRETAE": { - "desc": "Configure a DSCP to Traffic class map." - }, - - "DSCP_TO_TC_MAP_CREATE_INVALID_DSCP": { - "desc": "Configure a DSCP to Traffic class map with invalid key.", - "eStr": "Invalid DSCP" - }, - - "DSCP_TO_TC_MAP_CREATE_INVALID_TC": { - "desc": "Configure a DSCP to Traffic class map with invalid value.", - "eStr": "Invalid Traffic Class" - }, - - "DOT1P_TO_TC_MAP_CRETAE": { - "desc": "Configure a DOT1P to Traffic class map." - }, - - "DOT1P_TO_TC_MAP_CREATE_INVALID_DOT1P": { - "desc": "Configure a DOT1P to Traffic class map with invalid key.", - "eStr": "Invalid DOT1P" - }, - - "DOT1P_TO_TC_MAP_CREATE_INVALID_TC": { - "desc": "Configure a DOT1P to Traffic class map with invalid value.", - "eStr": "Invalid Traffic Class" - }, - - "TC_TO_QUEUE_MAP_CRETAE": { - "desc": "Configure a Traffic Class to Queue map." - }, - - "TC_TO_QUEUE_MAP_CREATE_INVALID_TC": { - "desc": "Configure a Traffic class to Queue map with invalid key.", - "eStr": "Invalid Traffic Class" - }, - - "TC_TO_QUEUE_MAP_CREATE_INVALID_QUEUE": { - "desc": "Configure a Traffic class to Queue map with invalid value.", - "eStr": "Invalid queue index" - }, - - "TC_TO_PRIORITY_GROUP_MAP_CRETAE": { - "desc": "Configure a Traffic Class to Priority Group map." - }, - - "TC_TO_PRIORITY_GROUP_MAP_CREATE_INVALID_TC": { - "desc": "Configure a Traffic class to Priority Group map with invalid key.", - "eStr": "Invalid Traffic Class" - }, - - "TC_TO_PRIORITY_GROUP_MAP_CREATE_INVALID_PRIORITY_GROUP": { - "desc": "Configure a Traffic class to Priority Group map with invalid value.", - "eStr": "Invalid Priority Group" - }, - - "PFC_PRIORITY_TO_QUEUE_MAP_CRETAE": { - "desc": "Configure a PFC priority to Queue map." - }, - - "PFC_PRIORITY_TO_QUEUE_MAP_CREATE_INVALID_PFC_PRIORITY": { - "desc": "Configure a PFC priority to Queue map with invalid key.", - "eStr": "Invalid pfc priority" - }, - - "PFC_PRIORITY_TO_QUEUE_MAP_CREATE_INVALID_QUEUE": { - "desc": "Configure a PFC priority to Queue map with invalid value.", - "eStr": "Invalid queue index" - }, - - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_CRETAE": { - "desc": "Configure a PFC priority to Priority Group map." - }, - - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_CREATE_INVALID_PFC_PRIORITY": { - "desc": "Configure a PFC priority to Priority Group map with invalid key.", - "eStr": "Invalid pfc priority" - }, - - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_CREATE_INVALID_PRIORITY_GROUP": { - "desc": "Configure a PFC priority to Priority Group map with invalid value.", - "eStr": "Invalid Priority Group" - }, - - "PORT_QOS_MAP_APPLY_MAPS": { - "desc": "Configure qos maps on port." - }, - - "PORT_QOS_MAP_APPLY_NON_EXISTS_MAPS": { - "desc": "Configure non exists qos maps on port.", - "eStrKey": "LeafRef" - }, - - "PORT_QOS_MAP_APPLY_NON_EXISTS_PORT": { - "desc": "Configure port qos map entry on non exists port.", - "eStrKey": "LeafRef" - }, - - "PORT_QOS_MAP_APPLY_INVALID_PFC": { - "desc": "Configure port pfc enable with invalid pfc priority.", - "eStrKey": "Pattern" - } -} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/qosmaps.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/qosmaps.json deleted file mode 100644 index fe085ee3c7f9..000000000000 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/qosmaps.json +++ /dev/null @@ -1,724 +0,0 @@ -{ - "DSCP_TO_TC_MAP_CRETAE": { - "sonic-dscp-tc-map:sonic-dscp-tc-map": { - "sonic-dscp-tc-map:DSCP_TO_TC_MAP": { - "DSCP_TO_TC_MAP_LIST": [ - { - "name": "map1", - "DSCP_TO_TC_MAP": [ - { - "dscp": "1", - "tc": "1" - }, - { - "dscp":"2", - "tc":"2" - } - ] - }, - { - "name": "map2", - "DSCP_TO_TC_MAP": [ - { - "dscp": "1", - "tc": "1" - }, - { - "dscp":"2", - "tc":"2" - } - ] - } - ] - } - } - }, - - "DSCP_TO_TC_MAP_CREATE_INVALID_DSCP": { - "sonic-dscp-tc-map:sonic-dscp-tc-map": { - "sonic-dscp-tc-map:DSCP_TO_TC_MAP": { - "DSCP_TO_TC_MAP_LIST": [ - { - "name": "map3", - "DSCP_TO_TC_MAP": [ - { - "dscp": "64", - "tc": "1" - }, - { - "dscp":"2", - "tc":"2" - } - ] - } - ] - } - } - }, - - "DSCP_TO_TC_MAP_CREATE_INVALID_TC": { - "sonic-dscp-tc-map:sonic-dscp-tc-map": { - "sonic-dscp-tc-map:DSCP_TO_TC_MAP": { - "DSCP_TO_TC_MAP_LIST": [ - { - "name": "map3", - "DSCP_TO_TC_MAP": [ - { - "dscp": "1", - "tc": "8" - }, - { - "dscp":"2", - "tc":"2" - } - ] - } - ] - } - } - }, - - "DOT1P_TO_TC_MAP_CRETAE": { - "sonic-dot1p-tc-map:sonic-dot1p-tc-map": { - "sonic-dot1p-tc-map:DOT1P_TO_TC_MAP": { - "DOT1P_TO_TC_MAP_LIST": [ - { - "name": "map1", - "DOT1P_TO_TC_MAP": [ - { - "dot1p": "1", - "tc": "1" - }, - { - "dot1p":"2", - "tc":"2" - } - ] - }, - { - "name": "map2", - "DOT1P_TO_TC_MAP": [ - { - "dot1p": "1", - "tc": "1" - }, - { - "dot1p":"2", - "tc":"2" - } - ] - } - ] - } - } - }, - - "DOT1P_TO_TC_MAP_CREATE_INVALID_DOT1P": { - "sonic-dot1p-tc-map:sonic-dot1p-tc-map": { - "sonic-dot1p-tc-map:DOT1P_TO_TC_MAP": { - "DOT1P_TO_TC_MAP_LIST": [ - { - "name": "map3", - "DOT1P_TO_TC_MAP": [ - { - "dot1p": "64", - "tc": "1" - }, - { - "dot1p":"2", - "tc":"2" - } - ] - } - ] - } - } - }, - - "DOT1P_TO_TC_MAP_CREATE_INVALID_TC": { - "sonic-dot1p-tc-map:sonic-dot1p-tc-map": { - "sonic-dot1p-tc-map:DOT1P_TO_TC_MAP": { - "DOT1P_TO_TC_MAP_LIST": [ - { - "name": "map3", - "DOT1P_TO_TC_MAP": [ - { - "dot1p": "1", - "tc": "8" - }, - { - "dot1p":"2", - "tc":"2" - } - ] - } - ] - } - } - }, - - "TC_TO_QUEUE_MAP_CRETAE": { - "sonic-tc-queue-map:sonic-tc-queue-map": { - "sonic-tc-queue-map:TC_TO_QUEUE_MAP": { - "TC_TO_QUEUE_MAP_LIST": [ - { - "name": "map1", - "TC_TO_QUEUE_MAP": [ - { - "tc": "1", - "qindex": "1" - }, - { - "tc":"2", - "qindex":"2" - } - ] - }, - { - "name": "map2", - "TC_TO_QUEUE_MAP": [ - { - "tc": "1", - "qindex": "1" - }, - { - "tc":"2", - "qindex":"2" - } - ] - } - ] - } - } - }, - - "TC_TO_QUEUE_MAP_CREATE_INVALID_TC": { - "sonic-tc-queue-map:sonic-tc-queue-map": { - "sonic-tc-queue-map:TC_TO_QUEUE_MAP": { - "TC_TO_QUEUE_MAP_LIST": [ - { - "name": "map3", - "TC_TO_QUEUE_MAP": [ - { - "tc": "64", - "qindex": "1" - }, - { - "tc":"2", - "qindex":"2" - } - ] - } - ] - } - } - }, - - "TC_TO_QUEUE_MAP_CREATE_INVALID_QUEUE": { - "sonic-tc-queue-map:sonic-tc-queue-map": { - "sonic-tc-queue-map:TC_TO_QUEUE_MAP": { - "TC_TO_QUEUE_MAP_LIST": [ - { - "name": "map3", - "TC_TO_QUEUE_MAP": [ - { - "tc": "1", - "qindex": "8" - }, - { - "tc":"2", - "qindex":"2" - } - ] - } - ] - } - } - }, - - "TC_TO_PRIORITY_GROUP_MAP_CRETAE": { - "sonic-tc-priority-group-map:sonic-tc-priority-group-map": { - "sonic-tc-priority-group-map:TC_TO_PRIORITY_GROUP_MAP": { - "TC_TO_PRIORITY_GROUP_MAP_LIST": [ - { - "name": "map1", - "TC_TO_PRIORITY_GROUP_MAP": [ - { - "tc": "1", - "pg": "1" - }, - { - "tc":"2", - "pg":"2" - } - ] - }, - { - "name": "map2", - "TC_TO_PRIORITY_GROUP_MAP": [ - { - "tc": "1", - "pg": "1" - }, - { - "tc":"2", - "pg":"2" - } - ] - } - ] - } - } - }, - - "TC_TO_PRIORITY_GROUP_MAP_CREATE_INVALID_TC": { - "sonic-tc-priority-group-map:sonic-tc-priority-group-map": { - "sonic-tc-priority-group-map:TC_TO_PRIORITY_GROUP_MAP": { - "TC_TO_PRIORITY_GROUP_MAP_LIST": [ - { - "name": "map3", - "TC_TO_PRIORITY_GROUP_MAP": [ - { - "tc": "64", - "pg": "1" - }, - { - "tc":"2", - "pg":"2" - } - ] - } - ] - } - } - }, - - "TC_TO_PRIORITY_GROUP_MAP_CREATE_INVALID_PRIORITY_GROUP": { - "sonic-tc-priority-group-map:sonic-tc-priority-group-map": { - "sonic-tc-priority-group-map:TC_TO_PRIORITY_GROUP_MAP": { - "TC_TO_PRIORITY_GROUP_MAP_LIST": [ - { - "name": "map3", - "TC_TO_PRIORITY_GROUP_MAP": [ - { - "tc": "1", - "pg": "8" - }, - { - "tc":"2", - "pg":"2" - } - ] - } - ] - } - } - }, - - "PFC_PRIORITY_TO_QUEUE_MAP_CRETAE": { - "sonic-pfc-priority-queue-map:sonic-pfc-priority-queue-map": { - "sonic-pfc-priority-queue-map:MAP_PFC_PRIORITY_TO_QUEUE": { - "MAP_PFC_PRIORITY_TO_QUEUE_LIST": [ - { - "name": "map1", - "MAP_PFC_PRIORITY_TO_QUEUE": [ - { - "pfc_priority": "1", - "qindex": "1" - }, - { - "pfc_priority":"2", - "qindex":"2" - } - ] - }, - { - "name": "map2", - "MAP_PFC_PRIORITY_TO_QUEUE": [ - { - "pfc_priority": "1", - "qindex": "1" - }, - { - "pfc_priority":"2", - "qindex":"2" - } - ] - } - ] - } - } - }, - - "PFC_PRIORITY_TO_QUEUE_MAP_CREATE_INVALID_PFC_PRIORITY": { - "sonic-pfc-priority-queue-map:sonic-pfc-priority-queue-map": { - "sonic-pfc-priority-queue-map:MAP_PFC_PRIORITY_TO_QUEUE": { - "MAP_PFC_PRIORITY_TO_QUEUE_LIST": [ - { - "name": "map3", - "MAP_PFC_PRIORITY_TO_QUEUE": [ - { - "pfc_priority": "64", - "qindex": "1" - }, - { - "pfc_priority":"2", - "qindex":"2" - } - ] - } - ] - } - } - }, - - "PFC_PRIORITY_TO_QUEUE_MAP_CREATE_INVALID_QUEUE": { - "sonic-pfc-priority-queue-map:sonic-pfc-priority-queue-map": { - "sonic-pfc-priority-queue-map:MAP_PFC_PRIORITY_TO_QUEUE": { - "MAP_PFC_PRIORITY_TO_QUEUE_LIST": [ - { - "name": "map3", - "MAP_PFC_PRIORITY_TO_QUEUE": [ - { - "pfc_priority": "1", - "qindex": "8" - }, - { - "pfc_priority":"2", - "qindex":"2" - } - ] - } - ] - } - } - }, - - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_CRETAE": { - "sonic-pfc-priority-priority-group-map:sonic-pfc-priority-priority-group-map": { - "sonic-pfc-priority-priority-group-map:PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_LIST": [ - { - "name": "map1", - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": [ - { - "pfc_priority": "1", - "pg": "1" - }, - { - "pfc_priority":"2", - "pg":"2" - } - ] - }, - { - "name": "map2", - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": [ - { - "pfc_priority": "1", - "pg": "1" - }, - { - "pfc_priority":"2", - "pg":"2" - } - ] - } - ] - } - } - }, - - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_CREATE_INVALID_PFC_PRIORITY": { - "sonic-pfc-priority-priority-group-map:sonic-pfc-priority-priority-group-map": { - "sonic-pfc-priority-priority-group-map:PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_LIST": [ - { - "name": "map3", - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": [ - { - "pfc_priority": "64", - "pg": "1" - }, - { - "pfc_priority":"2", - "pg":"2" - } - ] - } - ] - } - } - }, - - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_CREATE_INVALID_PRIORITY_GROUP": { - "sonic-pfc-priority-priority-group-map:sonic-pfc-priority-priority-group-map": { - "sonic-pfc-priority-priority-group-map:PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_LIST": [ - { - "name": "map3", - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": [ - { - "pfc_priority": "1", - "pg": "8" - }, - { - "pfc_priority":"2", - "pg":"2" - } - ] - } - ] - } - } - }, - - "PORT_QOS_MAP_APPLY_MAPS": { - "sonic-dscp-tc-map:sonic-dscp-tc-map": { - "sonic-dscp-tc-map:DSCP_TO_TC_MAP": { - "DSCP_TO_TC_MAP_LIST": [ - { - "name": "map1", - "DSCP_TO_TC_MAP": [ - { - "dscp": "1", - "tc": "1" - }, - { - "dscp":"2", - "tc":"2" - } - ] - } - ] - } - }, - - "sonic-dot1p-tc-map:sonic-dot1p-tc-map": { - "sonic-dot1p-tc-map:DOT1P_TO_TC_MAP": { - "DOT1P_TO_TC_MAP_LIST": [ - { - "name": "map1", - "DOT1P_TO_TC_MAP": [ - { - "dot1p": "1", - "tc": "1" - }, - { - "dot1p":"2", - "tc":"2" - } - ] - } - ] - } - }, - - "sonic-tc-queue-map:sonic-tc-queue-map": { - "sonic-tc-queue-map:TC_TO_QUEUE_MAP": { - "TC_TO_QUEUE_MAP_LIST": [ - { - "name": "map1", - "TC_TO_QUEUE_MAP": [ - { - "tc": "1", - "qindex": "1" - }, - { - "tc":"2", - "qindex":"2" - } - ] - } - ] - } - }, - "sonic-tc-priority-group-map:sonic-tc-priority-group-map": { - "sonic-tc-priority-group-map:TC_TO_PRIORITY_GROUP_MAP": { - "TC_TO_PRIORITY_GROUP_MAP_LIST": [ - { - "name": "map1", - "TC_TO_PRIORITY_GROUP_MAP": [ - { - "tc": "1", - "pg": "1" - }, - { - "tc":"2", - "pg":"2" - } - ] - } - ] - } - }, - - "sonic-pfc-priority-queue-map:sonic-pfc-priority-queue-map": { - "sonic-pfc-priority-queue-map:MAP_PFC_PRIORITY_TO_QUEUE": { - "MAP_PFC_PRIORITY_TO_QUEUE_LIST": [ - { - "name": "map1", - "MAP_PFC_PRIORITY_TO_QUEUE": [ - { - "pfc_priority": "1", - "qindex": "1" - }, - { - "pfc_priority":"2", - "qindex":"2" - } - ] - } - ] - } - }, - - "sonic-pfc-priority-priority-group-map:sonic-pfc-priority-priority-group-map": { - "sonic-pfc-priority-priority-group-map:PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_LIST": [ - { - "name": "map1", - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": [ - { - "pfc_priority": "1", - "pg": "1" - }, - { - "pfc_priority":"2", - "pg":"2" - } - ] - } - ] - } - }, - - "sonic-port:sonic-port": { - "sonic-port:PORT": { - "PORT_LIST": [ - { - "admin_status": "up", - "alias": "eth0", - "description": "Ethernet0", - "lanes": "65", - "mtu": "9000", - "name": "Ethernet0", - "tpid": "0x8100", - "speed": "25000" - } - ] - } - }, - "sonic-port-qos-map:sonic-port-qos-map": { - "sonic-port-qos-map:PORT_QOS_MAP": { - "PORT_QOS_MAP_LIST": [ - { - "ifname": "Ethernet0", - "dscp_to_tc_map": "map1", - "tc_to_pg_map": "map1", - "tc_to_queue_map": "map1", - "pfc_to_queue_map": "map1", - "pfc_to_pg_map": "map1", - "dscp_to_tc_map": "map1", - "dot1p_to_tc_map": "map1", - "pfc_enable": "3,4" - } - ] - } - } - }, - - "PORT_QOS_MAP_APPLY_NON_EXISTS_MAPS": { - "sonic-port:sonic-port": { - "sonic-port:PORT": { - "PORT_LIST": [ - { - "admin_status": "up", - "alias": "eth0", - "description": "Ethernet0", - "lanes": "65", - "mtu": "9000", - "name": "Ethernet0", - "tpid": "0x8100", - "speed": "25000" - } - ] - } - }, - "sonic-port-qos-map:sonic-port-qos-map": { - "sonic-port-qos-map:PORT_QOS_MAP": { - "PORT_QOS_MAP_LIST": [ - { - "ifname": "Ethernet0", - "dscp_to_tc_map": "map2", - "tc_to_pg_map": "map2", - "tc_to_queue_map": "map2", - "pfc_to_queue_map": "map2", - "pfc_to_pg_map": "map2", - "dscp_to_tc_map": "map2", - "dot1p_to_tc_map": "map2", - "pfc_enable": "3,4" - } - ] - } - } - }, - - "PORT_QOS_MAP_APPLY_NON_EXISTS_PORT": { - "sonic-port:sonic-port": { - "sonic-port:PORT": { - "PORT_LIST": [ - { - "admin_status": "up", - "alias": "eth0", - "description": "Ethernet4", - "lanes": "65", - "mtu": "9000", - "name": "Ethernet4", - "tpid": "0x8100", - "speed": "25000" - } - ] - } - }, - "sonic-port-qos-map:sonic-port-qos-map": { - "sonic-port-qos-map:PORT_QOS_MAP": { - "PORT_QOS_MAP_LIST": [ - { - "ifname": "Ethernet0" - } - ] - } - } - }, - - "PORT_QOS_MAP_APPLY_INVALID_PFC": { - "sonic-port:sonic-port": { - "sonic-port:PORT": { - "PORT_LIST": [ - { - "admin_status": "up", - "alias": "eth0", - "description": "Ethernet4", - "lanes": "65", - "mtu": "9000", - "name": "Ethernet4", - "tpid": "0x8100", - "speed": "25000" - } - ] - } - }, - "sonic-port-qos-map:sonic-port-qos-map": { - "sonic-port-qos-map:PORT_QOS_MAP": { - "PORT_QOS_MAP_LIST": [ - { - "ifname": "Ethernet4", - "pfc_enable": "8" - } - ] - } - } - } - -} diff --git a/src/sonic-yang-models/yang-models/sonic-dot1p-tc-map.yang b/src/sonic-yang-models/yang-models/sonic-dot1p-tc-map.yang deleted file mode 100644 index 0a756298c97e..000000000000 --- a/src/sonic-yang-models/yang-models/sonic-dot1p-tc-map.yang +++ /dev/null @@ -1,68 +0,0 @@ -module sonic-dot1p-tc-map { - - yang-version 1.1; - - namespace "http://github.com/Azure/sonic-dot1p-tc-map"; - - prefix dot1ptm; - - organization - "SONiC"; - - contact - "SONiC"; - - description - "DOT1P_TO_TC_MAP yang Module for SONiC OS"; - - revision 2021-04-15 { - description - "Initial revision."; - } - - container sonic-dot1p-tc-map { - - container DOT1P_TO_TC_MAP { - - description "DOT1P_TO_TC_MAP part of config_db.json"; - - list DOT1P_TO_TC_MAP_LIST { - - key "name"; - - leaf name { - type string { - pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})'; - length 1..32 { - error-message "Invalid length for map name."; - error-app-tag map-name-invalid-length; - } - } - } - - list DOT1P_TO_TC_MAP { //this is list inside list for storing mapping between two fields - - key "dot1p"; - - leaf dot1p { - type string { - pattern "[0-7]?" { - error-message "Invalid DOT1P"; - error-app-tag dot1p-invalid; - } - } - } - - leaf tc { - type string { - pattern "[0-7]?"{ - error-message "Invalid Traffic Class"; - error-app-tag tc-invalid; - } - } - } - } - } - } - } -} diff --git a/src/sonic-yang-models/yang-models/sonic-dscp-tc-map.yang b/src/sonic-yang-models/yang-models/sonic-dscp-tc-map.yang deleted file mode 100644 index 71d9fcd4884d..000000000000 --- a/src/sonic-yang-models/yang-models/sonic-dscp-tc-map.yang +++ /dev/null @@ -1,68 +0,0 @@ -module sonic-dscp-tc-map { - - yang-version 1.1; - - namespace "http://github.com/Azure/sonic-dscp-tc-map"; - - prefix dtm; - - organization - "SONiC"; - - contact - "SONiC"; - - description - "DSCP_TO_TC_MAP yang Module for SONiC OS"; - - revision 2021-04-15 { - description - "Initial revision."; - } - - container sonic-dscp-tc-map { - - container DSCP_TO_TC_MAP { - - description "DSCP_TO_TC_MAP part of config_db.json"; - - list DSCP_TO_TC_MAP_LIST { - - key "name"; - - leaf name { - type string { - pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})'; - length 1..32 { - error-message "Invalid length for map name."; - error-app-tag map-name-invalid-length; - } - } - } - - list DSCP_TO_TC_MAP { //this is list inside list for storing mapping between two fields - - key "dscp"; - - leaf dscp { - type string { - pattern "6[0-3]|[1-5][0-9]?|[0-9]?" { - error-message "Invalid DSCP"; - error-app-tag dscp-invalid; - } - } - } - - leaf tc { - type string { - pattern "[0-7]?" { - error-message "Invalid Traffic Class"; - error-app-tag tc-invalid; - } - } - } - } - } - } - } -} diff --git a/src/sonic-yang-models/yang-models/sonic-pfc-priority-priority-group-map.yang b/src/sonic-yang-models/yang-models/sonic-pfc-priority-priority-group-map.yang deleted file mode 100644 index ccc86c064efb..000000000000 --- a/src/sonic-yang-models/yang-models/sonic-pfc-priority-priority-group-map.yang +++ /dev/null @@ -1,68 +0,0 @@ -module sonic-pfc-priority-priority-group-map { - - yang-version 1.1; - - namespace "http://github.com/Azure/sonic-pfc-priority-priority-group-map"; - - prefix pppgm; - - organization - "SONiC"; - - contact - "SONiC"; - - description - "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP yang Module for SONiC OS"; - - revision 2021-04-15 { - description - "Initial revision."; - } - - container sonic-pfc-priority-priority-group-map { - - container PFC_PRIORITY_TO_PRIORITY_GROUP_MAP { - - description "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP part of config_db.json"; - - list PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_LIST { - - key "name"; - - leaf name { - type string { - pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})'; - length 1..32 { - error-message "Invalid length for map name."; - error-app-tag map-name-invalid-length; - } - } - } - - list PFC_PRIORITY_TO_PRIORITY_GROUP_MAP { //this is list inside list for storing mapping between two fields - - key "pfc_priority"; - - leaf pfc_priority { - type string { - pattern "[0-7]?" { - error-message "Invalid pfc priority"; - error-app-tag pfc-priority-invalid; - } - } - } - - leaf pg { - type string { - pattern "[0-7]?" { - error-message "Invalid Priority Group"; - error-app-tag pg-invalid; - } - } - } - } - } - } - } -} diff --git a/src/sonic-yang-models/yang-models/sonic-pfc-priority-queue-map.yang b/src/sonic-yang-models/yang-models/sonic-pfc-priority-queue-map.yang deleted file mode 100644 index fb659d89bb4b..000000000000 --- a/src/sonic-yang-models/yang-models/sonic-pfc-priority-queue-map.yang +++ /dev/null @@ -1,68 +0,0 @@ -module sonic-pfc-priority-queue-map { - - yang-version 1.1; - - namespace "http://github.com/Azure/sonic-pfc-priority-queue-map"; - - prefix ppqm; - - organization - "SONiC"; - - contact - "SONiC"; - - description - "PFC_PRIORITY_TO_QUEUE_MAP yang Module for SONiC OS"; - - revision 2021-04-15 { - description - "Initial revision."; - } - - container sonic-pfc-priority-queue-map { - - container MAP_PFC_PRIORITY_TO_QUEUE { - - description "MAP_PFC_PRIORITY_TO_QUEUE part of config_db.json"; - - list MAP_PFC_PRIORITY_TO_QUEUE_LIST { - - key "name"; - - leaf name { - type string { - pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})'; - length 1..32 { - error-message "Invalid length for map name."; - error-app-tag map-name-invalid-length; - } - } - } - - list MAP_PFC_PRIORITY_TO_QUEUE { //this is list inside list for storing mapping between two fields - - key "pfc_priority"; - - leaf pfc_priority { - type string { - pattern "[0-7]?" { - error-message "Invalid pfc priority"; - error-app-tag pfc-priority-invalid; - } - } - } - - leaf qindex { - type string { - pattern "[0-7]?" { - error-message "Invalid queue index"; - error-app-tag queue-index-invalid; - } - } - } - } - } - } - } -} diff --git a/src/sonic-yang-models/yang-models/sonic-port-qos-map.yang b/src/sonic-yang-models/yang-models/sonic-port-qos-map.yang deleted file mode 100644 index b29e2f547087..000000000000 --- a/src/sonic-yang-models/yang-models/sonic-port-qos-map.yang +++ /dev/null @@ -1,110 +0,0 @@ -module sonic-port-qos-map { - - yang-version 1.1; - - namespace "http://github.com/Azure/sonic-port-qos-map"; - - prefix pqm; - - import sonic-port { - prefix prt; - } - - import sonic-tc-priority-group-map { - prefix tpgm; - } - - import sonic-tc-queue-map { - prefix tqm; - } - - import sonic-pfc-priority-queue-map { - prefix ppqm; - } - - import sonic-pfc-priority-priority-group-map { - prefix pppgm; - } - - import sonic-dscp-tc-map { - prefix dtm; - } - - import sonic-dot1p-tc-map { - prefix dot1ptm; - } - - organization - "SONiC"; - - contact - "SONiC"; - - description - "SONIC PORT_QOS_MAP"; - - revision 2019-05-15 { - description - "Initial revision."; - } - - container sonic-port-qos-map { - - container PORT_QOS_MAP { - list PORT_QOS_MAP_LIST { - - key "ifname"; - - leaf ifname { - type leafref { - path "/prt:sonic-port/prt:PORT/prt:PORT_LIST/prt:name"; - } - description - "Reference of port on which QOS MAPS to be configured."; - } - - leaf tc_to_pg_map { - type leafref { - path "/tpgm:sonic-tc-priority-group-map/tpgm:TC_TO_PRIORITY_GROUP_MAP/tpgm:TC_TO_PRIORITY_GROUP_MAP_LIST/tpgm:name"; - } - } - - leaf tc_to_queue_map { - type leafref { - path "/tqm:sonic-tc-queue-map/tqm:TC_TO_QUEUE_MAP/tqm:TC_TO_QUEUE_MAP_LIST/tqm:name"; - } - } - - leaf pfc_enable { - type string { - pattern "[0-7](,[0-7])?"; - } - } - - leaf pfc_to_queue_map { - type leafref { - path "/ppqm:sonic-pfc-priority-queue-map/ppqm:MAP_PFC_PRIORITY_TO_QUEUE/ppqm:MAP_PFC_PRIORITY_TO_QUEUE_LIST/ppqm:name"; - } - } - - leaf pfc_to_pg_map { - type leafref { - path "/pppgm:sonic-pfc-priority-priority-group-map/pppgm:PFC_PRIORITY_TO_PRIORITY_GROUP_MAP/pppgm:PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_LIST/pppgm:name"; - } - } - - leaf dscp_to_tc_map { - type leafref { - path "/dtm:sonic-dscp-tc-map/dtm:DSCP_TO_TC_MAP/dtm:DSCP_TO_TC_MAP_LIST/dtm:name"; - } - } - - leaf dot1p_to_tc_map { - type leafref { - path "/dot1ptm:sonic-dot1p-tc-map/dot1ptm:DOT1P_TO_TC_MAP/dot1ptm:DOT1P_TO_TC_MAP_LIST/dot1ptm:name"; - } - } - } - } - } -} diff --git a/src/sonic-yang-models/yang-models/sonic-tc-priority-group-map.yang b/src/sonic-yang-models/yang-models/sonic-tc-priority-group-map.yang deleted file mode 100644 index 4290b79c3ee7..000000000000 --- a/src/sonic-yang-models/yang-models/sonic-tc-priority-group-map.yang +++ /dev/null @@ -1,68 +0,0 @@ -module sonic-tc-priority-group-map { - - yang-version 1.1; - - namespace "http://github.com/Azure/sonic-tc-priority-group-map"; - - prefix tpgm; - - organization - "SONiC"; - - contact - "SONiC"; - - description - "TC_TO_PRIORITY_GROUP_MAP yang Module for SONiC OS"; - - revision 2021-04-15 { - description - "Initial revision."; - } - - container sonic-tc-priority-group-map { - - container TC_TO_PRIORITY_GROUP_MAP { - - description "TC_TO_PRIORITY_GROUP_MAP part of config_db.json"; - - list TC_TO_PRIORITY_GROUP_MAP_LIST { - - key "name"; - - leaf name { - type string { - pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})'; - length 1..32 { - error-message "Invalid length for map name."; - error-app-tag map-name-invalid-length; - } - } - } - - list TC_TO_PRIORITY_GROUP_MAP { //this is list inside list for storing mapping between two fields - - key "tc"; - - leaf tc { - type string { - pattern "[0-7]?" { - error-message "Invalid Traffic Class"; - error-app-tag tc-invalid; - } - } - } - - leaf pg { - type string { - pattern "[0-7]?" { - error-message "Invalid Priority Group"; - error-app-tag pg-invalid; - } - } - } - } - } - } - } -} diff --git a/src/sonic-yang-models/yang-models/sonic-tc-queue-map.yang b/src/sonic-yang-models/yang-models/sonic-tc-queue-map.yang deleted file mode 100644 index fa22a8331294..000000000000 --- a/src/sonic-yang-models/yang-models/sonic-tc-queue-map.yang +++ /dev/null @@ -1,68 +0,0 @@ -module sonic-tc-queue-map { - - yang-version 1.1; - - namespace "http://github.com/Azure/sonic-tc-queue-map"; - - prefix tqm; - - organization - "SONiC"; - - contact - "SONiC"; - - description - "TC_TO_QUEUE_MAP yang Module for SONiC OS"; - - revision 2021-04-15 { - description - "Initial revision."; - } - - container sonic-tc-queue-map { - - container TC_TO_QUEUE_MAP { - - description "TC_TO_QUEUE_MAP part of config_db.json"; - - list TC_TO_QUEUE_MAP_LIST { - - key "name"; - - leaf name { - type string { - pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})'; - length 1..32 { - error-message "Invalid length for map name."; - error-app-tag map-name-invalid-length; - } - } - } - - list TC_TO_QUEUE_MAP { //this is list inside list for storing mapping between two fields - - key "tc"; - - leaf tc { - type string { - pattern "[0-7]?" { - error-message "Invalid Traffic Class"; - error-app-tag tc-invalid; - } - } - } - - leaf qindex { - type string { - pattern "[0-7]?" { - error-message "Invalid queue index"; - error-app-tag queue-index-invalid; - } - } - } - } - } - } - } -} From f0b2122a00983c59d74f60ca88a839ed8081c11b Mon Sep 17 00:00:00 2001 From: Sudharsan Dhamal Gopalarathnam Date: Wed, 20 Oct 2021 04:48:12 +0000 Subject: [PATCH 3/6] Revert "[Yang model] SONiC QOS Scheduler, WRED, Queue Yangs (#7281)" This reverts commit a99d78dedb838644d13150f5946a962a80ebacab. --- src/sonic-yang-models/setup.py | 3 - .../tests/files/sample_config_db.json | 51 +- .../tests/yang_model_tests/tests/qos.json | 85 ---- .../yang_model_tests/tests_config/qos.json | 477 ------------------ .../yang-models/sonic-queue.yang | 88 ---- .../yang-models/sonic-scheduler.yang | 148 ------ .../yang-models/sonic-wred-profile.yang | 177 ------- 7 files changed, 1 insertion(+), 1028 deletions(-) delete mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/qos.json delete mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests_config/qos.json delete mode 100644 src/sonic-yang-models/yang-models/sonic-queue.yang delete mode 100644 src/sonic-yang-models/yang-models/sonic-scheduler.yang delete mode 100644 src/sonic-yang-models/yang-models/sonic-wred-profile.yang diff --git a/src/sonic-yang-models/setup.py b/src/sonic-yang-models/setup.py index 0ffc2dfd3ab8..51c190e495d4 100644 --- a/src/sonic-yang-models/setup.py +++ b/src/sonic-yang-models/setup.py @@ -76,9 +76,6 @@ './yang-models/sonic-vrf.yang', './yang-models/sonic-warm-restart.yang', './yang-models/sonic-lldp.yang', - './yang-models/sonic-scheduler.yang', - './yang-models/sonic-wred-profile.yang', - './yang-models/sonic-queue.yang', './yang-models/sonic_yang_tree']), ], zip_safe=False, diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index a53c58eae7e9..bd7aff24b554 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -1138,56 +1138,6 @@ "high_mem_alert": "disabled", "state": "enabled" } - }, - - "SCHEDULER": { - "TEST@0": { - "cbs": "256", - "cir": "1250000", - "meter_type": "bytes", - "pbs": "1024", - "pir": "25000000", - "type": "DWRR", - "weight": "20" - }, - - "TEST@1": { - "cbs": "1024", - "cir": "1280000", - "meter_type": "bytes", - "pbs": "2048", - "pir": "2560000", - "type": "STRICT" - } - }, - - "WRED_PROFILE": { - "Wred1": { - "ecn": "ecn_all", - "green_drop_probability": "50", - "green_max_threshold": "2048000", - "green_min_threshold": "1024000", - "wred_green_enable": "true", - "yellow_drop_probability": "50", - "yellow_max_threshold": "2048000", - "yellow_min_threshold": "1024000", - "wred_yellow_enable": "true", - "red_drop_probability": "50", - "red_max_threshold": "2048000", - "red_min_threshold": "1024000", - "wred_red_enable": "true" - } - }, - - "QUEUE": { - "Ethernet0|0": { - "scheduler": "TEST@0", - "wred_profile": "Wred1" - }, - "Ethernet0|1": { - "scheduler": "TEST@1", - "wred_profile": "Wred1" - } } }, @@ -1196,4 +1146,5 @@ "Error": "This Table is for testing, This Table does not have YANG models." } } + } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/qos.json b/src/sonic-yang-models/tests/yang_model_tests/tests/qos.json deleted file mode 100644 index 96b7b4b8d94c..000000000000 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/qos.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "SCHEDULER_VALID": { - "desc": "Configure SCHEDULER table." - }, - - "SCHEDULER_UNDEFINED_TYPE": { - "desc": "Configure undefined type in SCHEDULER table.", - "eStrKey" : "InvalidValue", - "eStr": ["type"] - }, - - "SCHEDULER_INVALID_WEIGHT": { - "desc": "Configure outof range weight in SCHEDULER table.", - "eStrKey" : "Pattern" - }, - - "SCHEDULER_INVALID_METER_TYPE": { - "desc": "Configure unsuported meter type in SCHEDULER table.", - "eStrKey": "InvalidValue", - "eStr": ["meter_type"] - }, - - "SCHEDULER_CBS_NO_CIR": { - "desc": "Configure CBS without CIR.", - "eStr": ["cbs can't be configured without cir"] - }, - - "SCHEDULER_PIR_NO_CIR": { - "desc": "Configure PIR without CIR.", - "eStr": ["pir can't be configured without cir"] - }, - - "SCHEDULER_PIR_VS_CIR": { - "desc": "Configure PIR vs CIR.", - "eStr": ["pir must be greater than or equal to cir"] - }, - - "WRED_PROFILE_EMPTY": { - "desc": "Configure Empty WRED profile." - }, - - "WRED_PROFILE_VALID": { - "desc": "Configure WRED profile." - }, - - "WRED_PROFILE_INVALID_DROP_PROBABILITY": { - "desc": "Configure invalid drop probability in WRED profile.", - "eStrKey" : "Pattern" - }, - - "WRED_PROFILE_INVALID_GREEN_THRESHOLD": { - "desc": "Configure green maximum threshold less than min threshold in WRED profile.", - "eStr": ["Green max threshold must be greater than or equal to min threshold"] - }, - - "WRED_PROFILE_INVALID_YELLOW_THRESHOLD": { - "desc": "Configure yellow maximum threshold less than min threshold in WRED profile.", - "eStr": ["Yellow max threshold must be greater than or equal to min threshold"] - }, - - "WRED_PROFILE_INVALID_RED_THRESHOLD": { - "desc": "Configure red maximum threshold less than min threshold in WRED profile.", - "eStr": ["Red max threshold must be greater than or equal to min threshold"] - }, - - - "QUEUE_VALID": { - "desc": "Attach scheduler and wred profiles to QUEUE." - }, - - "QUEUE_PORT_NOT_EXIST": { - "desc": "Referring non-existing PORT table.", - "eStrKey": "InvalidValue" - }, - - "QUEUE_SCHEDULER_NOT_EXIST": { - "desc": "Referring non-existing SCHEDULER table.", - "eStrKey" : "LeafRef" - }, - - "QUEUE_WRED_NOT_EXIST": { - "desc": "Referring non-existing WRED table.", - "eStrKey" : "LeafRef" - } -} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/qos.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/qos.json deleted file mode 100644 index 481990b4d657..000000000000 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/qos.json +++ /dev/null @@ -1,477 +0,0 @@ -{ - "SCHEDULER_VALID": { - "sonic-scheduler:sonic-scheduler":{ - "sonic-scheduler:SCHEDULER": { - "SCHEDULER_LIST": [ - { - "name":"Test@0", - "cbs": 256, - "cir": 1250000, - "meter_type": "bytes", - "pbs": 1024, - "pir": 25000000, - "type": "DWRR", - "weight": 10 - }, - { - "name":"Test@1", - "cbs": 1024, - "cir": 1280000, - "meter_type": "bytes", - "pbs": 2048, - "pir": 2560000, - "type": "STRICT", - "priority": 0 - }, - { - "name":"Test@2", - "cbs": 256, - "cir": 1250000, - "meter_type": "bytes", - "pbs": 1024, - "pir": 25000000, - "type": "WRR", - "weight": 20 - } - ] - } - } - }, - - "SCHEDULER_UNDEFINED_TYPE": { - "sonic-scheduler:sonic-scheduler":{ - "sonic-scheduler:SCHEDULER": { - "SCHEDULER_LIST": [ - { - "name":"Test@0", - "type": "invalid" - } - ] - } - } - }, - - "SCHEDULER_INVALID_WEIGHT": { - "sonic-scheduler:sonic-scheduler":{ - "sonic-scheduler:SCHEDULER": { - "SCHEDULER_LIST": [ - { - "name":"Test@0", - "weight": 120 - } - ] - } - } - }, - - "SCHEDULER_INVALID_METER_TYPE": { - "sonic-scheduler:sonic-scheduler":{ - "sonic-scheduler:SCHEDULER": { - "SCHEDULER_LIST": [ - { - "name":"Test@0", - "meter_type": "invalid" - } - ] - } - } - }, - - "SCHEDULER_CBS_NO_CIR": { - "sonic-scheduler:sonic-scheduler":{ - "sonic-scheduler:SCHEDULER": { - "SCHEDULER_LIST": [ - { - "name":"Test@0", - "cbs": 1024 - } - ] - } - } - }, - - "SCHEDULER_PIR_NO_CIR": { - "sonic-scheduler:sonic-scheduler":{ - "sonic-scheduler:SCHEDULER": { - "SCHEDULER_LIST": [ - { - "name":"Test@0", - "pir": 1024 - } - ] - } - } - }, - - "SCHEDULER_PIR_VS_CIR": { - "sonic-scheduler:sonic-scheduler":{ - "sonic-scheduler:SCHEDULER": { - "SCHEDULER_LIST": [ - { - "name":"Test@0", - "cir": 2048, - "pir": 1024 - } - ] - } - } - }, - - - "WRED_PROFILE_EMPTY": { - "sonic-wred-profile:sonic-wred-profile":{ - "sonic-wred-profile:WRED_PROFILE": { - "WRED_PROFILE_LIST": [ - { - "name":"Wred1" - } - ] - } - } - }, - - "WRED_PROFILE_VALID": { - "sonic-wred-profile:sonic-wred-profile":{ - "sonic-wred-profile:WRED_PROFILE": { - "WRED_PROFILE_LIST": [ - { - "name":"Wred2", - "yellow_min_threshold": 2048, - "green_min_threshold": 4096, - "red_min_threshold": 1024, - "yellow_max_threshold": 4096, - "green_max_threshold": 8192, - "red_max_threshold": 2048, - "ecn": "ecn_none", - "wred_green_enable": true, - "wred_yellow_enable": true, - "wred_red_enable": true, - "yellow_drop_probability": 50, - "green_drop_probability": 25, - "red_drop_probability": 100 - }, - { - "name":"Wred3", - "yellow_min_threshold": 2048, - "green_min_threshold": 4096, - "red_min_threshold": 1024, - "yellow_max_threshold": 4096, - "green_max_threshold": 8192, - "red_max_threshold": 2048, - "ecn": "ecn_all", - "wred_green_enable": true, - "wred_yellow_enable": true, - "wred_red_enable": true, - "yellow_drop_probability": 50, - "green_drop_probability": 25, - "red_drop_probability": 100 - }, - { - "name":"Wred4", - "green_min_threshold": 4096, - "green_max_threshold": 8192, - "ecn": "ecn_all", - "wred_green_enable": true - } - ] - } - } - }, - - "WRED_PROFILE_INVALID_DROP_PROBABILITY": { - "sonic-wred-profile:sonic-wred-profile": { - "sonic-wred-profile:WRED_PROFILE": { - "WRED_PROFILE_LIST": [ - { - "name":"Wred4", - "red_min_threshold": 1024, - "red_max_threshold": 2048, - "wred_red_enable": true, - "red_drop_probability": 125, - "green_drop_probability": 25, - "yellow_drop_probability": 25, - "ecn": "ecn_all" - } - ] - } - } - }, - - "WRED_PROFILE_INVALID_GREEN_THRESHOLD": { - "sonic-wred-profile:sonic-wred-profile": { - "sonic-wred-profile:WRED_PROFILE": { - "WRED_PROFILE_LIST": [ - { - "name":"Wred4", - "green_min_threshold": 4096, - "green_max_threshold": 2048, - "wred_green_enable": true, - "green_drop_probability": 25, - "ecn": "ecn_all" - } - ] - } - } - }, - - "WRED_PROFILE_INVALID_YELLOW_THRESHOLD": { - "sonic-wred-profile:sonic-wred-profile": { - "sonic-wred-profile:WRED_PROFILE": { - "WRED_PROFILE_LIST": [ - { - "name":"Wred4", - "yellow_min_threshold": 4096, - "yellow_max_threshold": 2048, - "wred_yellow_enable": true, - "yellow_drop_probability": 25, - "ecn": "ecn_all" - } - ] - } - } - }, - - "WRED_PROFILE_INVALID_RED_THRESHOLD": { - "sonic-wred-profile:sonic-wred-profile": { - "sonic-wred-profile:WRED_PROFILE": { - "WRED_PROFILE_LIST": [ - { - "name":"Wred4", - "red_min_threshold": 4096, - "red_max_threshold": 2048, - "wred_red_enable": true, - "red_drop_probability": 25, - "ecn": "ecn_all" - } - ] - } - } - }, - - - "QUEUE_VALID": { - "sonic-scheduler:sonic-scheduler":{ - "sonic-scheduler:SCHEDULER": { - "SCHEDULER_LIST": [ - { - "name":"Test@0", - "cbs": 256, - "cir": 1250000, - "meter_type": "bytes", - "pbs": 1024, - "pir": 25000000, - "type": "DWRR", - "weight": 10 - } - ] - } - }, - "sonic-wred-profile:sonic-wred-profile":{ - "sonic-wred-profile:WRED_PROFILE": { - "WRED_PROFILE_LIST": [ - { - "name":"Wred1", - "yellow_min_threshold": 2048, - "green_min_threshold": 4096, - "red_min_threshold": 1024, - "yellow_max_threshold": 4096, - "green_max_threshold": 8192, - "red_max_threshold": 2048, - "ecn": "ecn_none", - "wred_green_enable": true, - "wred_yellow_enable": true, - "wred_red_enable": true, - "yellow_drop_probability": 50, - "green_drop_probability": 25, - "red_drop_probability": 100 - } - ] - } - }, - - "sonic-port:sonic-port": { - "sonic-port:PORT": { - "PORT_LIST": [ - { - "admin_status": "up", - "alias": "eth8", - "description": "Ethernet0", - "lanes": "65", - "mtu": 9000, - "name": "Ethernet0", - "speed": 25000 - } - ] - } - }, - - "sonic-queue:sonic-queue": { - "sonic-queue:QUEUE": { - "QUEUE_LIST": [ - { - "ifname": "Ethernet0", - "qindex": "0", - "scheduler": "Test@0", - "wred_profile": "Wred1" - } - ] - } - } - }, - - "QUEUE_PORT_NOT_EXIST": { - "sonic-scheduler:sonic-scheduler":{ - "sonic-scheduler:SCHEDULER": { - "SCHEDULER_LIST": [ - { - "name":"Test@0", - "cbs": 256, - "cir": 1250000, - "meter_type": "bytes", - "pbs": 1024, - "pir": 25000000, - "type": "DWRR", - "weight": 10 - } - ] - } - }, - "sonic-wred-profile:sonic-wred-profile":{ - "sonic-wred-profile:WRED_PROFILE": { - "WRED_PROFILE_LIST": [ - { - "name":"Wred1", - "yellow_min_threshold": 2048, - "green_min_threshold": 4096, - "red_min_threshold": 1024, - "yellow_max_threshold": 4096, - "green_max_threshold": 8192, - "red_max_threshold": 2048, - "ecn": "ecn_none", - "wred_green_enable": true, - "wred_yellow_enable": true, - "wred_red_enable": true, - "yellow_drop_probability": 50, - "green_drop_probability": 25, - "red_drop_probability": 100 - } - ] - } - }, - - "sonic-queue:sonic-queue": { - "sonic-queue:QUEUE": { - "QUEUE_LIST": [ - { - "ifname": "Ethernet0", - "qindex": "0", - "scheduler": "Test@0", - "wred_profile": "Wred1" - } - ] - } - } - }, - - "QUEUE_SCHEDULER_NOT_EXIST": { - "sonic-wred-profile:sonic-wred-profile":{ - "sonic-wred-profile:WRED_PROFILE": { - "WRED_PROFILE_LIST": [ - { - "name":"Wred1", - "yellow_min_threshold": 2048, - "green_min_threshold": 4096, - "red_min_threshold": 1024, - "yellow_max_threshold": 4096, - "green_max_threshold": 8192, - "red_max_threshold": 2048, - "ecn": "ecn_none", - "wred_green_enable": true, - "wred_yellow_enable": true, - "wred_red_enable": true, - "yellow_drop_probability": 50, - "green_drop_probability": 25, - "red_drop_probability": 100 - } - ] - } - }, - - "sonic-port:sonic-port": { - "sonic-port:PORT": { - "PORT_LIST": [ - { - "admin_status": "up", - "alias": "eth8", - "description": "Ethernet4", - "lanes": "65", - "mtu": 9000, - "name": "Ethernet4", - "speed": 25000 - } - ] - } - }, - - "sonic-queue:sonic-queue": { - "sonic-queue:QUEUE": { - "QUEUE_LIST": [ - { - "ifname": "Ethernet4", - "qindex": "0", - "scheduler": "Test@0", - "wred_profile": "Wred1" - } - ] - } - } - }, - - "QUEUE_WRED_NOT_EXIST": { - "sonic-scheduler:sonic-scheduler":{ - "sonic-scheduler:SCHEDULER": { - "SCHEDULER_LIST": [ - { - "name":"Test@0", - "cbs": 256, - "cir": 1250000, - "meter_type": "bytes", - "pbs": 1024, - "pir": 25000000, - "type": "DWRR", - "weight": 10 - } - ] - } - }, - - "sonic-port:sonic-port": { - "sonic-port:PORT": { - "PORT_LIST": [ - { - "admin_status": "up", - "alias": "eth8", - "description": "Ethernet8", - "lanes": "65", - "mtu": 9000, - "name": "Ethernet8", - "speed": 25000 - } - ] - } - }, - - "sonic-queue:sonic-queue": { - "sonic-queue:QUEUE": { - "QUEUE_LIST": [ - { - "ifname": "Ethernet8", - "qindex": "0", - "scheduler": "Test@0", - "wred_profile": "Wred1" - } - ] - } - } - } -} diff --git a/src/sonic-yang-models/yang-models/sonic-queue.yang b/src/sonic-yang-models/yang-models/sonic-queue.yang deleted file mode 100644 index 8e24faa72cb0..000000000000 --- a/src/sonic-yang-models/yang-models/sonic-queue.yang +++ /dev/null @@ -1,88 +0,0 @@ -module sonic-queue { - - yang-version 1.1; - - namespace "http://github.com/Azure/sonic-queue"; - - prefix squeue; - - import sonic-extension { - prefix sonic-ext; - } - - import sonic-port { - prefix port; - } - - import sonic-scheduler { - prefix sch; - } - - import sonic-wred-profile { - prefix wrd; - } - - organization - "SONiC"; - - contact - "SONiC"; - - description - "QUEUE yang Module for SONiC OS"; - - revision 2021-04-01 { - description - "Initial revision"; - } - - container sonic-queue { - - container QUEUE { - - description "QUEUE part of config_db.json"; - - list QUEUE_LIST { - - key "ifname qindex"; - - // sonic-ext:key-pattern "QUEUE|{ifname}|{qindex}"; //special pattern used for extracting keys from redis-key and populate the yang instance - // Total list instances = number(key1) * number(key2) * number(key3) - - leaf ifname { - type union { - type leafref { - path "/port:sonic-port/port:PORT/port:PORT_LIST/port:name"; - } - type string { - pattern "CPU"; - } - } - description "Interface name."; - } - // qindex format is (X) | (X-Y). X is start and Y is end index. - // X and Y value depends on platform, example for physical ports 0-7 and - // for CPU port 0-48. Example qindex is 3-4 - leaf qindex { - // sonic-ext:custom-validation ValidateQindexPattern; - type string; - description "Queue index on the interface."; - } - - leaf scheduler { - type leafref { - path "/sch:sonic-scheduler/sch:SCHEDULER/sch:SCHEDULER_LIST/sch:name"; //Reference to SCHEDULER table - } - description "Scheduler for queue."; - } - - leaf wred_profile { - type leafref { - path "/wrd:sonic-wred-profile/wrd:WRED_PROFILE/wrd:WRED_PROFILE_LIST/wrd:name"; // Reference to WRED_PROFILE table - } - description "Wred profile for queue."; - } - } - } - } -} diff --git a/src/sonic-yang-models/yang-models/sonic-scheduler.yang b/src/sonic-yang-models/yang-models/sonic-scheduler.yang deleted file mode 100644 index e6d1b7468f90..000000000000 --- a/src/sonic-yang-models/yang-models/sonic-scheduler.yang +++ /dev/null @@ -1,148 +0,0 @@ -module sonic-scheduler { - - yang-version 1.1; - - namespace "http://github.com/Azure/sonic-scheduler"; - - prefix sch; - - organization - "SONiC"; - - contact - "SONiC"; - - description - "SCHEDULER yang Module for SONiC OS"; - - revision 2021-04-01 { - description - "Initial revision"; - } - - container sonic-scheduler { - - container SCHEDULER { - - description "SCHEDULER part of config_db.json"; - - list SCHEDULER_LIST { - - key "name"; - - leaf name { - - type string { - pattern "[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})|[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})([@]{1})([0-9]{1,3})"; - length 1..36 { - error-message "Invalid length for scheduler name."; - error-app-tag scheduler-name-invalid-length; - } - } - description "Scheduler name"; - } - - leaf type { - type enumeration { - enum DWRR { - description "Deficit Weighted Round-Robin Scheduling"; - } - enum WRR { - description "Weighted Round-Robin Scheduling"; - } - enum STRICT { - description "Strict Scheduling"; - } - } - default WRR; - description "Scheduling algorithm type"; - } - - leaf weight { - type uint8 { - range "1..100"; - } - default 1; - description "Scheduling algorithm weight"; - } - - leaf priority { - type uint8 { - range "0..9"; - } - description "Scheduler priority"; - } - - leaf meter_type { - type enumeration { - enum packets { - description "Metering is based on packets"; - } - enum bytes { - description "Metering is based on bytes"; - } - } - default bytes; - description "meter type"; - } - - leaf cir { - type uint64; - description - "Committed information rate for the dual-rate token - bucket policer.This value represents the rate at which - tokens are added to the primary bucket.nt Units is - Bps(Bytes per second) for meter type is bytes else - Pps(packets per second) for meter type is packets"; - } - - leaf pir { - must "((current()/../cir) and (current()/../cir > 0))" { - error-message "pir can't be configured without cir."; - } - must "(current() >= current()/../cir)" { - error-message "pir must be greater than or equal to cir"; - } - type uint64; - description - "Peak information rate for the dual-rate token bucket - policer.This value represents the rate at which tokens - are added to the secondary bucket.Unit is Bps(Bytes - per second) for meter type bytes else Pps(packets per - second) for meter type is packets"; - } - - leaf cbs { - - must "((current()/../cir) and (current()/../cir > 0))" { - error-message "cbs can't be configured without cir."; - } - - type uint32; - description - "Committed burst size for the dual-rate token bucket - policer.This value represents the depth of the token - bucket.Unit is bytes for meter type bytes else packets - for meter type is packets"; - } - - leaf pbs { - must "((current()/../pir) and (current()/../pir > 0))" { - error-message "pbs can't be configured without pir."; - } - - must "((not(current()/../cbs)) or (current() >= current()/../cbs))" { - error-message "pbs must be greater than or equal to cbs"; - } - - type uint32; - description - "Excess burst size for the dual-rate token bucket policer. - This value represents the depth of the secondary bucket. - Unit is bytes for meter type bytes else packets for meter type - is packets"; - } - } - } - } -} diff --git a/src/sonic-yang-models/yang-models/sonic-wred-profile.yang b/src/sonic-yang-models/yang-models/sonic-wred-profile.yang deleted file mode 100644 index 2ca7be26ca0f..000000000000 --- a/src/sonic-yang-models/yang-models/sonic-wred-profile.yang +++ /dev/null @@ -1,177 +0,0 @@ -module sonic-wred-profile { - - yang-version 1.1; - - namespace "http://github.com/Azure/sonic-wred-profile"; - - prefix wrd; - - organization - "SONiC"; - - contact - "SONiC"; - - description - "WRED_PROFILE yang Module for SONiC OS"; - - revision 2021-04-01 { - description - "Initial revision."; - } - - container sonic-wred-profile { - - container WRED_PROFILE { - - description "WRED_PROFILE part of config_db.json"; - - list WRED_PROFILE_LIST { - - key "name"; - - leaf name { - type string { - pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})'; - length 1..32 { - error-message "Invalid length for wred profile name."; - error-app-tag wred-profile-name-invalid-length; - } - } - description "WRED profile name"; - } - - leaf yellow_min_threshold { - type uint64; - units bytes; - description "Yellow minimum threshold bytes"; - } - - leaf green_min_threshold { - type uint64; - units bytes; - description "Green minimum threshold bytes"; - } - - leaf red_min_threshold { - type uint64; - units bytes; - description "Red minimum threshold bytes"; - } - - leaf yellow_max_threshold { - type uint64; - units bytes; - must "(current() >= current()/../yellow_min_threshold)" { - error-message "Yellow max threshold must be greater than or equal to min threshold"; - } - description "Yellow maximum threshold bytes"; - } - - leaf green_max_threshold { - type uint64; - units bytes; - must "(current() >= current()/../green_min_threshold)" { - error-message "Green max threshold must be greater than or equal to min threshold"; - } - description "Green maximum threshold bytes"; - } - - leaf red_max_threshold { - type uint64; - units bytes; - must "(current() >= current()/../red_min_threshold)" { - error-message "Red max threshold must be greater than or equal to min threshold"; - } - description "Red maximum threshold bytes"; - } - - leaf ecn { - - type enumeration { - - enum ecn_none { - description "Disable ECN marking for all colors."; - } - - enum ecn_green { - description "Enable ECN marking for green color. Yellow and red are disabled."; - } - - enum ecn_yellow { - description "Enable ECN marking for yellow color. Green and red are disabled."; - } - - enum ecn_red { - description "Enable ECN marking for red color. Green and red are disabled."; - } - - enum ecn_green_yellow { - description "Enable ECN marking for green and yellow colors. Red is disabled."; - } - - enum ecn_green_red { - description "Enable ECN marking for green and red colors. Yellow is disabled."; - } - - enum ecn_yellow_red { - description "Enable ECN marking for yellow and red colors. Green is disabled."; - } - - enum ecn_all { - description "Enable ECN marking for all colors."; - - } - } - default ecn_none; - description "ECN mode"; - } - - leaf wred_green_enable { - type boolean; - default false; - description "Green enable"; - } - - leaf wred_yellow_enable { - type boolean; - default false; - description "Yellow enable"; - } - - leaf wred_red_enable { - type boolean; - default false; - description "Red enable"; - } - - leaf yellow_drop_probability { - type uint64 { - range "0..100"; - } - units percent; - default 100; - description "Yellow drop probability"; - } - - leaf green_drop_probability { - type uint64 { - range "0..100"; - } - units percent; - default 100; - description "Green drop probability"; - } - - leaf red_drop_probability { - type uint64 { - range "0..100"; - } - units percent; - default 100; - description "Red drop probability"; - } - } - } - } -} From ae5f94126e0ed7ffc3f317c3fe8436275be0b0bb Mon Sep 17 00:00:00 2001 From: Sudharsan Dhamal Gopalarathnam Date: Wed, 20 Oct 2021 19:07:17 +0000 Subject: [PATCH 4/6] Revert "Revert "[Yang model] SONiC QOS Scheduler, WRED, Queue Yangs (#7281)"" This reverts commit f0b2122a00983c59d74f60ca88a839ed8081c11b. --- src/sonic-yang-models/setup.py | 3 + .../tests/files/sample_config_db.json | 51 +- .../tests/yang_model_tests/tests/qos.json | 85 ++++ .../yang_model_tests/tests_config/qos.json | 477 ++++++++++++++++++ .../yang-models/sonic-queue.yang | 88 ++++ .../yang-models/sonic-scheduler.yang | 148 ++++++ .../yang-models/sonic-wred-profile.yang | 177 +++++++ 7 files changed, 1028 insertions(+), 1 deletion(-) create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/qos.json create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests_config/qos.json create mode 100644 src/sonic-yang-models/yang-models/sonic-queue.yang create mode 100644 src/sonic-yang-models/yang-models/sonic-scheduler.yang create mode 100644 src/sonic-yang-models/yang-models/sonic-wred-profile.yang diff --git a/src/sonic-yang-models/setup.py b/src/sonic-yang-models/setup.py index 51c190e495d4..0ffc2dfd3ab8 100644 --- a/src/sonic-yang-models/setup.py +++ b/src/sonic-yang-models/setup.py @@ -76,6 +76,9 @@ './yang-models/sonic-vrf.yang', './yang-models/sonic-warm-restart.yang', './yang-models/sonic-lldp.yang', + './yang-models/sonic-scheduler.yang', + './yang-models/sonic-wred-profile.yang', + './yang-models/sonic-queue.yang', './yang-models/sonic_yang_tree']), ], zip_safe=False, diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index bd7aff24b554..a53c58eae7e9 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -1138,6 +1138,56 @@ "high_mem_alert": "disabled", "state": "enabled" } + }, + + "SCHEDULER": { + "TEST@0": { + "cbs": "256", + "cir": "1250000", + "meter_type": "bytes", + "pbs": "1024", + "pir": "25000000", + "type": "DWRR", + "weight": "20" + }, + + "TEST@1": { + "cbs": "1024", + "cir": "1280000", + "meter_type": "bytes", + "pbs": "2048", + "pir": "2560000", + "type": "STRICT" + } + }, + + "WRED_PROFILE": { + "Wred1": { + "ecn": "ecn_all", + "green_drop_probability": "50", + "green_max_threshold": "2048000", + "green_min_threshold": "1024000", + "wred_green_enable": "true", + "yellow_drop_probability": "50", + "yellow_max_threshold": "2048000", + "yellow_min_threshold": "1024000", + "wred_yellow_enable": "true", + "red_drop_probability": "50", + "red_max_threshold": "2048000", + "red_min_threshold": "1024000", + "wred_red_enable": "true" + } + }, + + "QUEUE": { + "Ethernet0|0": { + "scheduler": "TEST@0", + "wred_profile": "Wred1" + }, + "Ethernet0|1": { + "scheduler": "TEST@1", + "wred_profile": "Wred1" + } } }, @@ -1146,5 +1196,4 @@ "Error": "This Table is for testing, This Table does not have YANG models." } } - } diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/qos.json b/src/sonic-yang-models/tests/yang_model_tests/tests/qos.json new file mode 100644 index 000000000000..96b7b4b8d94c --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/qos.json @@ -0,0 +1,85 @@ +{ + "SCHEDULER_VALID": { + "desc": "Configure SCHEDULER table." + }, + + "SCHEDULER_UNDEFINED_TYPE": { + "desc": "Configure undefined type in SCHEDULER table.", + "eStrKey" : "InvalidValue", + "eStr": ["type"] + }, + + "SCHEDULER_INVALID_WEIGHT": { + "desc": "Configure outof range weight in SCHEDULER table.", + "eStrKey" : "Pattern" + }, + + "SCHEDULER_INVALID_METER_TYPE": { + "desc": "Configure unsuported meter type in SCHEDULER table.", + "eStrKey": "InvalidValue", + "eStr": ["meter_type"] + }, + + "SCHEDULER_CBS_NO_CIR": { + "desc": "Configure CBS without CIR.", + "eStr": ["cbs can't be configured without cir"] + }, + + "SCHEDULER_PIR_NO_CIR": { + "desc": "Configure PIR without CIR.", + "eStr": ["pir can't be configured without cir"] + }, + + "SCHEDULER_PIR_VS_CIR": { + "desc": "Configure PIR vs CIR.", + "eStr": ["pir must be greater than or equal to cir"] + }, + + "WRED_PROFILE_EMPTY": { + "desc": "Configure Empty WRED profile." + }, + + "WRED_PROFILE_VALID": { + "desc": "Configure WRED profile." + }, + + "WRED_PROFILE_INVALID_DROP_PROBABILITY": { + "desc": "Configure invalid drop probability in WRED profile.", + "eStrKey" : "Pattern" + }, + + "WRED_PROFILE_INVALID_GREEN_THRESHOLD": { + "desc": "Configure green maximum threshold less than min threshold in WRED profile.", + "eStr": ["Green max threshold must be greater than or equal to min threshold"] + }, + + "WRED_PROFILE_INVALID_YELLOW_THRESHOLD": { + "desc": "Configure yellow maximum threshold less than min threshold in WRED profile.", + "eStr": ["Yellow max threshold must be greater than or equal to min threshold"] + }, + + "WRED_PROFILE_INVALID_RED_THRESHOLD": { + "desc": "Configure red maximum threshold less than min threshold in WRED profile.", + "eStr": ["Red max threshold must be greater than or equal to min threshold"] + }, + + + "QUEUE_VALID": { + "desc": "Attach scheduler and wred profiles to QUEUE." + }, + + "QUEUE_PORT_NOT_EXIST": { + "desc": "Referring non-existing PORT table.", + "eStrKey": "InvalidValue" + }, + + "QUEUE_SCHEDULER_NOT_EXIST": { + "desc": "Referring non-existing SCHEDULER table.", + "eStrKey" : "LeafRef" + }, + + "QUEUE_WRED_NOT_EXIST": { + "desc": "Referring non-existing WRED table.", + "eStrKey" : "LeafRef" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/qos.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/qos.json new file mode 100644 index 000000000000..481990b4d657 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/qos.json @@ -0,0 +1,477 @@ +{ + "SCHEDULER_VALID": { + "sonic-scheduler:sonic-scheduler":{ + "sonic-scheduler:SCHEDULER": { + "SCHEDULER_LIST": [ + { + "name":"Test@0", + "cbs": 256, + "cir": 1250000, + "meter_type": "bytes", + "pbs": 1024, + "pir": 25000000, + "type": "DWRR", + "weight": 10 + }, + { + "name":"Test@1", + "cbs": 1024, + "cir": 1280000, + "meter_type": "bytes", + "pbs": 2048, + "pir": 2560000, + "type": "STRICT", + "priority": 0 + }, + { + "name":"Test@2", + "cbs": 256, + "cir": 1250000, + "meter_type": "bytes", + "pbs": 1024, + "pir": 25000000, + "type": "WRR", + "weight": 20 + } + ] + } + } + }, + + "SCHEDULER_UNDEFINED_TYPE": { + "sonic-scheduler:sonic-scheduler":{ + "sonic-scheduler:SCHEDULER": { + "SCHEDULER_LIST": [ + { + "name":"Test@0", + "type": "invalid" + } + ] + } + } + }, + + "SCHEDULER_INVALID_WEIGHT": { + "sonic-scheduler:sonic-scheduler":{ + "sonic-scheduler:SCHEDULER": { + "SCHEDULER_LIST": [ + { + "name":"Test@0", + "weight": 120 + } + ] + } + } + }, + + "SCHEDULER_INVALID_METER_TYPE": { + "sonic-scheduler:sonic-scheduler":{ + "sonic-scheduler:SCHEDULER": { + "SCHEDULER_LIST": [ + { + "name":"Test@0", + "meter_type": "invalid" + } + ] + } + } + }, + + "SCHEDULER_CBS_NO_CIR": { + "sonic-scheduler:sonic-scheduler":{ + "sonic-scheduler:SCHEDULER": { + "SCHEDULER_LIST": [ + { + "name":"Test@0", + "cbs": 1024 + } + ] + } + } + }, + + "SCHEDULER_PIR_NO_CIR": { + "sonic-scheduler:sonic-scheduler":{ + "sonic-scheduler:SCHEDULER": { + "SCHEDULER_LIST": [ + { + "name":"Test@0", + "pir": 1024 + } + ] + } + } + }, + + "SCHEDULER_PIR_VS_CIR": { + "sonic-scheduler:sonic-scheduler":{ + "sonic-scheduler:SCHEDULER": { + "SCHEDULER_LIST": [ + { + "name":"Test@0", + "cir": 2048, + "pir": 1024 + } + ] + } + } + }, + + + "WRED_PROFILE_EMPTY": { + "sonic-wred-profile:sonic-wred-profile":{ + "sonic-wred-profile:WRED_PROFILE": { + "WRED_PROFILE_LIST": [ + { + "name":"Wred1" + } + ] + } + } + }, + + "WRED_PROFILE_VALID": { + "sonic-wred-profile:sonic-wred-profile":{ + "sonic-wred-profile:WRED_PROFILE": { + "WRED_PROFILE_LIST": [ + { + "name":"Wred2", + "yellow_min_threshold": 2048, + "green_min_threshold": 4096, + "red_min_threshold": 1024, + "yellow_max_threshold": 4096, + "green_max_threshold": 8192, + "red_max_threshold": 2048, + "ecn": "ecn_none", + "wred_green_enable": true, + "wred_yellow_enable": true, + "wred_red_enable": true, + "yellow_drop_probability": 50, + "green_drop_probability": 25, + "red_drop_probability": 100 + }, + { + "name":"Wred3", + "yellow_min_threshold": 2048, + "green_min_threshold": 4096, + "red_min_threshold": 1024, + "yellow_max_threshold": 4096, + "green_max_threshold": 8192, + "red_max_threshold": 2048, + "ecn": "ecn_all", + "wred_green_enable": true, + "wred_yellow_enable": true, + "wred_red_enable": true, + "yellow_drop_probability": 50, + "green_drop_probability": 25, + "red_drop_probability": 100 + }, + { + "name":"Wred4", + "green_min_threshold": 4096, + "green_max_threshold": 8192, + "ecn": "ecn_all", + "wred_green_enable": true + } + ] + } + } + }, + + "WRED_PROFILE_INVALID_DROP_PROBABILITY": { + "sonic-wred-profile:sonic-wred-profile": { + "sonic-wred-profile:WRED_PROFILE": { + "WRED_PROFILE_LIST": [ + { + "name":"Wred4", + "red_min_threshold": 1024, + "red_max_threshold": 2048, + "wred_red_enable": true, + "red_drop_probability": 125, + "green_drop_probability": 25, + "yellow_drop_probability": 25, + "ecn": "ecn_all" + } + ] + } + } + }, + + "WRED_PROFILE_INVALID_GREEN_THRESHOLD": { + "sonic-wred-profile:sonic-wred-profile": { + "sonic-wred-profile:WRED_PROFILE": { + "WRED_PROFILE_LIST": [ + { + "name":"Wred4", + "green_min_threshold": 4096, + "green_max_threshold": 2048, + "wred_green_enable": true, + "green_drop_probability": 25, + "ecn": "ecn_all" + } + ] + } + } + }, + + "WRED_PROFILE_INVALID_YELLOW_THRESHOLD": { + "sonic-wred-profile:sonic-wred-profile": { + "sonic-wred-profile:WRED_PROFILE": { + "WRED_PROFILE_LIST": [ + { + "name":"Wred4", + "yellow_min_threshold": 4096, + "yellow_max_threshold": 2048, + "wred_yellow_enable": true, + "yellow_drop_probability": 25, + "ecn": "ecn_all" + } + ] + } + } + }, + + "WRED_PROFILE_INVALID_RED_THRESHOLD": { + "sonic-wred-profile:sonic-wred-profile": { + "sonic-wred-profile:WRED_PROFILE": { + "WRED_PROFILE_LIST": [ + { + "name":"Wred4", + "red_min_threshold": 4096, + "red_max_threshold": 2048, + "wred_red_enable": true, + "red_drop_probability": 25, + "ecn": "ecn_all" + } + ] + } + } + }, + + + "QUEUE_VALID": { + "sonic-scheduler:sonic-scheduler":{ + "sonic-scheduler:SCHEDULER": { + "SCHEDULER_LIST": [ + { + "name":"Test@0", + "cbs": 256, + "cir": 1250000, + "meter_type": "bytes", + "pbs": 1024, + "pir": 25000000, + "type": "DWRR", + "weight": 10 + } + ] + } + }, + "sonic-wred-profile:sonic-wred-profile":{ + "sonic-wred-profile:WRED_PROFILE": { + "WRED_PROFILE_LIST": [ + { + "name":"Wred1", + "yellow_min_threshold": 2048, + "green_min_threshold": 4096, + "red_min_threshold": 1024, + "yellow_max_threshold": 4096, + "green_max_threshold": 8192, + "red_max_threshold": 2048, + "ecn": "ecn_none", + "wred_green_enable": true, + "wred_yellow_enable": true, + "wred_red_enable": true, + "yellow_drop_probability": 50, + "green_drop_probability": 25, + "red_drop_probability": 100 + } + ] + } + }, + + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth8", + "description": "Ethernet0", + "lanes": "65", + "mtu": 9000, + "name": "Ethernet0", + "speed": 25000 + } + ] + } + }, + + "sonic-queue:sonic-queue": { + "sonic-queue:QUEUE": { + "QUEUE_LIST": [ + { + "ifname": "Ethernet0", + "qindex": "0", + "scheduler": "Test@0", + "wred_profile": "Wred1" + } + ] + } + } + }, + + "QUEUE_PORT_NOT_EXIST": { + "sonic-scheduler:sonic-scheduler":{ + "sonic-scheduler:SCHEDULER": { + "SCHEDULER_LIST": [ + { + "name":"Test@0", + "cbs": 256, + "cir": 1250000, + "meter_type": "bytes", + "pbs": 1024, + "pir": 25000000, + "type": "DWRR", + "weight": 10 + } + ] + } + }, + "sonic-wred-profile:sonic-wred-profile":{ + "sonic-wred-profile:WRED_PROFILE": { + "WRED_PROFILE_LIST": [ + { + "name":"Wred1", + "yellow_min_threshold": 2048, + "green_min_threshold": 4096, + "red_min_threshold": 1024, + "yellow_max_threshold": 4096, + "green_max_threshold": 8192, + "red_max_threshold": 2048, + "ecn": "ecn_none", + "wred_green_enable": true, + "wred_yellow_enable": true, + "wred_red_enable": true, + "yellow_drop_probability": 50, + "green_drop_probability": 25, + "red_drop_probability": 100 + } + ] + } + }, + + "sonic-queue:sonic-queue": { + "sonic-queue:QUEUE": { + "QUEUE_LIST": [ + { + "ifname": "Ethernet0", + "qindex": "0", + "scheduler": "Test@0", + "wred_profile": "Wred1" + } + ] + } + } + }, + + "QUEUE_SCHEDULER_NOT_EXIST": { + "sonic-wred-profile:sonic-wred-profile":{ + "sonic-wred-profile:WRED_PROFILE": { + "WRED_PROFILE_LIST": [ + { + "name":"Wred1", + "yellow_min_threshold": 2048, + "green_min_threshold": 4096, + "red_min_threshold": 1024, + "yellow_max_threshold": 4096, + "green_max_threshold": 8192, + "red_max_threshold": 2048, + "ecn": "ecn_none", + "wred_green_enable": true, + "wred_yellow_enable": true, + "wred_red_enable": true, + "yellow_drop_probability": 50, + "green_drop_probability": 25, + "red_drop_probability": 100 + } + ] + } + }, + + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth8", + "description": "Ethernet4", + "lanes": "65", + "mtu": 9000, + "name": "Ethernet4", + "speed": 25000 + } + ] + } + }, + + "sonic-queue:sonic-queue": { + "sonic-queue:QUEUE": { + "QUEUE_LIST": [ + { + "ifname": "Ethernet4", + "qindex": "0", + "scheduler": "Test@0", + "wred_profile": "Wred1" + } + ] + } + } + }, + + "QUEUE_WRED_NOT_EXIST": { + "sonic-scheduler:sonic-scheduler":{ + "sonic-scheduler:SCHEDULER": { + "SCHEDULER_LIST": [ + { + "name":"Test@0", + "cbs": 256, + "cir": 1250000, + "meter_type": "bytes", + "pbs": 1024, + "pir": 25000000, + "type": "DWRR", + "weight": 10 + } + ] + } + }, + + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth8", + "description": "Ethernet8", + "lanes": "65", + "mtu": 9000, + "name": "Ethernet8", + "speed": 25000 + } + ] + } + }, + + "sonic-queue:sonic-queue": { + "sonic-queue:QUEUE": { + "QUEUE_LIST": [ + { + "ifname": "Ethernet8", + "qindex": "0", + "scheduler": "Test@0", + "wred_profile": "Wred1" + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-queue.yang b/src/sonic-yang-models/yang-models/sonic-queue.yang new file mode 100644 index 000000000000..8e24faa72cb0 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-queue.yang @@ -0,0 +1,88 @@ +module sonic-queue { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-queue"; + + prefix squeue; + + import sonic-extension { + prefix sonic-ext; + } + + import sonic-port { + prefix port; + } + + import sonic-scheduler { + prefix sch; + } + + import sonic-wred-profile { + prefix wrd; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "QUEUE yang Module for SONiC OS"; + + revision 2021-04-01 { + description + "Initial revision"; + } + + container sonic-queue { + + container QUEUE { + + description "QUEUE part of config_db.json"; + + list QUEUE_LIST { + + key "ifname qindex"; + + // sonic-ext:key-pattern "QUEUE|{ifname}|{qindex}"; //special pattern used for extracting keys from redis-key and populate the yang instance + // Total list instances = number(key1) * number(key2) * number(key3) + + leaf ifname { + type union { + type leafref { + path "/port:sonic-port/port:PORT/port:PORT_LIST/port:name"; + } + type string { + pattern "CPU"; + } + } + description "Interface name."; + } + // qindex format is (X) | (X-Y). X is start and Y is end index. + // X and Y value depends on platform, example for physical ports 0-7 and + // for CPU port 0-48. Example qindex is 3-4 + leaf qindex { + // sonic-ext:custom-validation ValidateQindexPattern; + type string; + description "Queue index on the interface."; + } + + leaf scheduler { + type leafref { + path "/sch:sonic-scheduler/sch:SCHEDULER/sch:SCHEDULER_LIST/sch:name"; //Reference to SCHEDULER table + } + description "Scheduler for queue."; + } + + leaf wred_profile { + type leafref { + path "/wrd:sonic-wred-profile/wrd:WRED_PROFILE/wrd:WRED_PROFILE_LIST/wrd:name"; // Reference to WRED_PROFILE table + } + description "Wred profile for queue."; + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-scheduler.yang b/src/sonic-yang-models/yang-models/sonic-scheduler.yang new file mode 100644 index 000000000000..e6d1b7468f90 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-scheduler.yang @@ -0,0 +1,148 @@ +module sonic-scheduler { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-scheduler"; + + prefix sch; + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SCHEDULER yang Module for SONiC OS"; + + revision 2021-04-01 { + description + "Initial revision"; + } + + container sonic-scheduler { + + container SCHEDULER { + + description "SCHEDULER part of config_db.json"; + + list SCHEDULER_LIST { + + key "name"; + + leaf name { + + type string { + pattern "[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})|[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})([@]{1})([0-9]{1,3})"; + length 1..36 { + error-message "Invalid length for scheduler name."; + error-app-tag scheduler-name-invalid-length; + } + } + description "Scheduler name"; + } + + leaf type { + type enumeration { + enum DWRR { + description "Deficit Weighted Round-Robin Scheduling"; + } + enum WRR { + description "Weighted Round-Robin Scheduling"; + } + enum STRICT { + description "Strict Scheduling"; + } + } + default WRR; + description "Scheduling algorithm type"; + } + + leaf weight { + type uint8 { + range "1..100"; + } + default 1; + description "Scheduling algorithm weight"; + } + + leaf priority { + type uint8 { + range "0..9"; + } + description "Scheduler priority"; + } + + leaf meter_type { + type enumeration { + enum packets { + description "Metering is based on packets"; + } + enum bytes { + description "Metering is based on bytes"; + } + } + default bytes; + description "meter type"; + } + + leaf cir { + type uint64; + description + "Committed information rate for the dual-rate token + bucket policer.This value represents the rate at which + tokens are added to the primary bucket.nt Units is + Bps(Bytes per second) for meter type is bytes else + Pps(packets per second) for meter type is packets"; + } + + leaf pir { + must "((current()/../cir) and (current()/../cir > 0))" { + error-message "pir can't be configured without cir."; + } + must "(current() >= current()/../cir)" { + error-message "pir must be greater than or equal to cir"; + } + type uint64; + description + "Peak information rate for the dual-rate token bucket + policer.This value represents the rate at which tokens + are added to the secondary bucket.Unit is Bps(Bytes + per second) for meter type bytes else Pps(packets per + second) for meter type is packets"; + } + + leaf cbs { + + must "((current()/../cir) and (current()/../cir > 0))" { + error-message "cbs can't be configured without cir."; + } + + type uint32; + description + "Committed burst size for the dual-rate token bucket + policer.This value represents the depth of the token + bucket.Unit is bytes for meter type bytes else packets + for meter type is packets"; + } + + leaf pbs { + must "((current()/../pir) and (current()/../pir > 0))" { + error-message "pbs can't be configured without pir."; + } + + must "((not(current()/../cbs)) or (current() >= current()/../cbs))" { + error-message "pbs must be greater than or equal to cbs"; + } + + type uint32; + description + "Excess burst size for the dual-rate token bucket policer. + This value represents the depth of the secondary bucket. + Unit is bytes for meter type bytes else packets for meter type + is packets"; + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-wred-profile.yang b/src/sonic-yang-models/yang-models/sonic-wred-profile.yang new file mode 100644 index 000000000000..2ca7be26ca0f --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-wred-profile.yang @@ -0,0 +1,177 @@ +module sonic-wred-profile { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-wred-profile"; + + prefix wrd; + + organization + "SONiC"; + + contact + "SONiC"; + + description + "WRED_PROFILE yang Module for SONiC OS"; + + revision 2021-04-01 { + description + "Initial revision."; + } + + container sonic-wred-profile { + + container WRED_PROFILE { + + description "WRED_PROFILE part of config_db.json"; + + list WRED_PROFILE_LIST { + + key "name"; + + leaf name { + type string { + pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})'; + length 1..32 { + error-message "Invalid length for wred profile name."; + error-app-tag wred-profile-name-invalid-length; + } + } + description "WRED profile name"; + } + + leaf yellow_min_threshold { + type uint64; + units bytes; + description "Yellow minimum threshold bytes"; + } + + leaf green_min_threshold { + type uint64; + units bytes; + description "Green minimum threshold bytes"; + } + + leaf red_min_threshold { + type uint64; + units bytes; + description "Red minimum threshold bytes"; + } + + leaf yellow_max_threshold { + type uint64; + units bytes; + must "(current() >= current()/../yellow_min_threshold)" { + error-message "Yellow max threshold must be greater than or equal to min threshold"; + } + description "Yellow maximum threshold bytes"; + } + + leaf green_max_threshold { + type uint64; + units bytes; + must "(current() >= current()/../green_min_threshold)" { + error-message "Green max threshold must be greater than or equal to min threshold"; + } + description "Green maximum threshold bytes"; + } + + leaf red_max_threshold { + type uint64; + units bytes; + must "(current() >= current()/../red_min_threshold)" { + error-message "Red max threshold must be greater than or equal to min threshold"; + } + description "Red maximum threshold bytes"; + } + + leaf ecn { + + type enumeration { + + enum ecn_none { + description "Disable ECN marking for all colors."; + } + + enum ecn_green { + description "Enable ECN marking for green color. Yellow and red are disabled."; + } + + enum ecn_yellow { + description "Enable ECN marking for yellow color. Green and red are disabled."; + } + + enum ecn_red { + description "Enable ECN marking for red color. Green and red are disabled."; + } + + enum ecn_green_yellow { + description "Enable ECN marking for green and yellow colors. Red is disabled."; + } + + enum ecn_green_red { + description "Enable ECN marking for green and red colors. Yellow is disabled."; + } + + enum ecn_yellow_red { + description "Enable ECN marking for yellow and red colors. Green is disabled."; + } + + enum ecn_all { + description "Enable ECN marking for all colors."; + + } + } + default ecn_none; + description "ECN mode"; + } + + leaf wred_green_enable { + type boolean; + default false; + description "Green enable"; + } + + leaf wred_yellow_enable { + type boolean; + default false; + description "Yellow enable"; + } + + leaf wred_red_enable { + type boolean; + default false; + description "Red enable"; + } + + leaf yellow_drop_probability { + type uint64 { + range "0..100"; + } + units percent; + default 100; + description "Yellow drop probability"; + } + + leaf green_drop_probability { + type uint64 { + range "0..100"; + } + units percent; + default 100; + description "Green drop probability"; + } + + leaf red_drop_probability { + type uint64 { + range "0..100"; + } + units percent; + default 100; + description "Red drop probability"; + } + } + } + } +} From fc6a9754c194d9811f27867392dbbc17376d662e Mon Sep 17 00:00:00 2001 From: Sudharsan Dhamal Gopalarathnam Date: Wed, 20 Oct 2021 19:07:19 +0000 Subject: [PATCH 5/6] Revert "Revert "SONiC QoS MAPs and PORT_QOS_MAP Yang (#7375)"" This reverts commit 9c172a534a5bbf4bf8dd310a4309f66f5b10b372. --- src/sonic-yang-mgmt/sonic_yang_ext.py | 204 ++++- src/sonic-yang-models/setup.py | 7 + .../tests/files/sample_config_db.json | 87 +++ .../tests/yang_model_tests/tests/qosmaps.json | 104 +++ .../tests_config/qosmaps.json | 724 ++++++++++++++++++ .../yang-models/sonic-dot1p-tc-map.yang | 68 ++ .../yang-models/sonic-dscp-tc-map.yang | 68 ++ ...sonic-pfc-priority-priority-group-map.yang | 68 ++ .../sonic-pfc-priority-queue-map.yang | 68 ++ .../yang-models/sonic-port-qos-map.yang | 110 +++ .../sonic-tc-priority-group-map.yang | 68 ++ .../yang-models/sonic-tc-queue-map.yang | 68 ++ 12 files changed, 1640 insertions(+), 4 deletions(-) create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/qosmaps.json create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests_config/qosmaps.json create mode 100644 src/sonic-yang-models/yang-models/sonic-dot1p-tc-map.yang create mode 100644 src/sonic-yang-models/yang-models/sonic-dscp-tc-map.yang create mode 100644 src/sonic-yang-models/yang-models/sonic-pfc-priority-priority-group-map.yang create mode 100644 src/sonic-yang-models/yang-models/sonic-pfc-priority-queue-map.yang create mode 100644 src/sonic-yang-models/yang-models/sonic-port-qos-map.yang create mode 100644 src/sonic-yang-models/yang-models/sonic-tc-priority-group-map.yang create mode 100644 src/sonic-yang-models/yang-models/sonic-tc-queue-map.yang diff --git a/src/sonic-yang-mgmt/sonic_yang_ext.py b/src/sonic-yang-mgmt/sonic_yang_ext.py index 5438c81fb745..845588d70dbd 100644 --- a/src/sonic-yang-mgmt/sonic_yang_ext.py +++ b/src/sonic-yang-mgmt/sonic_yang_ext.py @@ -4,11 +4,17 @@ from __future__ import print_function import yang as ly import syslog - from json import dump, dumps, loads from xmltodict import parse from glob import glob +qos_maps_model = ['DSCP_TO_TC_MAP_LIST', + 'DOT1P_TO_TC_MAP_LIST', + 'TC_TO_PRIORITY_GROUP_MAP_LIST', + 'TC_TO_QUEUE_MAP_LIST', + 'MAP_PFC_PRIORITY_TO_QUEUE_LIST', + 'PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_LIST'] + """ This is the Exception thrown out of all public function of this class. """ @@ -406,6 +412,108 @@ def _yangConvert(val): return vValue + """ + Xlate a Qos Maps list + This function will xlate from a dict in config DB to a Yang JSON list + using yang model. Output will be go in self.xlateJson + + Note: Exceptions from this function are collected in exceptionList and + are displayed only when an entry is not xlated properly from ConfigDB + to sonic_yang.json. + + QOS MAPS Yang has inner list, which is diffrent from config DB. + Each field value in config db should be converted to inner list with + key and value. + Example: + + Config DB: + "DSCP_TO_TC_MAP": { + "Dscp_to_tc_map1": { + "1": "1", + "2": "2" + } + } + + YANG Model: + module: sonic-dscp-tc-map + +--rw sonic-dscp-tc-map + +--rw DSCP_TO_TC_MAP + +--rw DSCP_TO_TC_MAP_LIST* [name] + +--rw name string + +--rw DSCP_TO_TC_MAP* [dscp] + +--rw dscp string + +--rw tc? string + + YANG JSON: + "sonic-dscp-tc-map:sonic-dscp-tc-map": { + "sonic-dscp-tc-map:DSCP_TO_TC_MAP": { + "DSCP_TO_TC_MAP_LIST": [ + { + "name": "map3", + "DSCP_TO_TC_MAP": [ + { + "dscp": "64", + "tc": "1" + }, + { + "dscp":"2", + "tc":"2" + } + ] + } + ] + } + } + """ + def _xlateQosMapList(self, model, yang, config, table, exceptionList): + + #create a dict to map each key under primary key with a dict yang model. + #This is done to improve performance of mapping from values of TABLEs in + #config DB to leaf in YANG LIST. + inner_clist = model.get('list') + if inner_clist: + inner_listKey = inner_clist['key']['@value'] + inner_leafDict = self._createLeafDict(inner_clist, table) + for lkey in inner_leafDict: + if inner_listKey != lkey: + inner_listVal = lkey + + # get keys from YANG model list itself + listKeys = model['key']['@value'] + self.sysLog(msg="xlateList keyList:{}".format(listKeys)) + primaryKeys = list(config.keys()) + for pkey in primaryKeys: + try: + vKey = None + self.sysLog(syslog.LOG_DEBUG, "xlateList Extract pkey:{}".\ + format(pkey)) + # Find and extracts key from each dict in config + keyDict = self._extractKey(pkey, listKeys) + + if inner_clist: + inner_yang_list = list() + for vKey in config[pkey]: + inner_keyDict = dict() + self.sysLog(syslog.LOG_DEBUG, "xlateList Key {} vkey {} Val {} vval {}".\ + format(inner_listKey, str(vKey), inner_listVal, str(config[pkey][vKey]))) + inner_keyDict[inner_listKey] = str(vKey) + inner_keyDict[inner_listVal] = str(config[pkey][vKey]) + inner_yang_list.append(inner_keyDict) + + keyDict[inner_clist['@name']] = inner_yang_list + yang.append(keyDict) + # delete pkey from config, done to match one key with one list + del config[pkey] + + except Exception as e: + # log debug, because this exception may occur with multilists + self.sysLog(msg="xlateList Exception:{}".format(str(e)), \ + debug=syslog.LOG_DEBUG, doPrint=True) + exceptionList.append(str(e)) + # with multilist, we continue matching other keys. + continue + return + """ Xlate a list This function will xlate from a dict in config DB to a Yang JSON list @@ -416,16 +524,22 @@ def _yangConvert(val): to sonic_yang.json. """ def _xlateList(self, model, yang, config, table, exceptionList): + + #Qos Map lists needs special handling because of inner yang list and + #config db format. + if model['@name'] in qos_maps_model: + self.sysLog(msg="_xlateQosMapList: {}".format(model['@name'])) + self._xlateQosMapList(model, yang,config, table, exceptionList) + return #create a dict to map each key under primary key with a dict yang model. #This is done to improve performance of mapping from values of TABLEs in #config DB to leaf in YANG LIST. - leafDict = self._createLeafDict(model, table) + leafDict = self._createLeafDict(model, table) # get keys from YANG model list itself listKeys = model['key']['@value'] self.sysLog(msg="xlateList keyList:{}".format(listKeys)) - primaryKeys = list(config.keys()) for pkey in primaryKeys: try: @@ -459,7 +573,6 @@ def _xlateList(self, model, yang, config, table, exceptionList): """ def _xlateListInContainer(self, model, yang, configC, table, exceptionList): clist = model - #print(clist['@name']) yang[clist['@name']] = list() self.sysLog(msg="xlateProcessListOfContainer: {}".format(clist['@name'])) self._xlateList(clist, yang[clist['@name']], configC, table, exceptionList) @@ -629,10 +742,93 @@ def _revYangConvert(val): return vValue + """ + Rev xlate from
_LIST to table in config DB + QOS MAP Yang has inner list, each inner list key:val should + be mapped to field:value in Config DB. + Example: + + YANG: + module: sonic-dscp-tc-map + +--rw sonic-dscp-tc-map + +--rw DSCP_TO_TC_MAP + +--rw DSCP_TO_TC_MAP_LIST* [name] + +--rw name string + +--rw DSCP_TO_TC_MAP* [dscp] + +--rw dscp string + +--rw tc? string + + YANG JSON: + "sonic-dscp-tc-map:sonic-dscp-tc-map": { + "sonic-dscp-tc-map:DSCP_TO_TC_MAP": { + "DSCP_TO_TC_MAP_LIST": [ + { + "name": "map3", + "DSCP_TO_TC_MAP": [ + { + "dscp": "64", + "tc": "1" + }, + { + "dscp":"2", + "tc":"2" + } + ] + } + ] + } + } + + Config DB: + "DSCP_TO_TC_MAP": { + "Dscp_to_tc_map1": { + "1": "1", + "2": "2" + } + } + """ + + def _revQosMapXlateList(self, model, yang, config, table): + # get keys from YANG model list itself + listKeys = model['key']['@value'] + # create a dict to map each key under primary key with a dict yang model. + # This is done to improve performance of mapping from values of TABLEs in + # config DB to leaf in YANG LIST. + + # Gather inner list key and value from model + inner_clist = model.get('list') + if inner_clist: + inner_listKey = inner_clist['key']['@value'] + inner_leafDict = self._createLeafDict(inner_clist, table) + for lkey in inner_leafDict: + if inner_listKey != lkey: + inner_listVal = lkey + + # list with name _LIST should be removed, + if "_LIST" in model['@name']: + for entry in yang: + # create key of config DB table + pkey, pkeydict = self._createKey(entry, listKeys) + self.sysLog(syslog.LOG_DEBUG, "revXlateList pkey:{}".format(pkey)) + config[pkey]= dict() + # fill rest of the entries + inner_list = entry[inner_clist['@name']] + for index in range(len(inner_list)): + self.sysLog(syslog.LOG_DEBUG, "revXlateList fkey:{} fval {}".\ + format(str(inner_list[index][inner_listKey]),\ + str(inner_list[index][inner_listVal]))) + config[pkey][str(inner_list[index][inner_listKey])] = str(inner_list[index][inner_listVal]) + return + """ Rev xlate from
_LIST to table in config DB """ def _revXlateList(self, model, yang, config, table): + + # special processing for QOS Map table. + if model['@name'] in qos_maps_model: + self._revQosMapXlateList(model, yang, config, table) + return # get keys from YANG model list itself listKeys = model['key']['@value'] diff --git a/src/sonic-yang-models/setup.py b/src/sonic-yang-models/setup.py index 0ffc2dfd3ab8..a5a74f1b4cba 100644 --- a/src/sonic-yang-models/setup.py +++ b/src/sonic-yang-models/setup.py @@ -79,6 +79,13 @@ './yang-models/sonic-scheduler.yang', './yang-models/sonic-wred-profile.yang', './yang-models/sonic-queue.yang', + './yang-models/sonic-dscp-tc-map.yang', + './yang-models/sonic-dot1p-tc-map.yang', + './yang-models/sonic-tc-priority-group-map.yang', + './yang-models/sonic-tc-queue-map.yang', + './yang-models/sonic-pfc-priority-queue-map.yang', + './yang-models/sonic-pfc-priority-priority-group-map.yang', + './yang-models/sonic-port-qos-map.yang', './yang-models/sonic_yang_tree']), ], zip_safe=False, diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index a53c58eae7e9..35cb22074106 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -1188,6 +1188,93 @@ "scheduler": "TEST@1", "wred_profile": "Wred1" } + }, + + "DSCP_TO_TC_MAP": { + "Dscp_to_tc_map1": { + "1": "1", + "2": "2" + }, + "Dscp_to_tc_map2": { + "3": "3", + "4": "4" + } + }, + + "DOT1P_TO_TC_MAP": { + "Dot1p_to_tc_map1": { + "1": "1", + "2": "2" + }, + "Dot1p_to_tc_map2": { + "3": "3", + "4": "4" + } + }, + + "TC_TO_PRIORITY_GROUP_MAP": { + "tc_to_pg_map1": { + "1": "1", + "2": "2" + }, + "tc_to_pg_map2": { + "3": "3", + "4": "4" + } + }, + + "TC_TO_QUEUE_MAP": { + "tc_to_q_map1": { + "1": "1", + "2": "2" + }, + "tc_to_q_map2": { + "3": "3", + "4": "4" + } + }, + + "MAP_PFC_PRIORITY_TO_QUEUE": { + "pfc_prio_to_q_map1": { + "1": "1", + "2": "2" + }, + "pfc_prio_to_q_map2": { + "3": "3", + "4": "4" + } + }, + + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { + "pfc_prio_to_pg_map1": { + "1": "1", + "2": "2" + }, + "pfc_prio_to_pg_map2": { + "3": "3", + "4": "4" + } + }, + + "PORT_QOS_MAP": { + "Ethernet0": { + "dot1p_to_tc_map" : "Dot1p_to_tc_map1", + "dscp_to_tc_map": "Dscp_to_tc_map1", + "tc_to_queue_map": "tc_to_q_map1", + "tc_to_pg_map": "tc_to_pg_map1", + "pfc_to_queue_map": "pfc_prio_to_q_map1", + "pfc_to_pg_map" : "pfc_prio_to_pg_map1", + "pfc_enable" : "3,4" + }, + "Ethernet4": { + "dot1p_to_tc_map" : "Dot1p_to_tc_map2", + "dscp_to_tc_map": "Dscp_to_tc_map2", + "tc_to_queue_map": "tc_to_q_map2", + "tc_to_pg_map": "tc_to_pg_map2", + "pfc_to_queue_map": "pfc_prio_to_q_map2", + "pfc_to_pg_map" : "pfc_prio_to_pg_map2", + "pfc_enable" : "3,4" + } } }, diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/qosmaps.json b/src/sonic-yang-models/tests/yang_model_tests/tests/qosmaps.json new file mode 100644 index 000000000000..90344d8f119d --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/qosmaps.json @@ -0,0 +1,104 @@ +{ + "DSCP_TO_TC_MAP_CRETAE": { + "desc": "Configure a DSCP to Traffic class map." + }, + + "DSCP_TO_TC_MAP_CREATE_INVALID_DSCP": { + "desc": "Configure a DSCP to Traffic class map with invalid key.", + "eStr": "Invalid DSCP" + }, + + "DSCP_TO_TC_MAP_CREATE_INVALID_TC": { + "desc": "Configure a DSCP to Traffic class map with invalid value.", + "eStr": "Invalid Traffic Class" + }, + + "DOT1P_TO_TC_MAP_CRETAE": { + "desc": "Configure a DOT1P to Traffic class map." + }, + + "DOT1P_TO_TC_MAP_CREATE_INVALID_DOT1P": { + "desc": "Configure a DOT1P to Traffic class map with invalid key.", + "eStr": "Invalid DOT1P" + }, + + "DOT1P_TO_TC_MAP_CREATE_INVALID_TC": { + "desc": "Configure a DOT1P to Traffic class map with invalid value.", + "eStr": "Invalid Traffic Class" + }, + + "TC_TO_QUEUE_MAP_CRETAE": { + "desc": "Configure a Traffic Class to Queue map." + }, + + "TC_TO_QUEUE_MAP_CREATE_INVALID_TC": { + "desc": "Configure a Traffic class to Queue map with invalid key.", + "eStr": "Invalid Traffic Class" + }, + + "TC_TO_QUEUE_MAP_CREATE_INVALID_QUEUE": { + "desc": "Configure a Traffic class to Queue map with invalid value.", + "eStr": "Invalid queue index" + }, + + "TC_TO_PRIORITY_GROUP_MAP_CRETAE": { + "desc": "Configure a Traffic Class to Priority Group map." + }, + + "TC_TO_PRIORITY_GROUP_MAP_CREATE_INVALID_TC": { + "desc": "Configure a Traffic class to Priority Group map with invalid key.", + "eStr": "Invalid Traffic Class" + }, + + "TC_TO_PRIORITY_GROUP_MAP_CREATE_INVALID_PRIORITY_GROUP": { + "desc": "Configure a Traffic class to Priority Group map with invalid value.", + "eStr": "Invalid Priority Group" + }, + + "PFC_PRIORITY_TO_QUEUE_MAP_CRETAE": { + "desc": "Configure a PFC priority to Queue map." + }, + + "PFC_PRIORITY_TO_QUEUE_MAP_CREATE_INVALID_PFC_PRIORITY": { + "desc": "Configure a PFC priority to Queue map with invalid key.", + "eStr": "Invalid pfc priority" + }, + + "PFC_PRIORITY_TO_QUEUE_MAP_CREATE_INVALID_QUEUE": { + "desc": "Configure a PFC priority to Queue map with invalid value.", + "eStr": "Invalid queue index" + }, + + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_CRETAE": { + "desc": "Configure a PFC priority to Priority Group map." + }, + + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_CREATE_INVALID_PFC_PRIORITY": { + "desc": "Configure a PFC priority to Priority Group map with invalid key.", + "eStr": "Invalid pfc priority" + }, + + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_CREATE_INVALID_PRIORITY_GROUP": { + "desc": "Configure a PFC priority to Priority Group map with invalid value.", + "eStr": "Invalid Priority Group" + }, + + "PORT_QOS_MAP_APPLY_MAPS": { + "desc": "Configure qos maps on port." + }, + + "PORT_QOS_MAP_APPLY_NON_EXISTS_MAPS": { + "desc": "Configure non exists qos maps on port.", + "eStrKey": "LeafRef" + }, + + "PORT_QOS_MAP_APPLY_NON_EXISTS_PORT": { + "desc": "Configure port qos map entry on non exists port.", + "eStrKey": "LeafRef" + }, + + "PORT_QOS_MAP_APPLY_INVALID_PFC": { + "desc": "Configure port pfc enable with invalid pfc priority.", + "eStrKey": "Pattern" + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/qosmaps.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/qosmaps.json new file mode 100644 index 000000000000..fe085ee3c7f9 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/qosmaps.json @@ -0,0 +1,724 @@ +{ + "DSCP_TO_TC_MAP_CRETAE": { + "sonic-dscp-tc-map:sonic-dscp-tc-map": { + "sonic-dscp-tc-map:DSCP_TO_TC_MAP": { + "DSCP_TO_TC_MAP_LIST": [ + { + "name": "map1", + "DSCP_TO_TC_MAP": [ + { + "dscp": "1", + "tc": "1" + }, + { + "dscp":"2", + "tc":"2" + } + ] + }, + { + "name": "map2", + "DSCP_TO_TC_MAP": [ + { + "dscp": "1", + "tc": "1" + }, + { + "dscp":"2", + "tc":"2" + } + ] + } + ] + } + } + }, + + "DSCP_TO_TC_MAP_CREATE_INVALID_DSCP": { + "sonic-dscp-tc-map:sonic-dscp-tc-map": { + "sonic-dscp-tc-map:DSCP_TO_TC_MAP": { + "DSCP_TO_TC_MAP_LIST": [ + { + "name": "map3", + "DSCP_TO_TC_MAP": [ + { + "dscp": "64", + "tc": "1" + }, + { + "dscp":"2", + "tc":"2" + } + ] + } + ] + } + } + }, + + "DSCP_TO_TC_MAP_CREATE_INVALID_TC": { + "sonic-dscp-tc-map:sonic-dscp-tc-map": { + "sonic-dscp-tc-map:DSCP_TO_TC_MAP": { + "DSCP_TO_TC_MAP_LIST": [ + { + "name": "map3", + "DSCP_TO_TC_MAP": [ + { + "dscp": "1", + "tc": "8" + }, + { + "dscp":"2", + "tc":"2" + } + ] + } + ] + } + } + }, + + "DOT1P_TO_TC_MAP_CRETAE": { + "sonic-dot1p-tc-map:sonic-dot1p-tc-map": { + "sonic-dot1p-tc-map:DOT1P_TO_TC_MAP": { + "DOT1P_TO_TC_MAP_LIST": [ + { + "name": "map1", + "DOT1P_TO_TC_MAP": [ + { + "dot1p": "1", + "tc": "1" + }, + { + "dot1p":"2", + "tc":"2" + } + ] + }, + { + "name": "map2", + "DOT1P_TO_TC_MAP": [ + { + "dot1p": "1", + "tc": "1" + }, + { + "dot1p":"2", + "tc":"2" + } + ] + } + ] + } + } + }, + + "DOT1P_TO_TC_MAP_CREATE_INVALID_DOT1P": { + "sonic-dot1p-tc-map:sonic-dot1p-tc-map": { + "sonic-dot1p-tc-map:DOT1P_TO_TC_MAP": { + "DOT1P_TO_TC_MAP_LIST": [ + { + "name": "map3", + "DOT1P_TO_TC_MAP": [ + { + "dot1p": "64", + "tc": "1" + }, + { + "dot1p":"2", + "tc":"2" + } + ] + } + ] + } + } + }, + + "DOT1P_TO_TC_MAP_CREATE_INVALID_TC": { + "sonic-dot1p-tc-map:sonic-dot1p-tc-map": { + "sonic-dot1p-tc-map:DOT1P_TO_TC_MAP": { + "DOT1P_TO_TC_MAP_LIST": [ + { + "name": "map3", + "DOT1P_TO_TC_MAP": [ + { + "dot1p": "1", + "tc": "8" + }, + { + "dot1p":"2", + "tc":"2" + } + ] + } + ] + } + } + }, + + "TC_TO_QUEUE_MAP_CRETAE": { + "sonic-tc-queue-map:sonic-tc-queue-map": { + "sonic-tc-queue-map:TC_TO_QUEUE_MAP": { + "TC_TO_QUEUE_MAP_LIST": [ + { + "name": "map1", + "TC_TO_QUEUE_MAP": [ + { + "tc": "1", + "qindex": "1" + }, + { + "tc":"2", + "qindex":"2" + } + ] + }, + { + "name": "map2", + "TC_TO_QUEUE_MAP": [ + { + "tc": "1", + "qindex": "1" + }, + { + "tc":"2", + "qindex":"2" + } + ] + } + ] + } + } + }, + + "TC_TO_QUEUE_MAP_CREATE_INVALID_TC": { + "sonic-tc-queue-map:sonic-tc-queue-map": { + "sonic-tc-queue-map:TC_TO_QUEUE_MAP": { + "TC_TO_QUEUE_MAP_LIST": [ + { + "name": "map3", + "TC_TO_QUEUE_MAP": [ + { + "tc": "64", + "qindex": "1" + }, + { + "tc":"2", + "qindex":"2" + } + ] + } + ] + } + } + }, + + "TC_TO_QUEUE_MAP_CREATE_INVALID_QUEUE": { + "sonic-tc-queue-map:sonic-tc-queue-map": { + "sonic-tc-queue-map:TC_TO_QUEUE_MAP": { + "TC_TO_QUEUE_MAP_LIST": [ + { + "name": "map3", + "TC_TO_QUEUE_MAP": [ + { + "tc": "1", + "qindex": "8" + }, + { + "tc":"2", + "qindex":"2" + } + ] + } + ] + } + } + }, + + "TC_TO_PRIORITY_GROUP_MAP_CRETAE": { + "sonic-tc-priority-group-map:sonic-tc-priority-group-map": { + "sonic-tc-priority-group-map:TC_TO_PRIORITY_GROUP_MAP": { + "TC_TO_PRIORITY_GROUP_MAP_LIST": [ + { + "name": "map1", + "TC_TO_PRIORITY_GROUP_MAP": [ + { + "tc": "1", + "pg": "1" + }, + { + "tc":"2", + "pg":"2" + } + ] + }, + { + "name": "map2", + "TC_TO_PRIORITY_GROUP_MAP": [ + { + "tc": "1", + "pg": "1" + }, + { + "tc":"2", + "pg":"2" + } + ] + } + ] + } + } + }, + + "TC_TO_PRIORITY_GROUP_MAP_CREATE_INVALID_TC": { + "sonic-tc-priority-group-map:sonic-tc-priority-group-map": { + "sonic-tc-priority-group-map:TC_TO_PRIORITY_GROUP_MAP": { + "TC_TO_PRIORITY_GROUP_MAP_LIST": [ + { + "name": "map3", + "TC_TO_PRIORITY_GROUP_MAP": [ + { + "tc": "64", + "pg": "1" + }, + { + "tc":"2", + "pg":"2" + } + ] + } + ] + } + } + }, + + "TC_TO_PRIORITY_GROUP_MAP_CREATE_INVALID_PRIORITY_GROUP": { + "sonic-tc-priority-group-map:sonic-tc-priority-group-map": { + "sonic-tc-priority-group-map:TC_TO_PRIORITY_GROUP_MAP": { + "TC_TO_PRIORITY_GROUP_MAP_LIST": [ + { + "name": "map3", + "TC_TO_PRIORITY_GROUP_MAP": [ + { + "tc": "1", + "pg": "8" + }, + { + "tc":"2", + "pg":"2" + } + ] + } + ] + } + } + }, + + "PFC_PRIORITY_TO_QUEUE_MAP_CRETAE": { + "sonic-pfc-priority-queue-map:sonic-pfc-priority-queue-map": { + "sonic-pfc-priority-queue-map:MAP_PFC_PRIORITY_TO_QUEUE": { + "MAP_PFC_PRIORITY_TO_QUEUE_LIST": [ + { + "name": "map1", + "MAP_PFC_PRIORITY_TO_QUEUE": [ + { + "pfc_priority": "1", + "qindex": "1" + }, + { + "pfc_priority":"2", + "qindex":"2" + } + ] + }, + { + "name": "map2", + "MAP_PFC_PRIORITY_TO_QUEUE": [ + { + "pfc_priority": "1", + "qindex": "1" + }, + { + "pfc_priority":"2", + "qindex":"2" + } + ] + } + ] + } + } + }, + + "PFC_PRIORITY_TO_QUEUE_MAP_CREATE_INVALID_PFC_PRIORITY": { + "sonic-pfc-priority-queue-map:sonic-pfc-priority-queue-map": { + "sonic-pfc-priority-queue-map:MAP_PFC_PRIORITY_TO_QUEUE": { + "MAP_PFC_PRIORITY_TO_QUEUE_LIST": [ + { + "name": "map3", + "MAP_PFC_PRIORITY_TO_QUEUE": [ + { + "pfc_priority": "64", + "qindex": "1" + }, + { + "pfc_priority":"2", + "qindex":"2" + } + ] + } + ] + } + } + }, + + "PFC_PRIORITY_TO_QUEUE_MAP_CREATE_INVALID_QUEUE": { + "sonic-pfc-priority-queue-map:sonic-pfc-priority-queue-map": { + "sonic-pfc-priority-queue-map:MAP_PFC_PRIORITY_TO_QUEUE": { + "MAP_PFC_PRIORITY_TO_QUEUE_LIST": [ + { + "name": "map3", + "MAP_PFC_PRIORITY_TO_QUEUE": [ + { + "pfc_priority": "1", + "qindex": "8" + }, + { + "pfc_priority":"2", + "qindex":"2" + } + ] + } + ] + } + } + }, + + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_CRETAE": { + "sonic-pfc-priority-priority-group-map:sonic-pfc-priority-priority-group-map": { + "sonic-pfc-priority-priority-group-map:PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_LIST": [ + { + "name": "map1", + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": [ + { + "pfc_priority": "1", + "pg": "1" + }, + { + "pfc_priority":"2", + "pg":"2" + } + ] + }, + { + "name": "map2", + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": [ + { + "pfc_priority": "1", + "pg": "1" + }, + { + "pfc_priority":"2", + "pg":"2" + } + ] + } + ] + } + } + }, + + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_CREATE_INVALID_PFC_PRIORITY": { + "sonic-pfc-priority-priority-group-map:sonic-pfc-priority-priority-group-map": { + "sonic-pfc-priority-priority-group-map:PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_LIST": [ + { + "name": "map3", + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": [ + { + "pfc_priority": "64", + "pg": "1" + }, + { + "pfc_priority":"2", + "pg":"2" + } + ] + } + ] + } + } + }, + + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_CREATE_INVALID_PRIORITY_GROUP": { + "sonic-pfc-priority-priority-group-map:sonic-pfc-priority-priority-group-map": { + "sonic-pfc-priority-priority-group-map:PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_LIST": [ + { + "name": "map3", + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": [ + { + "pfc_priority": "1", + "pg": "8" + }, + { + "pfc_priority":"2", + "pg":"2" + } + ] + } + ] + } + } + }, + + "PORT_QOS_MAP_APPLY_MAPS": { + "sonic-dscp-tc-map:sonic-dscp-tc-map": { + "sonic-dscp-tc-map:DSCP_TO_TC_MAP": { + "DSCP_TO_TC_MAP_LIST": [ + { + "name": "map1", + "DSCP_TO_TC_MAP": [ + { + "dscp": "1", + "tc": "1" + }, + { + "dscp":"2", + "tc":"2" + } + ] + } + ] + } + }, + + "sonic-dot1p-tc-map:sonic-dot1p-tc-map": { + "sonic-dot1p-tc-map:DOT1P_TO_TC_MAP": { + "DOT1P_TO_TC_MAP_LIST": [ + { + "name": "map1", + "DOT1P_TO_TC_MAP": [ + { + "dot1p": "1", + "tc": "1" + }, + { + "dot1p":"2", + "tc":"2" + } + ] + } + ] + } + }, + + "sonic-tc-queue-map:sonic-tc-queue-map": { + "sonic-tc-queue-map:TC_TO_QUEUE_MAP": { + "TC_TO_QUEUE_MAP_LIST": [ + { + "name": "map1", + "TC_TO_QUEUE_MAP": [ + { + "tc": "1", + "qindex": "1" + }, + { + "tc":"2", + "qindex":"2" + } + ] + } + ] + } + }, + "sonic-tc-priority-group-map:sonic-tc-priority-group-map": { + "sonic-tc-priority-group-map:TC_TO_PRIORITY_GROUP_MAP": { + "TC_TO_PRIORITY_GROUP_MAP_LIST": [ + { + "name": "map1", + "TC_TO_PRIORITY_GROUP_MAP": [ + { + "tc": "1", + "pg": "1" + }, + { + "tc":"2", + "pg":"2" + } + ] + } + ] + } + }, + + "sonic-pfc-priority-queue-map:sonic-pfc-priority-queue-map": { + "sonic-pfc-priority-queue-map:MAP_PFC_PRIORITY_TO_QUEUE": { + "MAP_PFC_PRIORITY_TO_QUEUE_LIST": [ + { + "name": "map1", + "MAP_PFC_PRIORITY_TO_QUEUE": [ + { + "pfc_priority": "1", + "qindex": "1" + }, + { + "pfc_priority":"2", + "qindex":"2" + } + ] + } + ] + } + }, + + "sonic-pfc-priority-priority-group-map:sonic-pfc-priority-priority-group-map": { + "sonic-pfc-priority-priority-group-map:PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": { + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_LIST": [ + { + "name": "map1", + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP": [ + { + "pfc_priority": "1", + "pg": "1" + }, + { + "pfc_priority":"2", + "pg":"2" + } + ] + } + ] + } + }, + + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet0", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-port-qos-map:sonic-port-qos-map": { + "sonic-port-qos-map:PORT_QOS_MAP": { + "PORT_QOS_MAP_LIST": [ + { + "ifname": "Ethernet0", + "dscp_to_tc_map": "map1", + "tc_to_pg_map": "map1", + "tc_to_queue_map": "map1", + "pfc_to_queue_map": "map1", + "pfc_to_pg_map": "map1", + "dscp_to_tc_map": "map1", + "dot1p_to_tc_map": "map1", + "pfc_enable": "3,4" + } + ] + } + } + }, + + "PORT_QOS_MAP_APPLY_NON_EXISTS_MAPS": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet0", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet0", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-port-qos-map:sonic-port-qos-map": { + "sonic-port-qos-map:PORT_QOS_MAP": { + "PORT_QOS_MAP_LIST": [ + { + "ifname": "Ethernet0", + "dscp_to_tc_map": "map2", + "tc_to_pg_map": "map2", + "tc_to_queue_map": "map2", + "pfc_to_queue_map": "map2", + "pfc_to_pg_map": "map2", + "dscp_to_tc_map": "map2", + "dot1p_to_tc_map": "map2", + "pfc_enable": "3,4" + } + ] + } + } + }, + + "PORT_QOS_MAP_APPLY_NON_EXISTS_PORT": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet4", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-port-qos-map:sonic-port-qos-map": { + "sonic-port-qos-map:PORT_QOS_MAP": { + "PORT_QOS_MAP_LIST": [ + { + "ifname": "Ethernet0" + } + ] + } + } + }, + + "PORT_QOS_MAP_APPLY_INVALID_PFC": { + "sonic-port:sonic-port": { + "sonic-port:PORT": { + "PORT_LIST": [ + { + "admin_status": "up", + "alias": "eth0", + "description": "Ethernet4", + "lanes": "65", + "mtu": "9000", + "name": "Ethernet4", + "tpid": "0x8100", + "speed": "25000" + } + ] + } + }, + "sonic-port-qos-map:sonic-port-qos-map": { + "sonic-port-qos-map:PORT_QOS_MAP": { + "PORT_QOS_MAP_LIST": [ + { + "ifname": "Ethernet4", + "pfc_enable": "8" + } + ] + } + } + } + +} diff --git a/src/sonic-yang-models/yang-models/sonic-dot1p-tc-map.yang b/src/sonic-yang-models/yang-models/sonic-dot1p-tc-map.yang new file mode 100644 index 000000000000..0a756298c97e --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-dot1p-tc-map.yang @@ -0,0 +1,68 @@ +module sonic-dot1p-tc-map { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-dot1p-tc-map"; + + prefix dot1ptm; + + organization + "SONiC"; + + contact + "SONiC"; + + description + "DOT1P_TO_TC_MAP yang Module for SONiC OS"; + + revision 2021-04-15 { + description + "Initial revision."; + } + + container sonic-dot1p-tc-map { + + container DOT1P_TO_TC_MAP { + + description "DOT1P_TO_TC_MAP part of config_db.json"; + + list DOT1P_TO_TC_MAP_LIST { + + key "name"; + + leaf name { + type string { + pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})'; + length 1..32 { + error-message "Invalid length for map name."; + error-app-tag map-name-invalid-length; + } + } + } + + list DOT1P_TO_TC_MAP { //this is list inside list for storing mapping between two fields + + key "dot1p"; + + leaf dot1p { + type string { + pattern "[0-7]?" { + error-message "Invalid DOT1P"; + error-app-tag dot1p-invalid; + } + } + } + + leaf tc { + type string { + pattern "[0-7]?"{ + error-message "Invalid Traffic Class"; + error-app-tag tc-invalid; + } + } + } + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-dscp-tc-map.yang b/src/sonic-yang-models/yang-models/sonic-dscp-tc-map.yang new file mode 100644 index 000000000000..71d9fcd4884d --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-dscp-tc-map.yang @@ -0,0 +1,68 @@ +module sonic-dscp-tc-map { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-dscp-tc-map"; + + prefix dtm; + + organization + "SONiC"; + + contact + "SONiC"; + + description + "DSCP_TO_TC_MAP yang Module for SONiC OS"; + + revision 2021-04-15 { + description + "Initial revision."; + } + + container sonic-dscp-tc-map { + + container DSCP_TO_TC_MAP { + + description "DSCP_TO_TC_MAP part of config_db.json"; + + list DSCP_TO_TC_MAP_LIST { + + key "name"; + + leaf name { + type string { + pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})'; + length 1..32 { + error-message "Invalid length for map name."; + error-app-tag map-name-invalid-length; + } + } + } + + list DSCP_TO_TC_MAP { //this is list inside list for storing mapping between two fields + + key "dscp"; + + leaf dscp { + type string { + pattern "6[0-3]|[1-5][0-9]?|[0-9]?" { + error-message "Invalid DSCP"; + error-app-tag dscp-invalid; + } + } + } + + leaf tc { + type string { + pattern "[0-7]?" { + error-message "Invalid Traffic Class"; + error-app-tag tc-invalid; + } + } + } + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-pfc-priority-priority-group-map.yang b/src/sonic-yang-models/yang-models/sonic-pfc-priority-priority-group-map.yang new file mode 100644 index 000000000000..ccc86c064efb --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-pfc-priority-priority-group-map.yang @@ -0,0 +1,68 @@ +module sonic-pfc-priority-priority-group-map { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-pfc-priority-priority-group-map"; + + prefix pppgm; + + organization + "SONiC"; + + contact + "SONiC"; + + description + "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP yang Module for SONiC OS"; + + revision 2021-04-15 { + description + "Initial revision."; + } + + container sonic-pfc-priority-priority-group-map { + + container PFC_PRIORITY_TO_PRIORITY_GROUP_MAP { + + description "PFC_PRIORITY_TO_PRIORITY_GROUP_MAP part of config_db.json"; + + list PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_LIST { + + key "name"; + + leaf name { + type string { + pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})'; + length 1..32 { + error-message "Invalid length for map name."; + error-app-tag map-name-invalid-length; + } + } + } + + list PFC_PRIORITY_TO_PRIORITY_GROUP_MAP { //this is list inside list for storing mapping between two fields + + key "pfc_priority"; + + leaf pfc_priority { + type string { + pattern "[0-7]?" { + error-message "Invalid pfc priority"; + error-app-tag pfc-priority-invalid; + } + } + } + + leaf pg { + type string { + pattern "[0-7]?" { + error-message "Invalid Priority Group"; + error-app-tag pg-invalid; + } + } + } + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-pfc-priority-queue-map.yang b/src/sonic-yang-models/yang-models/sonic-pfc-priority-queue-map.yang new file mode 100644 index 000000000000..fb659d89bb4b --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-pfc-priority-queue-map.yang @@ -0,0 +1,68 @@ +module sonic-pfc-priority-queue-map { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-pfc-priority-queue-map"; + + prefix ppqm; + + organization + "SONiC"; + + contact + "SONiC"; + + description + "PFC_PRIORITY_TO_QUEUE_MAP yang Module for SONiC OS"; + + revision 2021-04-15 { + description + "Initial revision."; + } + + container sonic-pfc-priority-queue-map { + + container MAP_PFC_PRIORITY_TO_QUEUE { + + description "MAP_PFC_PRIORITY_TO_QUEUE part of config_db.json"; + + list MAP_PFC_PRIORITY_TO_QUEUE_LIST { + + key "name"; + + leaf name { + type string { + pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})'; + length 1..32 { + error-message "Invalid length for map name."; + error-app-tag map-name-invalid-length; + } + } + } + + list MAP_PFC_PRIORITY_TO_QUEUE { //this is list inside list for storing mapping between two fields + + key "pfc_priority"; + + leaf pfc_priority { + type string { + pattern "[0-7]?" { + error-message "Invalid pfc priority"; + error-app-tag pfc-priority-invalid; + } + } + } + + leaf qindex { + type string { + pattern "[0-7]?" { + error-message "Invalid queue index"; + error-app-tag queue-index-invalid; + } + } + } + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-port-qos-map.yang b/src/sonic-yang-models/yang-models/sonic-port-qos-map.yang new file mode 100644 index 000000000000..b29e2f547087 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-port-qos-map.yang @@ -0,0 +1,110 @@ +module sonic-port-qos-map { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-port-qos-map"; + + prefix pqm; + + import sonic-port { + prefix prt; + } + + import sonic-tc-priority-group-map { + prefix tpgm; + } + + import sonic-tc-queue-map { + prefix tqm; + } + + import sonic-pfc-priority-queue-map { + prefix ppqm; + } + + import sonic-pfc-priority-priority-group-map { + prefix pppgm; + } + + import sonic-dscp-tc-map { + prefix dtm; + } + + import sonic-dot1p-tc-map { + prefix dot1ptm; + } + + organization + "SONiC"; + + contact + "SONiC"; + + description + "SONIC PORT_QOS_MAP"; + + revision 2019-05-15 { + description + "Initial revision."; + } + + container sonic-port-qos-map { + + container PORT_QOS_MAP { + list PORT_QOS_MAP_LIST { + + key "ifname"; + + leaf ifname { + type leafref { + path "/prt:sonic-port/prt:PORT/prt:PORT_LIST/prt:name"; + } + description + "Reference of port on which QOS MAPS to be configured."; + } + + leaf tc_to_pg_map { + type leafref { + path "/tpgm:sonic-tc-priority-group-map/tpgm:TC_TO_PRIORITY_GROUP_MAP/tpgm:TC_TO_PRIORITY_GROUP_MAP_LIST/tpgm:name"; + } + } + + leaf tc_to_queue_map { + type leafref { + path "/tqm:sonic-tc-queue-map/tqm:TC_TO_QUEUE_MAP/tqm:TC_TO_QUEUE_MAP_LIST/tqm:name"; + } + } + + leaf pfc_enable { + type string { + pattern "[0-7](,[0-7])?"; + } + } + + leaf pfc_to_queue_map { + type leafref { + path "/ppqm:sonic-pfc-priority-queue-map/ppqm:MAP_PFC_PRIORITY_TO_QUEUE/ppqm:MAP_PFC_PRIORITY_TO_QUEUE_LIST/ppqm:name"; + } + } + + leaf pfc_to_pg_map { + type leafref { + path "/pppgm:sonic-pfc-priority-priority-group-map/pppgm:PFC_PRIORITY_TO_PRIORITY_GROUP_MAP/pppgm:PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_LIST/pppgm:name"; + } + } + + leaf dscp_to_tc_map { + type leafref { + path "/dtm:sonic-dscp-tc-map/dtm:DSCP_TO_TC_MAP/dtm:DSCP_TO_TC_MAP_LIST/dtm:name"; + } + } + + leaf dot1p_to_tc_map { + type leafref { + path "/dot1ptm:sonic-dot1p-tc-map/dot1ptm:DOT1P_TO_TC_MAP/dot1ptm:DOT1P_TO_TC_MAP_LIST/dot1ptm:name"; + } + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-tc-priority-group-map.yang b/src/sonic-yang-models/yang-models/sonic-tc-priority-group-map.yang new file mode 100644 index 000000000000..4290b79c3ee7 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-tc-priority-group-map.yang @@ -0,0 +1,68 @@ +module sonic-tc-priority-group-map { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-tc-priority-group-map"; + + prefix tpgm; + + organization + "SONiC"; + + contact + "SONiC"; + + description + "TC_TO_PRIORITY_GROUP_MAP yang Module for SONiC OS"; + + revision 2021-04-15 { + description + "Initial revision."; + } + + container sonic-tc-priority-group-map { + + container TC_TO_PRIORITY_GROUP_MAP { + + description "TC_TO_PRIORITY_GROUP_MAP part of config_db.json"; + + list TC_TO_PRIORITY_GROUP_MAP_LIST { + + key "name"; + + leaf name { + type string { + pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})'; + length 1..32 { + error-message "Invalid length for map name."; + error-app-tag map-name-invalid-length; + } + } + } + + list TC_TO_PRIORITY_GROUP_MAP { //this is list inside list for storing mapping between two fields + + key "tc"; + + leaf tc { + type string { + pattern "[0-7]?" { + error-message "Invalid Traffic Class"; + error-app-tag tc-invalid; + } + } + } + + leaf pg { + type string { + pattern "[0-7]?" { + error-message "Invalid Priority Group"; + error-app-tag pg-invalid; + } + } + } + } + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-tc-queue-map.yang b/src/sonic-yang-models/yang-models/sonic-tc-queue-map.yang new file mode 100644 index 000000000000..fa22a8331294 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-tc-queue-map.yang @@ -0,0 +1,68 @@ +module sonic-tc-queue-map { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-tc-queue-map"; + + prefix tqm; + + organization + "SONiC"; + + contact + "SONiC"; + + description + "TC_TO_QUEUE_MAP yang Module for SONiC OS"; + + revision 2021-04-15 { + description + "Initial revision."; + } + + container sonic-tc-queue-map { + + container TC_TO_QUEUE_MAP { + + description "TC_TO_QUEUE_MAP part of config_db.json"; + + list TC_TO_QUEUE_MAP_LIST { + + key "name"; + + leaf name { + type string { + pattern '[a-zA-Z0-9]{1}([-a-zA-Z0-9_]{0,31})'; + length 1..32 { + error-message "Invalid length for map name."; + error-app-tag map-name-invalid-length; + } + } + } + + list TC_TO_QUEUE_MAP { //this is list inside list for storing mapping between two fields + + key "tc"; + + leaf tc { + type string { + pattern "[0-7]?" { + error-message "Invalid Traffic Class"; + error-app-tag tc-invalid; + } + } + } + + leaf qindex { + type string { + pattern "[0-7]?" { + error-message "Invalid queue index"; + error-app-tag queue-index-invalid; + } + } + } + } + } + } + } +} From 03c5b78011b835d2f4dfc5c1d82e995f7ac6e43d Mon Sep 17 00:00:00 2001 From: Sudharsan Dhamal Gopalarathnam Date: Fri, 29 Oct 2021 22:24:36 +0000 Subject: [PATCH 6/6] Disabling counter group tunnel as per review comments --- dockers/docker-orchagent/enable_counters.py | 1 - 1 file changed, 1 deletion(-) diff --git a/dockers/docker-orchagent/enable_counters.py b/dockers/docker-orchagent/enable_counters.py index a195982ecc0a..bf0e2b32993c 100755 --- a/dockers/docker-orchagent/enable_counters.py +++ b/dockers/docker-orchagent/enable_counters.py @@ -45,7 +45,6 @@ def enable_counters(): enable_counter_group(db, 'QUEUE_WATERMARK') enable_counter_group(db, 'BUFFER_POOL_WATERMARK') enable_counter_group(db, 'PORT_BUFFER_DROP') - enable_counter_group(db, 'TUNNEL') enable_rates()