Skip to content
New issue

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

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

Already on GitHub? # to your account

Move QoS configuration to config DB #378

Merged
merged 3 commits into from
Nov 21, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions orchagent/orch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,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, delimiter2);
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())
Expand Down
1 change: 1 addition & 0 deletions orchagent/orch.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ using namespace std;
using namespace swss;

const char delimiter = ':';
const char delimiter2 = '|';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delimiter2 doesn't tell what it is separating, can you give it a more meaningful name? like field_delimiter if it is separating fields, or attr_delimiter if it is separating attributes, for example.

const char list_item_delimiter = ',';
const char ref_start = '[';
const char ref_end = ']';
Expand Down
20 changes: 10 additions & 10 deletions orchagent/orchdaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,17 @@ bool OrchDaemon::init()
TunnelDecapOrch *tunnel_decap_orch = new TunnelDecapOrch(m_applDb, APP_TUNNEL_DECAP_TABLE_NAME);

vector<string> 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<string> buffer_tables = {
APP_BUFFER_POOL_TABLE_NAME,
Expand Down
42 changes: 21 additions & 21 deletions orchagent/qosorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ map<string, sai_port_attr_t> 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)
Expand Down Expand Up @@ -744,16 +744,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)
Expand All @@ -764,7 +764,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);

Expand Down Expand Up @@ -1014,7 +1014,7 @@ task_process_status QosOrch::handleQueueTable(Consumer& consumer)

ref_resolve_status resolve_result;
// sample "QUEUE_TABLE:ETHERNET4:1"
tokens = tokenize(key, delimiter);
tokens = tokenize(key, delimiter2);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example doesn't match the code change here. Can you also update the example?

if (tokens.size() != 2)
{
SWSS_LOG_ERROR("malformed key:%s. Must contain 2 tokens", key.c_str());
Expand Down