summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author刘畅 <[email protected]>2024-03-26 07:20:36 +0000
committer刘畅 <[email protected]>2024-03-26 07:20:36 +0000
commitd2f6b74c4f45174db833245df520dd657eb82f01 (patch)
treec07935eb24825223f5c861f725de6fa8d81fcd45
parent2d8e693acbfa5497721cfeb53e93e5382d85ea28 (diff)
parent41825df451d3ccc1b8129bac03e16e47ebd602c8 (diff)
Merge branch 'adapt_profile_aqm_CM_config_change' into 'rel'
Shaping Profile AQM删除enbaled开关,增加none选项值 See merge request tango/shaping-engine!85
-rw-r--r--shaping/src/shaper_maat.cpp29
-rw-r--r--shaping/test/gtest_shaper_maat.cpp2
2 files changed, 14 insertions, 17 deletions
diff --git a/shaping/src/shaper_maat.cpp b/shaping/src/shaper_maat.cpp
index 9def069..cac0d3d 100644
--- a/shaping/src/shaper_maat.cpp
+++ b/shaping/src/shaper_maat.cpp
@@ -257,26 +257,23 @@ void shaper_profile_ex_new(const char *table_name, int table_id, const char *key
goto END;
}
- tmp_obj = cJSON_GetObjectItem(json, "enabled");
+
+ tmp_obj = cJSON_GetObjectItem(json, "algorithm");
if (!tmp_obj) {
- LOG_ERROR("%s: json parse aqm enabled failed for profile id %d, line %s", LOG_TAG_MAAT, s_pf->id, table_line);
+ LOG_ERROR("%s: json parse algorithm failed for profile id %d, line %s", LOG_TAG_MAAT, s_pf->id, table_line);
goto END;
}
- if (tmp_obj->valueint == 1) {
- tmp_obj = cJSON_GetObjectItem(json, "algorithm");
- if (!tmp_obj) {
- LOG_ERROR("%s: json parse algorithm failed for profile id %d, line %s", LOG_TAG_MAAT, s_pf->id, table_line);
- goto END;
- }
- if (strncmp(tmp_obj->valuestring, "blue", strlen(tmp_obj->valuestring)) == 0) {
- s_pf->aqm_type = AQM_TYPE_BLUE;
- } else if (strncmp(tmp_obj->valuestring, "codel", strlen(tmp_obj->valuestring)) == 0) {
- s_pf->aqm_type = AQM_TYPE_CODEL;
- } else {
- LOG_ERROR("%s: json parse aqm type wrong for profile id %d, line %s", LOG_TAG_MAAT, s_pf->id, table_line);
- goto END;
- }
+ if (strncmp(tmp_obj->valuestring, "none", strlen(tmp_obj->valuestring)) == 0) {
+ s_pf->aqm_type = AQM_TYPE_NONE;
+ } else if (strncmp(tmp_obj->valuestring, "blue", strlen(tmp_obj->valuestring)) == 0) {
+ s_pf->aqm_type = AQM_TYPE_BLUE;
+ } else if (strncmp(tmp_obj->valuestring, "codel", strlen(tmp_obj->valuestring)) == 0) {
+ s_pf->aqm_type = AQM_TYPE_CODEL;
+ } else {
+ LOG_ERROR("%s: json parse aqm type wrong for profile id %d, line %s", LOG_TAG_MAAT, s_pf->id, table_line);
+ goto END;
}
+
cJSON_Delete(json);
//parse limits of profile
diff --git a/shaping/test/gtest_shaper_maat.cpp b/shaping/test/gtest_shaper_maat.cpp
index 96071e2..3b619fc 100644
--- a/shaping/test/gtest_shaper_maat.cpp
+++ b/shaping/test/gtest_shaper_maat.cpp
@@ -44,7 +44,7 @@ TEST(shaping_profile, parse)
fair_share\t\
max_min_host_fairness\t\
[{\"direction\":\"incoming\",\"bandwidth\":1024},{\"direction\":\"outgoing\",\"bandwidth\":2048}]\t\
- {\"enabled\":1,\"algorithm\":\"codel\"}\t\
+ {\"algorithm\":\"codel\"}\t\
{}\t\
1";
struct shaping_profile *s_pf = NULL;