-
Notifications
You must be signed in to change notification settings - Fork 529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QOS fieldvalue reference ABNF format to string changes #1754
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -202,32 +202,6 @@ void BufferMgrDynamic::transformSeperator(string &name) | |
name.replace(pos, 1, ":"); | ||
} | ||
|
||
void BufferMgrDynamic::transformReference(string &name) | ||
{ | ||
auto references = tokenize(name, list_item_delimiter); | ||
int ref_index = 0; | ||
|
||
name = ""; | ||
|
||
for (auto &reference : references) | ||
{ | ||
if (ref_index != 0) | ||
name += list_item_delimiter; | ||
ref_index ++; | ||
|
||
auto keys = tokenize(reference, config_db_key_delimiter); | ||
int key_index = 0; | ||
for (auto &key : keys) | ||
{ | ||
if (key_index == 0) | ||
name += key + "_TABLE"; | ||
else | ||
name += delimiter + key; | ||
key_index ++; | ||
} | ||
} | ||
} | ||
|
||
// For string "TABLE_NAME|objectname", returns "objectname" | ||
string BufferMgrDynamic::parseObjectNameFromKey(const string &key, size_t pos = 0) | ||
{ | ||
|
@@ -240,13 +214,6 @@ string BufferMgrDynamic::parseObjectNameFromKey(const string &key, size_t pos = | |
return keys[pos]; | ||
} | ||
|
||
// For string "[foo]", returns "foo" | ||
string BufferMgrDynamic::parseObjectNameFromReference(const string &reference) | ||
{ | ||
auto objName = reference.substr(1, reference.size() - 2); | ||
return parseObjectNameFromKey(objName, 1); | ||
} | ||
|
||
string BufferMgrDynamic::getDynamicProfileName(const string &speed, const string &cable, const string &mtu, const string &threshold, const string &gearbox_model, long lane_count) | ||
{ | ||
string buffer_profile_key; | ||
|
@@ -619,17 +586,14 @@ void BufferMgrDynamic::updateBufferProfileToDb(const string &name, const buffer_ | |
|
||
// profile threshold field name | ||
mode += "_th"; | ||
string pg_pool_reference = string(APP_BUFFER_POOL_TABLE_NAME) + | ||
m_applBufferProfileTable.getTableNameSeparator() + | ||
INGRESS_LOSSLESS_PG_POOL_NAME; | ||
|
||
fvVector.emplace_back("xon", profile.xon); | ||
if (!profile.xon_offset.empty()) { | ||
fvVector.emplace_back("xon_offset", profile.xon_offset); | ||
} | ||
fvVector.emplace_back("xoff", profile.xoff); | ||
fvVector.emplace_back("size", profile.size); | ||
fvVector.emplace_back("pool", "[" + pg_pool_reference + "]"); | ||
fvVector.emplace_back("pool", INGRESS_LOSSLESS_PG_POOL_NAME); | ||
fvVector.emplace_back(mode, profile.threshold); | ||
|
||
m_applBufferProfileTable.set(name, fvVector); | ||
|
@@ -646,15 +610,7 @@ void BufferMgrDynamic::updateBufferPgToDb(const string &key, const string &profi | |
|
||
fvVector.clear(); | ||
|
||
string profile_ref = string("[") + | ||
APP_BUFFER_PROFILE_TABLE_NAME + | ||
m_applBufferPgTable.getTableNameSeparator() + | ||
profile + | ||
"]"; | ||
|
||
fvVector.clear(); | ||
|
||
fvVector.push_back(make_pair("profile", profile_ref)); | ||
fvVector.push_back(make_pair("profile", profile)); | ||
m_applBufferPgTable.set(key, fvVector); | ||
} | ||
else | ||
|
@@ -1779,8 +1735,7 @@ task_process_status BufferMgrDynamic::handleBufferProfileTable(KeyOpFieldsValues | |
{ | ||
if (!value.empty()) | ||
{ | ||
transformReference(value); | ||
auto poolName = parseObjectNameFromReference(value); | ||
auto poolName = value; | ||
if (poolName.empty()) | ||
{ | ||
SWSS_LOG_ERROR("BUFFER_PROFILE: Invalid format of reference to pool: %s", value.c_str()); | ||
|
@@ -1953,8 +1908,7 @@ task_process_status BufferMgrDynamic::handleOneBufferPgEntry(const string &key, | |
{ | ||
// Headroom override | ||
pureDynamic = false; | ||
transformReference(value); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
string profileName = parseObjectNameFromReference(value); | ||
string profileName = value; | ||
if (profileName.empty()) | ||
{ | ||
SWSS_LOG_ERROR("BUFFER_PG: Invalid format of reference to profile: %s", value.c_str()); | ||
|
@@ -2170,12 +2124,6 @@ task_process_status BufferMgrDynamic::doBufferTableTask(KeyOpFieldsValuesTuple & | |
for (auto i : kfvFieldsValues(tuple)) | ||
{ | ||
// Transform the separator in values from "|" to ":" | ||
if (fvField(i) == "pool") | ||
transformReference(fvValue(i)); | ||
if (fvField(i) == "profile") | ||
transformReference(fvValue(i)); | ||
if (fvField(i) == "profile_list") | ||
transformReference(fvValue(i)); | ||
fvVector.emplace_back(fvField(i), fvValue(i)); | ||
SWSS_LOG_INFO("Inserting field %s value %s", fvField(i).c_str(), fvValue(i).c_str()); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
transformSeperator which is called in L269 can be removed as well. There is no separator now.
The function
transformSeperator
andtransformReference
can be removed as they are no longer calledThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
transformSeperator is used to convert from config_db to app_db