TSG-22348 feature: adapt maat support UUID

This commit is contained in:
luwenpeng
2024-09-23 16:50:09 +08:00
parent 7ef8e44bca
commit 5799de5299
60 changed files with 2504 additions and 1043 deletions

View File

@@ -226,9 +226,9 @@ void sf_metrics_input(struct sf_metrics *handle, uint16_t thr_idx, struct sf_met
{
node = (struct metric *)calloc(1, sizeof(struct metric));
node->key.vsys_id = key->vsys_id;
node->key.rule_id = key->rule_id;
node->key.sff_profile_id = key->sff_profile_id;
node->key.sf_profile_id = key->sf_profile_id;
uuid_copy(node->key.rule_uuid, key->rule_uuid);
uuid_copy(node->key.sff_uuid, key->sff_uuid);
uuid_copy(node->key.sf_uuid, key->sf_uuid);
node->recv_pkts = rx_pkts;
node->recv_bytes = rx_bytes;
@@ -254,6 +254,9 @@ void sf_metrics_output(struct sf_metrics *handle, uint16_t thr_idx)
struct metric *temp = NULL;
struct metric *node = NULL;
char rule_uuid_str[UUID_STRING_SIZE] = {0};
char sff_uuid_str[UUID_STRING_SIZE] = {0};
char sf_uuid_str[UUID_STRING_SIZE] = {0};
HASH_ITER(hh, handle->root[thr_idx], node, temp)
{
if (node->sent_pkts == 0 && node->recv_pkts == 0 &&
@@ -262,11 +265,14 @@ void sf_metrics_output(struct sf_metrics *handle, uint16_t thr_idx)
continue;
}
uuid_unparse(node->key.rule_uuid, rule_uuid_str);
uuid_unparse(node->key.sff_uuid, sff_uuid_str);
uuid_unparse(node->key.sf_uuid, sf_uuid_str);
const struct field tags[] = {
{"vsys_id", FIELD_VALUE_INTEGER, {.value_longlong = node->key.vsys_id}},
{"rule_id", FIELD_VALUE_INTEGER, {.value_longlong = (long long)node->key.rule_id}},
{"sff_profile_id", FIELD_VALUE_INTEGER, {.value_longlong = node->key.sff_profile_id}},
{"sf_profile_id", FIELD_VALUE_INTEGER, {.value_longlong = node->key.sf_profile_id}},
{"rule_uuid", FIELD_VALUE_CSTRING, {.value_str = rule_uuid_str}},
{"sff_profile_uuid", FIELD_VALUE_CSTRING, {.value_str = sff_uuid_str}},
{"sf_profile_uuid", FIELD_VALUE_CSTRING, {.value_str = sf_uuid_str}},
};
fieldstat_easy_counter_incrby(handle->fs, thr_idx, handle->sent_pkts_idx, tags, sizeof(tags) / sizeof(tags[0]), node->sent_pkts);