refactor packet IO, rename dumpfile mode to pcap mode, modify related configuration
This commit is contained in:
@@ -3,15 +3,13 @@ snowflake_base = 1 # [0, 31]
|
||||
snowflake_offset = 2 # [0, 127]
|
||||
|
||||
[packet_io]
|
||||
mode = "dumpfile" # dumpfile, dumpfilelist, marsio
|
||||
mode = "pcapfile" # pcapfile, pcaplist, marsio
|
||||
app_symbol = "stellar"
|
||||
dev_symbol = "nf_0_fw"
|
||||
|
||||
dumpfile_path = "./pcap/test.pcap"
|
||||
#dumpfile_path = "/tmp/dumpfile/dumpfilelist"
|
||||
|
||||
nr_worker_thread = 1 # [1, 256]
|
||||
pcap_path = "./pcap/test.pcap"
|
||||
nr_worker_thread = 1 # range: [1, 256]
|
||||
cpu_mask = [5, 6, 7, 8, 9, 10, 11, 12]
|
||||
idle_yield_interval_ms = 900 # range: [0, 60000] (ms)
|
||||
|
||||
[ip_reassembly]
|
||||
enable = 1
|
||||
@@ -67,5 +65,3 @@ tcp_reassembly_max_segments = 256 # range: [2, 4096]
|
||||
[schedule]
|
||||
merge_stat_interval = 50 # range: [1, 60000] (ms)
|
||||
output_stat_interval = 10 # range: [1, 60000] (ms)
|
||||
|
||||
packet_io_yield_interval = 90 # range: [1, 60000] (ms)
|
||||
|
||||
@@ -23,8 +23,8 @@ add_test(NAME ${TEST_NAME}.SETUP COMMAND sh -c "
|
||||
cp ${CMAKE_CURRENT_SOURCE_DIR}/test_config/spec.toml ${CMAKE_CURRENT_BINARY_DIR}/plugin/ &&
|
||||
cp ${CMAKE_SOURCE_DIR}/conf/log.toml ${CMAKE_CURRENT_BINARY_DIR}/conf/ &&
|
||||
cp ${CMAKE_CURRENT_SOURCE_DIR}/test_config/tsg_l7_protocol.conf ${CMAKE_CURRENT_BINARY_DIR}/tsgconf/ &&
|
||||
tomlq -t -i '.packet_io.dumpfile_path=\"-\"' ${CMAKE_CURRENT_BINARY_DIR}/conf/stellar.toml &&
|
||||
tomlq -t -i '.packet_io.mode=\"dumpfilelist\"' ${CMAKE_CURRENT_BINARY_DIR}/conf/stellar.toml
|
||||
tomlq -t -i '.packet_io.pcap_path=\"-\"' ${CMAKE_CURRENT_BINARY_DIR}/conf/stellar.toml &&
|
||||
tomlq -t -i '.packet_io.mode=\"pcaplist\"' ${CMAKE_CURRENT_BINARY_DIR}/conf/stellar.toml
|
||||
")
|
||||
|
||||
|
||||
|
||||
@@ -3,15 +3,13 @@ snowflake_base = 1 # [0, 31]
|
||||
snowflake_offset = 2 # [0, 127]
|
||||
|
||||
[packet_io]
|
||||
mode = "dumpfile" # dumpfile, dumpfilelist, marsio
|
||||
mode = "pcapfile" # pcapfile, pcaplist, marsio
|
||||
app_symbol = "stellar"
|
||||
dev_symbol = "nf_0_fw"
|
||||
|
||||
dumpfile_path = "/tmp/dumpfile/dumpfile.pcap"
|
||||
#dumpfile_path = "/tmp/dumpfile/dumpfilelist"
|
||||
|
||||
nr_worker_thread = 1 # [1, 256]
|
||||
pcap_path = "/tmp/test.pcap"
|
||||
nr_worker_thread = 1 # range: [1, 256]
|
||||
cpu_mask = [5]
|
||||
idle_yield_interval_ms = 900 # range: [0, 60000] (ms)
|
||||
|
||||
[ip_reassembly]
|
||||
enable = 1
|
||||
@@ -67,5 +65,3 @@ tcp_reassembly_max_segments = 128 # range: [2, 4096]
|
||||
[schedule]
|
||||
merge_stat_interval = 50 # range: [1, 60000] (ms)
|
||||
output_stat_interval = 2000 # range: [1, 60000] (ms)
|
||||
|
||||
packet_io_yield_interval = 900 # range: [1, 60000] (ms)
|
||||
|
||||
@@ -145,8 +145,8 @@ static inline void expect_cmp_inject(const char *expect_pcap_file, const char *i
|
||||
static inline void packet_inject_test(struct packet_inject_case *test)
|
||||
{
|
||||
// create directory
|
||||
char dumpfile_path[PATH_MAX] = {0};
|
||||
snprintf(dumpfile_path, sizeof(dumpfile_path), "%s/input/%s", test->work_dir, test->input_pcap);
|
||||
char pcap_path[PATH_MAX] = {0};
|
||||
snprintf(pcap_path, sizeof(pcap_path), "%s/input/%s", test->work_dir, test->input_pcap);
|
||||
system_cmd("rm -rf %s", test->work_dir);
|
||||
system_cmd("mkdir -p %s/input/", test->work_dir);
|
||||
system_cmd("mkdir -p %s/log/", test->work_dir);
|
||||
@@ -173,9 +173,9 @@ static inline void packet_inject_test(struct packet_inject_case *test)
|
||||
char temp[PATH_MAX * 2] = {0};
|
||||
getcwd(cwd, sizeof(cwd));
|
||||
chdir(test->work_dir);
|
||||
snprintf(temp, sizeof(temp), "dumpfile_path = \"%s\"", dumpfile_path);
|
||||
EXPECT_TRUE(replace_file_string("./conf/stellar.toml", "mode = marsio", "mode = dumpfile") == 0);
|
||||
EXPECT_TRUE(replace_file_string("./conf/stellar.toml", "dumpfile_path = \"/tmp/dumpfile/dumpfile.pcap\"", temp) == 0);
|
||||
snprintf(temp, sizeof(temp), "pcap_path = \"%s\"", pcap_path);
|
||||
EXPECT_TRUE(replace_file_string("./conf/stellar.toml", "mode = marsio", "mode = pcapfile") == 0);
|
||||
EXPECT_TRUE(replace_file_string("./conf/stellar.toml", "pcap_path = \"/tmp/test.pcap\"", temp) == 0);
|
||||
|
||||
const char *stellar_cfg_file = "./conf/stellar.toml";
|
||||
const char *plugin_cfg_file = "./plugin/spec.toml";
|
||||
|
||||
Reference in New Issue
Block a user