diff --git a/debian/swss.install b/debian/swss.install index 741e6db9db67..e04f63269be3 100644 --- a/debian/swss.install +++ b/debian/swss.install @@ -1,6 +1,5 @@ swssconfig/sample/netbouncer.json etc/swss/config.d swssconfig/sample/00-copp.config.json etc/swss/config.d -swssconfig/sample/msn27xx.32ports.qos.json etc/swss/config.d swssconfig/sample/td2.32ports.buffers.json etc/swss/config.d swssconfig/sample/td2.32ports.qos.json etc/swss/config.d swssconfig/sample/th.64ports.buffers.json etc/swss/config.d diff --git a/orchagent/orch.cpp b/orchagent/orch.cpp index f2353a81fc8c..1f7e81a613f4 100644 --- a/orchagent/orch.cpp +++ b/orchagent/orch.cpp @@ -156,8 +156,12 @@ bool Orch::parseReference(type_map &type_maps, string &ref_in, string &type_name tokens = tokenize(ref_content, delimiter); if (tokens.size() != 2) { - SWSS_LOG_ERROR("malformed reference:%s. Must contain 2 tokens\n", ref_content.c_str()); - return false; + tokens = tokenize(ref_content, config_db_key_delimiter); + if (tokens.size() != 2) + { + SWSS_LOG_ERROR("malformed reference:%s. Must contain 2 tokens\n", ref_content.c_str()); + return false; + } } auto type_it = type_maps.find(tokens[0]); if (type_it == type_maps.end()) diff --git a/orchagent/orch.h b/orchagent/orch.h index 6d95402918c4..dc804c74487c 100644 --- a/orchagent/orch.h +++ b/orchagent/orch.h @@ -25,6 +25,7 @@ const char ref_start = '['; const char ref_end = ']'; const char comma = ','; const char range_specifier = '-'; +const char config_db_key_delimiter = '|'; #define MLNX_PLATFORM_SUBSTRING "mellanox" #define BRCM_PLATFORM_SUBSTRING "broadcom" diff --git a/orchagent/orchdaemon.cpp b/orchagent/orchdaemon.cpp index eba1caaa011e..c747c33db4d7 100644 --- a/orchagent/orchdaemon.cpp +++ b/orchagent/orchdaemon.cpp @@ -66,17 +66,17 @@ bool OrchDaemon::init() TunnelDecapOrch *tunnel_decap_orch = new TunnelDecapOrch(m_applDb, APP_TUNNEL_DECAP_TABLE_NAME); vector qos_tables = { - APP_TC_TO_QUEUE_MAP_TABLE_NAME, - APP_SCHEDULER_TABLE_NAME, - APP_DSCP_TO_TC_MAP_TABLE_NAME, - APP_QUEUE_TABLE_NAME, - APP_PORT_QOS_MAP_TABLE_NAME, - APP_WRED_PROFILE_TABLE_NAME, - APP_TC_TO_PRIORITY_GROUP_MAP_NAME, - APP_PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_NAME, - APP_PFC_PRIORITY_TO_QUEUE_MAP_NAME + CFG_TC_TO_QUEUE_MAP_TABLE_NAME, + CFG_SCHEDULER_TABLE_NAME, + CFG_DSCP_TO_TC_MAP_TABLE_NAME, + CFG_QUEUE_TABLE_NAME, + CFG_PORT_QOS_MAP_TABLE_NAME, + CFG_WRED_PROFILE_TABLE_NAME, + CFG_TC_TO_PRIORITY_GROUP_MAP_TABLE_NAME, + CFG_PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_TABLE_NAME, + CFG_PFC_PRIORITY_TO_QUEUE_MAP_TABLE_NAME }; - QosOrch *qos_orch = new QosOrch(m_applDb, qos_tables); + QosOrch *qos_orch = new QosOrch(m_configDb, qos_tables); vector buffer_tables = { APP_BUFFER_POOL_TABLE_NAME, diff --git a/orchagent/qosorch.cpp b/orchagent/qosorch.cpp index 09f9acaae697..a71284e327e3 100644 --- a/orchagent/qosorch.cpp +++ b/orchagent/qosorch.cpp @@ -41,15 +41,15 @@ map qos_to_attr_map = { }; type_map QosOrch::m_qos_maps = { - {APP_DSCP_TO_TC_MAP_TABLE_NAME, new object_map()}, - {APP_TC_TO_QUEUE_MAP_TABLE_NAME, new object_map()}, - {APP_SCHEDULER_TABLE_NAME, new object_map()}, - {APP_WRED_PROFILE_TABLE_NAME, new object_map()}, - {APP_PORT_QOS_MAP_TABLE_NAME, new object_map()}, - {APP_QUEUE_TABLE_NAME, new object_map()}, - {APP_TC_TO_PRIORITY_GROUP_MAP_NAME, new object_map()}, - {APP_PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_NAME, new object_map()}, - {APP_PFC_PRIORITY_TO_QUEUE_MAP_NAME, new object_map()} + {CFG_DSCP_TO_TC_MAP_TABLE_NAME, new object_map()}, + {CFG_TC_TO_QUEUE_MAP_TABLE_NAME, new object_map()}, + {CFG_SCHEDULER_TABLE_NAME, new object_map()}, + {CFG_WRED_PROFILE_TABLE_NAME, new object_map()}, + {CFG_PORT_QOS_MAP_TABLE_NAME, new object_map()}, + {CFG_QUEUE_TABLE_NAME, new object_map()}, + {CFG_TC_TO_PRIORITY_GROUP_MAP_TABLE_NAME, new object_map()}, + {CFG_PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_TABLE_NAME, new object_map()}, + {CFG_PFC_PRIORITY_TO_QUEUE_MAP_TABLE_NAME, new object_map()} }; task_process_status QosMapHandler::processWorkItem(Consumer& consumer) @@ -743,16 +743,16 @@ void QosOrch::initAclEntryForEcn(sai_object_id_t acl_table_id, sai_uint32_t prio void QosOrch::initTableHandlers() { SWSS_LOG_ENTER(); - m_qos_handler_map.insert(qos_handler_pair(APP_DSCP_TO_TC_MAP_TABLE_NAME, &QosOrch::handleDscpToTcTable)); - m_qos_handler_map.insert(qos_handler_pair(APP_TC_TO_QUEUE_MAP_TABLE_NAME, &QosOrch::handleTcToQueueTable)); - m_qos_handler_map.insert(qos_handler_pair(APP_SCHEDULER_TABLE_NAME, &QosOrch::handleSchedulerTable)); - m_qos_handler_map.insert(qos_handler_pair(APP_QUEUE_TABLE_NAME, &QosOrch::handleQueueTable)); - m_qos_handler_map.insert(qos_handler_pair(APP_PORT_QOS_MAP_TABLE_NAME, &QosOrch::handlePortQosMapTable)); - m_qos_handler_map.insert(qos_handler_pair(APP_WRED_PROFILE_TABLE_NAME, &QosOrch::handleWredProfileTable)); - - m_qos_handler_map.insert(qos_handler_pair(APP_TC_TO_PRIORITY_GROUP_MAP_NAME, &QosOrch::handleTcToPgTable)); - m_qos_handler_map.insert(qos_handler_pair(APP_PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_NAME, &QosOrch::handlePfcPrioToPgTable)); - m_qos_handler_map.insert(qos_handler_pair(APP_PFC_PRIORITY_TO_QUEUE_MAP_NAME, &QosOrch::handlePfcToQueueTable)); + m_qos_handler_map.insert(qos_handler_pair(CFG_DSCP_TO_TC_MAP_TABLE_NAME, &QosOrch::handleDscpToTcTable)); + m_qos_handler_map.insert(qos_handler_pair(CFG_TC_TO_QUEUE_MAP_TABLE_NAME, &QosOrch::handleTcToQueueTable)); + m_qos_handler_map.insert(qos_handler_pair(CFG_SCHEDULER_TABLE_NAME, &QosOrch::handleSchedulerTable)); + m_qos_handler_map.insert(qos_handler_pair(CFG_QUEUE_TABLE_NAME, &QosOrch::handleQueueTable)); + m_qos_handler_map.insert(qos_handler_pair(CFG_PORT_QOS_MAP_TABLE_NAME, &QosOrch::handlePortQosMapTable)); + m_qos_handler_map.insert(qos_handler_pair(CFG_WRED_PROFILE_TABLE_NAME, &QosOrch::handleWredProfileTable)); + + m_qos_handler_map.insert(qos_handler_pair(CFG_TC_TO_PRIORITY_GROUP_MAP_TABLE_NAME, &QosOrch::handleTcToPgTable)); + m_qos_handler_map.insert(qos_handler_pair(CFG_PFC_PRIORITY_TO_PRIORITY_GROUP_MAP_TABLE_NAME, &QosOrch::handlePfcPrioToPgTable)); + m_qos_handler_map.insert(qos_handler_pair(CFG_PFC_PRIORITY_TO_QUEUE_MAP_TABLE_NAME, &QosOrch::handlePfcToQueueTable)); } task_process_status QosOrch::handleSchedulerTable(Consumer& consumer) @@ -763,7 +763,7 @@ task_process_status QosOrch::handleSchedulerTable(Consumer& consumer) sai_object_id_t sai_object = SAI_NULL_OBJECT_ID; KeyOpFieldsValuesTuple tuple = consumer.m_toSync.begin()->second; - string qos_map_type_name = APP_SCHEDULER_TABLE_NAME; + string qos_map_type_name = CFG_SCHEDULER_TABLE_NAME; string qos_object_name = kfvKey(tuple); string op = kfvOp(tuple); @@ -1012,8 +1012,8 @@ task_process_status QosOrch::handleQueueTable(Consumer& consumer) vector port_names; ref_resolve_status resolve_result; - // sample "QUEUE_TABLE:ETHERNET4:1" - tokens = tokenize(key, delimiter); + // sample "QUEUE: {Ethernet4|0-1}" + tokens = tokenize(key, config_db_key_delimiter); if (tokens.size() != 2) { SWSS_LOG_ERROR("malformed key:%s. Must contain 2 tokens", key.c_str()); diff --git a/swssconfig/sample/msn27xx.32ports.qos.json b/swssconfig/sample/msn27xx.32ports.qos.json deleted file mode 100644 index cf51c6659557..000000000000 --- a/swssconfig/sample/msn27xx.32ports.qos.json +++ /dev/null @@ -1,182 +0,0 @@ -[ - { - "TC_TO_PRIORITY_GROUP_MAP_TABLE:AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - }, - "OP": "SET" - }, - { - "MAP_PFC_PRIORITY_TO_QUEUE:AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - }, - "OP": "SET" - }, - { - "TC_TO_QUEUE_MAP_TABLE:AZURE": { - "0": "0", - "1": "1", - "3": "3", - "4": "4" - }, - "OP": "SET" - }, - { - "DSCP_TO_TC_MAP_TABLE:AZURE": { - "0":"0", - "1":"0", - "2":"0", - "3":"3", - "4":"4", - "5":"0", - "6":"0", - "7":"0", - "8":"1", - "9":"0", - "10":"0", - "11":"0", - "12":"0", - "13":"0", - "14":"0", - "15":"0", - "16":"0", - "17":"0", - "18":"0", - "19":"0", - "20":"0", - "21":"0", - "22":"0", - "23":"0", - "24":"0", - "25":"0", - "26":"0", - "27":"0", - "28":"0", - "29":"0", - "30":"0", - "31":"0", - "32":"0", - "33":"0", - "34":"0", - "35":"0", - "36":"0", - "37":"0", - "38":"0", - "39":"0", - "40":"0", - "41":"0", - "42":"0", - "43":"0", - "44":"0", - "45":"0", - "46":"0", - "47":"0", - "48":"0", - "49":"0", - "50":"0", - "51":"0", - "52":"0", - "53":"0", - "54":"0", - "55":"0", - "56":"0", - "57":"0", - "58":"0", - "59":"0", - "60":"0", - "61":"0", - "62":"0", - "63":"0" - }, - "OP": "SET" - }, - { - "SCHEDULER_TABLE:scheduler.0" : { - "type":"DWRR", - "weight": "25" - }, - "OP": "SET" - }, - { - "SCHEDULER_TABLE:scheduler.1" : { - "type":"DWRR", - "weight": "30" - }, - "OP": "SET" - }, - { - "SCHEDULER_TABLE:scheduler.2" : { - "type":"DWRR", - "weight": "20" - }, - "OP": "SET" - }, - { - "PORT_QOS_MAP_TABLE:Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124": { - "dscp_to_tc_map" : "[DSCP_TO_TC_MAP_TABLE:AZURE]", - "tc_to_queue_map" : "[TC_TO_QUEUE_MAP_TABLE:AZURE]", - "tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP_TABLE:AZURE]", - "pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE:AZURE]", - "pfc_enable": "3,4" - }, - "OP": "SET" - }, - { - "WRED_PROFILE_TABLE:AZURE_LOSSY" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - }, - "OP": "SET" - }, - { - "WRED_PROFILE_TABLE:AZURE_LOSSLESS" : { - "wred_green_enable":"true", - "wred_yellow_enable":"true", - "ecn":"ecn_all", - "red_max_threshold":"512000", - "red_min_threshold":"512000", - "yellow_max_threshold":"512000", - "yellow_min_threshold":"512000", - "green_max_threshold": "184320", - "green_min_threshold": "184320" - }, - "OP": "SET" - }, - { - "QUEUE_TABLE:Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124:0-1" : { - "wred_profile" : "[WRED_PROFILE_TABLE:AZURE_LOSSY]" - }, - "OP": "SET" - }, - { - "QUEUE_TABLE:Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124:3-4" : { - "scheduler" : "[SCHEDULER_TABLE:scheduler.0]", - "wred_profile" : "[WRED_PROFILE_TABLE:AZURE_LOSSLESS]" - }, - "OP": "SET" - }, - { - "QUEUE_TABLE:Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124:0" : { - "scheduler" : "[SCHEDULER_TABLE:scheduler.1]" - }, - "OP": "SET" - }, - { - "QUEUE_TABLE:Ethernet0,Ethernet4,Ethernet8,Ethernet12,Ethernet16,Ethernet20,Ethernet24,Ethernet28,Ethernet32,Ethernet36,Ethernet40,Ethernet44,Ethernet48,Ethernet52,Ethernet56,Ethernet60,Ethernet64,Ethernet68,Ethernet72,Ethernet76,Ethernet80,Ethernet84,Ethernet88,Ethernet92,Ethernet96,Ethernet100,Ethernet104,Ethernet108,Ethernet112,Ethernet116,Ethernet120,Ethernet124:1" : { - "scheduler" : "[SCHEDULER_TABLE:scheduler.2]" - }, - "OP": "SET" - } -]