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

@@ -3,6 +3,15 @@
#include "kafka.h"
#include "sf_metrics.h"
uuid_t rule_uuid1;
uuid_t rule_uuid2;
uuid_t sff_uuid1;
uuid_t sff_uuid2;
uuid_t sf_uuid1;
uuid_t sf_uuid2;
#if 1
TEST(SF_METRICS, TEST1)
{
@@ -16,17 +25,17 @@ TEST(SF_METRICS, TEST1)
struct sf_metrics_key key1 = {0};
key1.vsys_id = 1;
key1.rule_id = 2;
key1.sff_profile_id = 3;
key1.sf_profile_id = 4;
uuid_copy(key1.rule_uuid, rule_uuid1);
uuid_copy(key1.sff_uuid, sff_uuid1);
uuid_copy(key1.sf_uuid, sf_uuid1);
struct sf_metrics_key key2 = {0};
key2.vsys_id = 4;
key2.rule_id = 3;
key2.sff_profile_id = 2;
key2.sf_profile_id = 1;
uuid_copy(key2.rule_uuid, rule_uuid2);
uuid_copy(key2.sff_uuid, sff_uuid2);
uuid_copy(key2.sf_uuid, sf_uuid2);
// thread 0
// uint64_t rx_pkts, uint64_t rx_bytes, uint64_t tx_pkts, uint64_t tx_bytes);
// rx_pkts, rx_bytes, tx_pkts, tx_bytes);
sf_metrics_input(metrics, thr_idx0, &key1, 1, 2, 2, 4);
sf_metrics_input(metrics, thr_idx0, &key2, 2, 4, 1, 2);
sf_metrics_output(metrics, thr_idx0);
@@ -62,17 +71,17 @@ TEST(SF_METRICS, TEST2)
struct sf_metrics_key key1 = {0};
key1.vsys_id = 1;
key1.rule_id = 2;
key1.sff_profile_id = 3;
key1.sf_profile_id = 4;
uuid_copy(key1.rule_uuid, rule_uuid1);
uuid_copy(key1.sff_uuid, sff_uuid1);
uuid_copy(key1.sf_uuid, sf_uuid1);
struct sf_metrics_key key2 = {0};
key2.vsys_id = 4;
key2.rule_id = 3;
key2.sff_profile_id = 2;
key2.sf_profile_id = 1;
uuid_copy(key2.rule_uuid, rule_uuid2);
uuid_copy(key2.sff_uuid, sff_uuid2);
uuid_copy(key2.sf_uuid, sf_uuid2);
// thread 0
// uint64_t rx_pkts, uint64_t rx_bytes, uint64_t tx_pkts, uint64_t tx_bytes);
// rx_pkts, rx_bytes, tx_pkts, tx_bytes);
sf_metrics_input(metrics, thr_idx0, &key1, 1, 2, 2, 4);
sf_metrics_input(metrics, thr_idx0, &key2, 2, 4, 1, 2);
sf_metrics_output(metrics, thr_idx0);
@@ -96,6 +105,15 @@ TEST(SF_METRICS, TEST2)
int main(int argc, char **argv)
{
uuid_parse("00000000-0000-0000-0000-000000000001", rule_uuid1);
uuid_parse("00000000-0000-0000-0000-000000000002", rule_uuid2);
uuid_parse("00000000-0000-0000-0000-000000000003", sff_uuid1);
uuid_parse("00000000-0000-0000-0000-000000000004", sff_uuid2);
uuid_parse("00000000-0000-0000-0000-000000000005", sf_uuid1);
uuid_parse("00000000-0000-0000-0000-000000000006", sf_uuid2);
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}