From 3fe1afd0de1fd7c167d89ca75702e4627357ef5e Mon Sep 17 00:00:00 2001 From: Juergen Gehring Date: Tue, 22 May 2018 02:56:42 -0700 Subject: vsomeip 2.10.14 --- test/CMakeLists.txt | 32 +++- .../pending_subscription_test_master_starter.sh.in | 2 +- .../pending_subscription_test_globals.hpp | 3 +- .../pending_subscription_test_sd_msg_sender.cpp | 208 +++++++++++++++++++++ .../pending_subscription_test_service.cpp | 28 ++- ..._test_diff_client_ids_diff_ports_master.json.in | 30 ++- ...t_diff_client_ids_diff_ports_master_tcp.json.in | 33 +--- ...t_diff_client_ids_diff_ports_master_udp.json.in | 65 +++++++ ...e_test_diff_client_ids_diff_ports_slave.json.in | 30 ++- ...st_diff_client_ids_diff_ports_slave_tcp.json.in | 33 +--- ...st_diff_client_ids_diff_ports_slave_udp.json.in | 65 +++++++ .../subscribe_notify_one_test_service.cpp | 2 +- 12 files changed, 459 insertions(+), 72 deletions(-) create mode 100644 test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_master_udp.json.in create mode 100644 test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_slave_udp.json.in (limited to 'test') diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index fd70df6..6f04888 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1615,6 +1615,30 @@ if(NOT ${TESTS_BAT}) ${TEST_SUBSCRIBE_NOTIFY_ONE_SERVICE} ) + set(TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE + ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_master_udp.json) + configure_file( + ${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/conf/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE}.in + ${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE} + @ONLY) + copy_to_builddir( + ${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE} + ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE} + ${TEST_SUBSCRIBE_NOTIFY_ONE_SERVICE} + ) + + set(TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_CONFIG_FILE + ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_slave_udp.json) + configure_file( + ${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/conf/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_CONFIG_FILE}.in + ${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_CONFIG_FILE} + @ONLY) + copy_to_builddir( + ${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_CONFIG_FILE} + ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_SLAVE_UDP_CONFIG_FILE} + ${TEST_SUBSCRIBE_NOTIFY_ONE_SERVICE} + ) + # copy starter scripts into builddir set(TEST_SUBSCRIBE_NOTIFY_ONE_MASTER_STARTER ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_master_starter.sh) copy_to_builddir(${PROJECT_SOURCE_DIR}/test/subscribe_notify_one_tests/${TEST_SUBSCRIBE_NOTIFY_ONE_MASTER_STARTER} @@ -2606,7 +2630,7 @@ if(NOT ${TESTS_BAT}) # subscribe notify one id tests add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_udp - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_MASTER_STARTER} UDP ${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}) + COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_MASTER_STARTER} UDP ${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_UDP_CONFIG_FILE}) set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_udp PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_tcp @@ -2614,7 +2638,7 @@ if(NOT ${TESTS_BAT}) set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_tcp PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_both_tcp_and_udp - COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_MASTER_STARTER} TCP_AND_UDP ${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_TCP_CONFIG_FILE}) + COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_SUBSCRIBE_NOTIFY_ONE_MASTER_STARTER} TCP_AND_UDP ${TEST_SUBSCRIBE_NOTIFY_ONE_DIFF_IDS_DIFF_PORTS_MASTER_CONFIG_FILE}) set_tests_properties(${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_both_tcp_and_udp PROPERTIES TIMEOUT 120) add_test(NAME ${TEST_SUBSCRIBE_NOTIFY_ONE_NAME}_diff_client_ids_diff_ports_prefer_udp @@ -2820,6 +2844,10 @@ if(NOT ${TESTS_BAT}) COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_PENDING_SUBSCRIPTION_MASTER_STARTER} SUBSCRIBE_UNSUBSCRIBE_NACK) set_tests_properties(${TEST_PENDING_SUBSCRIPTION_NAME}_alternating_subscribe_unsubscribe_nack PROPERTIES TIMEOUT 180) + add_test(NAME ${TEST_PENDING_SUBSCRIPTION_NAME}_alternating_subscribe_unsubscribe_same_port + COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_PENDING_SUBSCRIPTION_MASTER_STARTER} SUBSCRIBE_UNSUBSCRIBE_SAME_PORT) + set_tests_properties(${TEST_PENDING_SUBSCRIPTION_NAME}_alternating_subscribe_unsubscribe_same_port PROPERTIES TIMEOUT 180) + # malicious data test add_test(NAME ${TEST_MALICIOUS_DATA_NAME} COMMAND ${PROJECT_BINARY_DIR}/test/${TEST_MALICIOUS_DATA_MASTER_STARTER}) diff --git a/test/pending_subscription_tests/conf/pending_subscription_test_master_starter.sh.in b/test/pending_subscription_tests/conf/pending_subscription_test_master_starter.sh.in index 0a3dd17..3a5001c 100755 --- a/test/pending_subscription_tests/conf/pending_subscription_test_master_starter.sh.in +++ b/test/pending_subscription_tests/conf/pending_subscription_test_master_starter.sh.in @@ -17,7 +17,7 @@ then echo "Please pass a test mode to this script." echo "For example: $0 SUSCRIBE" echo "Valid subscription types include:" - echo " [SUBSCRIBE, SUBSCRIBE_UNSUBSCRIBE, UNSUBSCRIBE, SUBSCRIBE_UNSUBSCRIBE_NACK]" + echo " [SUBSCRIBE, SUBSCRIBE_UNSUBSCRIBE, UNSUBSCRIBE, SUBSCRIBE_UNSUBSCRIBE_NACK, SUBSCRIBE_UNSUBSCRIBE_SAME_PORT]" exit 1 fi TESTMODE=$1 diff --git a/test/pending_subscription_tests/pending_subscription_test_globals.hpp b/test/pending_subscription_tests/pending_subscription_test_globals.hpp index 8daf91a..2bc1322 100644 --- a/test/pending_subscription_tests/pending_subscription_test_globals.hpp +++ b/test/pending_subscription_tests/pending_subscription_test_globals.hpp @@ -24,7 +24,8 @@ enum test_mode_e { SUBSCRIBE, SUBSCRIBE_UNSUBSCRIBE, UNSUBSCRIBE, - SUBSCRIBE_UNSUBSCRIBE_NACK + SUBSCRIBE_UNSUBSCRIBE_NACK, + SUBSCRIBE_UNSUBSCRIBE_SAME_PORT }; } diff --git a/test/pending_subscription_tests/pending_subscription_test_sd_msg_sender.cpp b/test/pending_subscription_tests/pending_subscription_test_sd_msg_sender.cpp index b5325ab..c9e686d 100644 --- a/test/pending_subscription_tests/pending_subscription_test_sd_msg_sender.cpp +++ b/test/pending_subscription_tests/pending_subscription_test_sd_msg_sender.cpp @@ -799,6 +799,212 @@ TEST_F(pending_subscription, send_alternating_subscribe_nack_unsubscribe) receive_thread.join(); } +TEST_F(pending_subscription, send_alternating_subscribe_unsubscribe_same_port) +{ + std::promise trigger_notifications; + std::promise tcp_connected; + boost::asio::ip::udp::socket udp_socket(io_, + boost::asio::ip::udp::endpoint(boost::asio::ip::udp::v4(), 30490)); + boost::asio::ip::tcp::socket tcp_socket(io_, + boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), 30490)); + std::thread receive_thread([&](){ + const std::uint32_t expected_acks(8); + std::atomic acks_received(0); + + const std::uint32_t expected_responses(1); + std::atomic responses_received(0); + + const std::uint32_t expected_notifications(2); + std::atomic notifications_received(0); + + bool triggered_notifications(false); + + std::function receive; + std::vector receive_buffer(4096); + std::vector its_received_events; + + boost::system::error_code ec; + tcp_socket.connect(boost::asio::ip::tcp::endpoint( + boost::asio::ip::address::from_string(remote_address), 40001), ec); + ASSERT_EQ(0, ec.value()); + tcp_connected.set_value(); + + const std::function receive_cbk = [&]( + const boost::system::error_code& error, std::size_t bytes_transferred) { + if (error) { + acks_received = expected_acks; + responses_received = expected_responses; + ADD_FAILURE() << __func__ << " error: " << error.message(); + return; + } + #if 0 + std::stringstream str; + for (size_t i = 0; i < bytes_transferred; i++) { + str << std::hex << std::setw(2) << std::setfill('0') << std::uint32_t(receive_buffer[i]) << " "; + } + std::cout << __func__ << " received: " << std::dec << bytes_transferred << " bytes: " << str.str() << std::endl; + #endif + + vsomeip::deserializer its_deserializer(&receive_buffer[0], bytes_transferred, 0); + vsomeip::service_t its_service = VSOMEIP_BYTES_TO_WORD(receive_buffer[VSOMEIP_SERVICE_POS_MIN], + receive_buffer[VSOMEIP_SERVICE_POS_MAX]); + vsomeip::method_t its_method = VSOMEIP_BYTES_TO_WORD(receive_buffer[VSOMEIP_METHOD_POS_MIN], + receive_buffer[VSOMEIP_METHOD_POS_MAX]); + if (its_service == vsomeip::sd::service && its_method == vsomeip::sd::method) { + vsomeip::sd::message_impl sd_msg; + EXPECT_TRUE(sd_msg.deserialize(&its_deserializer)); + EXPECT_EQ(2u, sd_msg.get_entries().size()); + for (auto e : sd_msg.get_entries()) { + EXPECT_TRUE(e->is_eventgroup_entry()); + EXPECT_EQ(vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK, e->get_type()); + EXPECT_EQ(16u, e->get_ttl()); + EXPECT_EQ(pending_subscription_test::service.service_id, e->get_service()); + EXPECT_EQ(pending_subscription_test::service.instance_id, e->get_instance()); + if (e->get_type() == vsomeip::sd::entry_type_e::SUBSCRIBE_EVENTGROUP_ACK) { + std::shared_ptr its_casted_entry = + std::static_pointer_cast(e); + EXPECT_TRUE(its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id || + its_casted_entry->get_eventgroup() == pending_subscription_test::service.eventgroup_id+1); + } + } + EXPECT_EQ(0u, sd_msg.get_options().size()); + acks_received++; + } else { // non-sd-message + vsomeip::message_impl msg; + EXPECT_TRUE(msg.deserialize(&its_deserializer)); + if (msg.get_message_type() == vsomeip::message_type_e::MT_RESPONSE) { + EXPECT_EQ(vsomeip::message_type_e::MT_RESPONSE, msg.get_message_type()); + EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service()); + EXPECT_EQ(pending_subscription_test::service.shutdown_method_id, msg.get_method()); + EXPECT_EQ(0x2222, msg.get_client()); + responses_received++; + } else if (msg.get_message_type() == vsomeip::message_type_e::MT_NOTIFICATION) { + its_received_events.push_back(msg.get_method()); + if (its_received_events.size() == 2) { + EXPECT_EQ(pending_subscription_test::service.event_id, its_received_events[0]); + EXPECT_EQ(static_cast(pending_subscription_test::service.event_id + 1u), its_received_events[1]); + } + EXPECT_EQ(1u, msg.get_payload()->get_length()); + EXPECT_EQ(0xDD, *msg.get_payload()->get_data()); + EXPECT_EQ(pending_subscription_test::service.service_id, msg.get_service()); + EXPECT_EQ(0x0, msg.get_client()); + notifications_received++; + } + } + + + if (!triggered_notifications && acks_received == expected_acks) { // all subscribeAcks received + trigger_notifications.set_value(true); + triggered_notifications = true; + } + + if (!error && (acks_received != expected_acks || + responses_received != expected_responses || + notifications_received != expected_notifications)) { + receive(); + } + }; + + receive = [&]() { + udp_socket.async_receive(boost::asio::buffer(receive_buffer, receive_buffer.capacity()), + receive_cbk); + }; + + receive(); + while(acks_received < expected_acks || + responses_received < expected_responses || + notifications_received < expected_notifications) { + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + } + EXPECT_EQ(expected_acks, acks_received); + EXPECT_EQ(expected_responses, responses_received); + EXPECT_EQ(expected_notifications, notifications_received); + }); + + std::thread send_thread([&]() { + if (std::future_status::timeout == tcp_connected.get_future().wait_for(std::chrono::seconds(10))) { + ADD_FAILURE() << "Didn't establish tcp connection within time"; + } + + try { + std::uint8_t its_offer_service_message[] = { + 0xff, 0xff, 0x81, 0x00, + 0x00, 0x00, 0x00, 0x4C, // length + 0x00, 0x00, 0x00, 0x01, + 0x01, 0x01, 0x02, 0x00, + 0xc0, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x20, // length entries array + 0x06, 0x00, 0x00, 0x20, + 0x11, 0x22, 0x00, 0x01, // service / instance + 0x00, 0x00, 0x00, 0x10, // 16 seconds TTL + 0x00, 0x00, 0x10, 0x00, // eventgroup + 0x06, 0x00, 0x00, 0x20, + 0x11, 0x22, 0x00, 0x01, // service / instance + 0x00, 0x00, 0x00, 0x10, // 16 seconds TTL + 0x00, 0x00, 0x10, 0x01, // eventgroup 2 + 0x00, 0x00, 0x00, 0x18, // length options array + 0x00, 0x09, 0x04, 0x00, + 0xff, 0xff, 0xff, 0xff, // ip address + 0x00, 0x11, 0x77, 0x1a, + 0x00, 0x09, 0x04, 0x00, + 0xff, 0xff, 0xff, 0xff, // ip address + 0x00, 0x06, 0x77, 0x1a + }; + + boost::asio::ip::address its_local_address = + boost::asio::ip::address::from_string(std::string(local_address)); + std::memcpy(&its_offer_service_message[64], &its_local_address.to_v4().to_bytes()[0], 4); + std::memcpy(&its_offer_service_message[76], &its_local_address.to_v4().to_bytes()[0], 4); + + boost::asio::ip::udp::socket::endpoint_type target_sd( + boost::asio::ip::address::from_string(std::string(remote_address)), + 30490); + for (int var = 0; var < 15; ++var) { + udp_socket.send_to(boost::asio::buffer(its_offer_service_message), target_sd); + ++its_offer_service_message[11]; + if (its_offer_service_message[11] % 2) { + its_offer_service_message[35] = 16; + its_offer_service_message[51] = 16; + } else { + its_offer_service_message[35] = 0; + its_offer_service_message[51] = 0; + } + } + + if (std::future_status::timeout == trigger_notifications.get_future().wait_for(std::chrono::seconds(10))) { + ADD_FAILURE() << "Didn't receive all SubscribeAcks within time"; + } else { + // call notify method + std::uint8_t trigger_notifications_call[] = { + 0x11, 0x22, 0x42, 0x42, + 0x00, 0x00, 0x00, 0x08, + 0x22, 0x22, 0x00, 0x01, + 0x01, 0x00, 0x01, 0x00 }; + boost::asio::ip::udp::socket::endpoint_type target_service( + boost::asio::ip::address::from_string(std::string(remote_address)), + 30001); + udp_socket.send_to(boost::asio::buffer(trigger_notifications_call), target_service); + } + + // call shutdown method + std::uint8_t shutdown_call[] = { + 0x11, 0x22, 0x14, 0x04, + 0x00, 0x00, 0x00, 0x08, + 0x22, 0x22, 0x00, 0x01, + 0x01, 0x00, 0x00, 0x00 }; + boost::asio::ip::udp::socket::endpoint_type target_service( + boost::asio::ip::address::from_string(std::string(remote_address)), + 30001); + udp_socket.send_to(boost::asio::buffer(shutdown_call), target_service); + } catch (...) { + ASSERT_FALSE(true); + } + + }); + + send_thread.join(); + receive_thread.join(); +} #ifndef _WIN32 int main(int argc, char** argv) { @@ -820,6 +1026,8 @@ int main(int argc, char** argv) { ::testing::GTEST_FLAG(filter) = "*send_multiple_unsubscriptions"; } else if (its_testmode == std::string("SUBSCRIBE_UNSUBSCRIBE_NACK")) { ::testing::GTEST_FLAG(filter) = "*send_alternating_subscribe_nack_unsubscribe"; + } else if (its_testmode == std::string("SUBSCRIBE_UNSUBSCRIBE_SAME_PORT")) { + ::testing::GTEST_FLAG(filter) = "*send_alternating_subscribe_unsubscribe_same_port"; } return RUN_ALL_TESTS(); } diff --git a/test/pending_subscription_tests/pending_subscription_test_service.cpp b/test/pending_subscription_tests/pending_subscription_test_service.cpp index 00434f3..0e4878a 100644 --- a/test/pending_subscription_tests/pending_subscription_test_service.cpp +++ b/test/pending_subscription_tests/pending_subscription_test_service.cpp @@ -144,6 +144,8 @@ public: ; } else if (testmode_ == pending_subscription_test::test_mode_e::SUBSCRIBE_UNSUBSCRIBE_NACK) { ; + } else if (testmode_ == pending_subscription_test::test_mode_e::SUBSCRIBE_UNSUBSCRIBE_SAME_PORT) { + ; } std::future itsFuture = notify_method_called_.get_future(); if (std::future_status::timeout == itsFuture.wait_for(std::chrono::seconds(10))) { @@ -205,6 +207,17 @@ public: if (count_subscribe == 8 || count_unsubscribe == 7) { subscription_accepted_asynchronous_ = true; } + } else if (testmode_ == pending_subscription_test::test_mode_e::SUBSCRIBE_UNSUBSCRIBE_SAME_PORT) { + static int count_subscribe = 0; + static int count_unsubscribe = 0; + _subscribed ? count_subscribe++ : count_unsubscribe++; + if (count_subscribe == 1) { + std::this_thread::sleep_for(std::chrono::milliseconds(500)); + } + _cbk(true); + if (count_subscribe == 16 || count_unsubscribe == 14) { + subscription_accepted_asynchronous_ = true; + } } } @@ -256,6 +269,17 @@ public: } else { ret = true; } + } else if (testmode_ == pending_subscription_test::test_mode_e::SUBSCRIBE_UNSUBSCRIBE_SAME_PORT) { + static int count_subscribed = 0; + static int count_unsubscribe = 0; + _subscribed ? count_subscribed++ : count_unsubscribe++; + if (count_subscribed == 1) { + std::this_thread::sleep_for(std::chrono::milliseconds(500)); + } + if (count_subscribed == 16 && count_unsubscribe == 14) { + subscription_accepted_synchronous_ = true; + } + ret = true; } return ret; } @@ -291,7 +315,7 @@ int main(int argc, char** argv) if (argc < 2) { std::cerr << "Please pass a test mode to this binary like: " << argv[0] << " SUBSCRIBE" << std::endl; - std::cerr << "Testmodes are [SUBSCRIBE, SUBSCRIBE_UNSUBSCRIBE, UNSUBSCRIBE]" << std::endl; + std::cerr << "Testmodes are [SUBSCRIBE, SUBSCRIBE_UNSUBSCRIBE, UNSUBSCRIBE, SUBSCRIBE_UNSUBSCRIBE_NACK, SUBSCRIBE_UNSUBSCRIBE_SAME_PORT]" << std::endl; exit(1); } @@ -304,6 +328,8 @@ int main(int argc, char** argv) its_testmode = pending_subscription_test::test_mode_e::UNSUBSCRIBE; } else if (its_pased_testmode == std::string("SUBSCRIBE_UNSUBSCRIBE_NACK")) { its_testmode = pending_subscription_test::test_mode_e::SUBSCRIBE_UNSUBSCRIBE_NACK; + } else if (its_pased_testmode == std::string("SUBSCRIBE_UNSUBSCRIBE_SAME_PORT")) { + its_testmode = pending_subscription_test::test_mode_e::SUBSCRIBE_UNSUBSCRIBE_SAME_PORT; } return RUN_ALL_TESTS(); diff --git a/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_master.json.in b/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_master.json.in index f3aa9de..26d9644 100644 --- a/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_master.json.in +++ b/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_master.json.in @@ -36,7 +36,15 @@ { "port":"40001", "enable-magic-cookies":"false" - } + }, + "events" : + [ + { + "event" : "0x1111", + "is_field" : "false", + "is_reliable" : "true" + } + ] }, { "service":"0x2222", @@ -46,7 +54,15 @@ { "port":"40002", "enable-magic-cookies":"false" - } + }, + "events" : + [ + { + "event" : "0x2222", + "is_field" : "false", + "is_reliable" : "true" + } + ] }, { "service":"0x3333", @@ -56,7 +72,15 @@ { "port":"40003", "enable-magic-cookies":"false" - } + }, + "events" : + [ + { + "event" : "0x3333", + "is_field" : "false", + "is_reliable" : "true" + } + ] } ], "routing":"subscribe_notify_one_test_service_one", diff --git a/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_master_tcp.json.in b/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_master_tcp.json.in index b684f56..7b4b606 100644 --- a/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_master_tcp.json.in +++ b/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_master_tcp.json.in @@ -31,56 +31,29 @@ { "service":"0x1111", "instance":"0x0001", - "unreliable":"30001", "reliable": { "port":"40001", "enable-magic-cookies":"false" - }, - "events" : - [ - { - "event" : "0x1111", - "is_field" : "true", - "is_reliable" : "true" - } - ] + } }, { "service":"0x2222", "instance":"0x0001", - "unreliable":"30002", "reliable": { "port":"40002", "enable-magic-cookies":"false" - }, - "events" : - [ - { - "event" : "0x2222", - "is_field" : "true", - "is_reliable" : "true" - } - ] + } }, { "service":"0x3333", "instance":"0x0001", - "unreliable":"30003", "reliable": { "port":"40003", "enable-magic-cookies":"false" - }, - "events" : - [ - { - "event" : "0x3333", - "is_field" : "true", - "is_reliable" : "true" - } - ] + } } ], "routing":"subscribe_notify_one_test_service_one", diff --git a/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_master_udp.json.in b/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_master_udp.json.in new file mode 100644 index 0000000..e5218b3 --- /dev/null +++ b/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_master_udp.json.in @@ -0,0 +1,65 @@ +{ + "unicast":"@TEST_IP_MASTER@", + "logging": + { + "level":"warning", + "console":"true", + "file": + { + "enable":"false", + "path":"/tmp/vsomeip.log" + }, + "dlt":"false" + }, + "applications": + [ + { + "name":"subscribe_notify_one_test_service_one", + "id":"0x1111" + }, + { + "name":"subscribe_notify_one_test_service_two", + "id":"0x2222" + }, + { + "name":"subscribe_notify_one_test_service_three", + "id":"0x3333" + } + ], + "services": + [ + { + "service":"0x1111", + "instance":"0x0001", + "unreliable":"30001" + }, + { + "service":"0x2222", + "instance":"0x0001", + "unreliable":"30002" + }, + { + "service":"0x3333", + "instance":"0x0001", + "unreliable":"30003" + } + ], + "routing":"subscribe_notify_one_test_service_one", + "service-discovery": + { + "enable":"true", + "multicast":"224.0.0.1", + "port":"30490", + "protocol":"udp", + "initial_delay_min" : "10", + "initial_delay_max" : "10", + "repetitions_base_delay" : "30", + "repetitions_max" : "3", + "cyclic_offer_delay" : "1000", + "ttl" : "3" + }, + "supports_selective_broadcasts" : + { + "address" : "@TEST_IP_SLAVE@" + } +} diff --git a/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_slave.json.in b/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_slave.json.in index c588106..a4283b9 100644 --- a/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_slave.json.in +++ b/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_slave.json.in @@ -36,7 +36,15 @@ { "port":"40004", "enable-magic-cookies":"false" - } + }, + "events" : + [ + { + "event" : "0x4444", + "is_field" : "false", + "is_reliable" : "true" + } + ] }, { "service":"0x5555", @@ -46,7 +54,15 @@ { "port":"40005", "enable-magic-cookies":"false" - } + }, + "events" : + [ + { + "event" : "0x5555", + "is_field" : "false", + "is_reliable" : "true" + } + ] }, { "service":"0x6666", @@ -56,7 +72,15 @@ { "port":"40006", "enable-magic-cookies":"false" - } + }, + "events" : + [ + { + "event" : "0x6666", + "is_field" : "false", + "is_reliable" : "true" + } + ] } ], "routing":"subscribe_notify_one_test_service_four", diff --git a/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_slave_tcp.json.in b/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_slave_tcp.json.in index dbe0635..1cb1feb 100644 --- a/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_slave_tcp.json.in +++ b/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_slave_tcp.json.in @@ -31,56 +31,29 @@ { "service":"0x4444", "instance":"0x0001", - "unreliable":"30004", "reliable": { "port":"40004", "enable-magic-cookies":"false" - }, - "events" : - [ - { - "event" : "0x4444", - "is_field" : "true", - "is_reliable" : "true" - } - ] + } }, { "service":"0x5555", "instance":"0x0001", - "unreliable":"30005", "reliable": { "port":"40005", "enable-magic-cookies":"false" - }, - "events" : - [ - { - "event" : "0x5555", - "is_field" : "true", - "is_reliable" : "true" - } - ] + } }, { "service":"0x6666", "instance":"0x0001", - "unreliable":"30006", "reliable": { "port":"40006", "enable-magic-cookies":"false" - }, - "events" : - [ - { - "event" : "0x6666", - "is_field" : "true", - "is_reliable" : "true" - } - ] + } } ], "routing":"subscribe_notify_one_test_service_four", diff --git a/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_slave_udp.json.in b/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_slave_udp.json.in new file mode 100644 index 0000000..138afae --- /dev/null +++ b/test/subscribe_notify_one_tests/conf/subscribe_notify_one_test_diff_client_ids_diff_ports_slave_udp.json.in @@ -0,0 +1,65 @@ +{ + "unicast":"@TEST_IP_SLAVE@", + "logging": + { + "level":"warning", + "console":"true", + "file": + { + "enable":"false", + "path":"/tmp/vsomeip.log" + }, + "dlt":"false" + }, + "applications": + [ + { + "name":"subscribe_notify_one_test_service_four", + "id":"0x4444" + }, + { + "name":"subscribe_notify_one_test_service_five", + "id":"0x5555" + }, + { + "name":"subscribe_notify_one_test_service_six", + "id":"0x6666" + } + ], + "services": + [ + { + "service":"0x4444", + "instance":"0x0001", + "unreliable":"30004" + }, + { + "service":"0x5555", + "instance":"0x0001", + "unreliable":"30005" + }, + { + "service":"0x6666", + "instance":"0x0001", + "unreliable":"30006" + } + ], + "routing":"subscribe_notify_one_test_service_four", + "service-discovery": + { + "enable":"true", + "multicast":"224.0.0.1", + "port":"30490", + "protocol":"udp", + "initial_delay_min" : "10", + "initial_delay_max" : "10", + "repetitions_base_delay" : "30", + "repetitions_max" : "3", + "cyclic_offer_delay" : "1000", + "ttl" : "3" + }, + "supports_selective_broadcasts" : + { + "address" : "@TEST_IP_MASTER@" + } +} diff --git a/test/subscribe_notify_one_tests/subscribe_notify_one_test_service.cpp b/test/subscribe_notify_one_tests/subscribe_notify_one_test_service.cpp index 5266648..73cfbed 100644 --- a/test/subscribe_notify_one_tests/subscribe_notify_one_test_service.cpp +++ b/test/subscribe_notify_one_tests/subscribe_notify_one_test_service.cpp @@ -237,7 +237,7 @@ public: case vsomeip::subscription_type_e::SU_PREFER_UNRELIABLE: case vsomeip::subscription_type_e::SU_PREFER_RELIABLE: case vsomeip::subscription_type_e::SU_RELIABLE_AND_UNRELIABLE: - if (all_notifications_received_tcp_and_udp()) { + if (all_notifications_received()) { notify = true; } break; -- cgit v1.2.1