TSG-14599 tsg-service-chaining-engine支持新的Metrics结构
This commit is contained in:
@@ -7,12 +7,32 @@ target_include_directories(gtest_policy PUBLIC ${CMAKE_SOURCE_DIR}/common/includ
|
||||
target_include_directories(gtest_policy PUBLIC ${CMAKE_SOURCE_DIR}/platform/include)
|
||||
target_link_libraries(gtest_policy common platform gtest)
|
||||
|
||||
###############################################################################
|
||||
# gtest_sf_metrics
|
||||
###############################################################################
|
||||
|
||||
add_executable(gtest_sf_metrics gtest_sf_metrics.cpp)
|
||||
target_include_directories(gtest_sf_metrics PUBLIC ${CMAKE_SOURCE_DIR}/common/include)
|
||||
target_include_directories(gtest_sf_metrics PUBLIC ${CMAKE_SOURCE_DIR}/platform/include)
|
||||
target_link_libraries(gtest_sf_metrics common platform gtest)
|
||||
|
||||
###############################################################################
|
||||
# gtest_sf_status
|
||||
###############################################################################
|
||||
|
||||
add_executable(gtest_sf_status gtest_sf_status.cpp)
|
||||
target_include_directories(gtest_sf_status PUBLIC ${CMAKE_SOURCE_DIR}/common/include)
|
||||
target_include_directories(gtest_sf_status PUBLIC ${CMAKE_SOURCE_DIR}/platform/include)
|
||||
target_link_libraries(gtest_sf_status common platform gtest)
|
||||
|
||||
###############################################################################
|
||||
# gtest_discover_tests
|
||||
###############################################################################
|
||||
|
||||
include(GoogleTest)
|
||||
gtest_discover_tests(gtest_policy)
|
||||
gtest_discover_tests(gtest_sf_metrics)
|
||||
gtest_discover_tests(gtest_sf_status)
|
||||
|
||||
file(COPY ./test_resource/ DESTINATION ./test_resource/)
|
||||
file(COPY ${CMAKE_SOURCE_DIR}/resource/table_info.conf DESTINATION ./test_resource/)
|
||||
18
platform/test/gtest_sf_metrics.cpp
Normal file
18
platform/test/gtest_sf_metrics.cpp
Normal file
@@ -0,0 +1,18 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "sf_metrics.h"
|
||||
|
||||
TEST(SF_METRICS, TEST)
|
||||
{
|
||||
struct sf_metrics *metrics = sf_metrics_create("./test_resource/sce.conf");
|
||||
EXPECT_TRUE(sf_metrics_get_interval(metrics) == 1);
|
||||
sf_metrics_inc(metrics, 1, 2, 3, 4, 5, 6, 7);
|
||||
sf_metrics_send(metrics);
|
||||
sf_metrics_destory(metrics);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
19
platform/test/gtest_sf_status.cpp
Normal file
19
platform/test/gtest_sf_status.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "sf_status.h"
|
||||
|
||||
TEST(SF_STATUS, TEST)
|
||||
{
|
||||
struct sf_status *status = sf_status_create("./test_resource/sce.conf");
|
||||
EXPECT_TRUE(sf_status_get_interval(status) == 1);
|
||||
sf_status_update(status, 1, 0, 0);
|
||||
sf_status_update(status, 2, 1, 1);
|
||||
sf_status_send(status);
|
||||
sf_status_destory(status);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
@@ -23,6 +23,13 @@ redis_db_idx=0
|
||||
redis_server=127.0.0.1
|
||||
redis_port_range=6379
|
||||
|
||||
[metrics]
|
||||
# Kafka Topic: POLICY-RULE-METRICS
|
||||
enable=1
|
||||
interval_s=1
|
||||
telegraf_bind_address=127.0.0.1
|
||||
telegraf_listen_port=8300
|
||||
|
||||
[bfdd]
|
||||
path=/var/run/frr/bfdd.vty
|
||||
device=eth0
|
||||
|
||||
Reference in New Issue
Block a user