diff options
| author | liuxueli <[email protected]> | 2023-07-05 14:55:29 +0800 |
|---|---|---|
| committer | liuxueli <[email protected]> | 2023-07-05 14:55:29 +0800 |
| commit | 4237a4a970c521a1a1fc5b0543d343aa69b758b8 (patch) | |
| tree | bb016331f27c9e56197cd4fb073c66078a0a907b /test | |
| parent | 77c3005ca6d713ac21f8cca59413d6570b56454c (diff) | |
TSG-15514: ALLOW动作不支持多命中
Diffstat (limited to 'test')
| -rw-r--r-- | test/src/gtest_bridge.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/src/gtest_bridge.cpp b/test/src/gtest_bridge.cpp index a62a961..21579f6 100644 --- a/test/src/gtest_bridge.cpp +++ b/test/src/gtest_bridge.cpp @@ -849,6 +849,42 @@ TEST(TSGBridge, SessionSessionRuntimeAttributeSubscriberIDTSG15568) EXPECT_EQ(nullptr, srt_attribute_get_server_subscriber_id((const struct session_runtime_attribute *)srt_attribute_out)); } +TEST(TSGBridge, SessionMatchedRuleNotifyTSG15514) +{ + const struct streaminfo a_stream = {0}; + struct maat_rule matched_rules_1={15514, TSG_ACTION_BYPASS, TSG_SERVICE_SECURITY, 1, 0, 1}; + + session_matched_rules_notify(&a_stream, TSG_SERVICE_SECURITY, &matched_rules_1, 1, 0); + + struct matched_policy_rules *matched_rules_out=(struct matched_policy_rules *)session_matched_rules_get(&a_stream, TSG_SERVICE_SECURITY); + EXPECT_NE(nullptr, matched_rules_out); + EXPECT_EQ(1, matched_rules_out->n_rules); + EXPECT_EQ(15514, matched_rules_out->rules[0].rule_id); + EXPECT_EQ(TSG_ACTION_BYPASS, matched_rules_out->rules[0].action); + EXPECT_EQ(TSG_SERVICE_SECURITY, matched_rules_out->rules[0].service_id); + EXPECT_EQ(1, matched_rules_out->rules[0].vsys_id); + + struct maat_rule matched_rules_2={15514, TSG_ACTION_BYPASS, TSG_SERVICE_SECURITY, 1, 0, 1}; + session_matched_rules_notify(&a_stream, TSG_SERVICE_SECURITY, &matched_rules_2, 1, 0); + matched_rules_out=(struct matched_policy_rules *)session_matched_rules_get(&a_stream, TSG_SERVICE_SECURITY); + EXPECT_NE(nullptr, matched_rules_out); + EXPECT_EQ(1, matched_rules_out->n_rules); + EXPECT_EQ(15514, matched_rules_out->rules[0].rule_id); + EXPECT_EQ(TSG_ACTION_BYPASS, matched_rules_out->rules[0].action); + EXPECT_EQ(TSG_SERVICE_SECURITY, matched_rules_out->rules[0].service_id); + EXPECT_EQ(1, matched_rules_out->rules[0].vsys_id); + + struct maat_rule matched_rules_3={155145, TSG_ACTION_BYPASS, TSG_SERVICE_SECURITY, 1, 0, 1}; + session_matched_rules_notify(&a_stream, TSG_SERVICE_SECURITY, &matched_rules_3, 1, 0); + matched_rules_out=(struct matched_policy_rules *)session_matched_rules_get(&a_stream, TSG_SERVICE_SECURITY); + EXPECT_NE(nullptr, matched_rules_out); + EXPECT_EQ(1, matched_rules_out->n_rules); + EXPECT_EQ(15514, matched_rules_out->rules[0].rule_id); + EXPECT_EQ(TSG_ACTION_BYPASS, matched_rules_out->rules[0].action); + EXPECT_EQ(TSG_SERVICE_SECURITY, matched_rules_out->rules[0].service_id); + EXPECT_EQ(1, matched_rules_out->rules[0].vsys_id); +} + int main(int argc, char *argv[]) { int ret=tsg_bridge_init("tsgconf/main.conf"); |
