Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve zeroconf discovery #710

Merged
merged 31 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a38a77a
Use the real hostname for remote service
xuzhenbao Nov 28, 2023
0a92022
Remove uuid in the service instance name
xuzhenbao Dec 1, 2023
28e775b
Add process ID to service instance name for easier debugging
xuzhenbao Dec 5, 2023
92ce33a
Resolve ip addresses and set it to endpoint description
xuzhenbao Dec 8, 2023
0705bf5
Resolve ip addresses and set it to endpoint description
xuzhenbao Dec 8, 2023
4fdeade
Add the interval time of endpoint watcher thead loop
xuzhenbao Dec 9, 2023
f92eb6c
Add the interval time of endpoint watcher thead loop
xuzhenbao Dec 10, 2023
73308d5
Remove the service resolved timeout mechanism, it is not necessary
xuzhenbao Dec 11, 2023
89e4dbc
Add retry cnt for DNSServiceGetAddrInfo
xuzhenbao Dec 11, 2023
f5e276e
Map the config type to mDNS service subtype and improve some code
xuzhenbao Dec 12, 2023
dbc603d
Improve discovery_zeroconf and its unit test
xuzhenbao Dec 18, 2023
f6cfb5e
Refresh remote service endpoint when RSA is removed
xuzhenbao Dec 20, 2023
9266360
Add remote.configs.supported property for RSA service,and add celix.r…
xuzhenbao Dec 20, 2023
3b06116
fix bugs for discovery_zeroconf
xuzhenbao Dec 25, 2023
ddcd91b
Add zeroconf configuration type for rsa_dfi
xuzhenbao Dec 25, 2023
ea552e5
Add zeroconf configuration type for rsa_dfi
xuzhenbao Dec 25, 2023
eedf073
Rename the configurations name of rsa_shm
xuzhenbao Dec 25, 2023
11c8fdc
Rename remote service bundles
xuzhenbao Dec 25, 2023
8100c7f
Fix bugs for discovery_zeroconf
xuzhenbao Dec 28, 2023
4736691
Fix unit test failure
xuzhenbao Dec 29, 2023
4de2144
Fix unit test failure
xuzhenbao Dec 29, 2023
1aecccc
Merge branch 'master' of https://github.com/xuzhenbao/celix into impr…
xuzhenbao Jan 1, 2024
768c5c7
Merge master
xuzhenbao Jan 1, 2024
356ec2b
Add CELIX_RSA prefix for constants of rsa_spi
xuzhenbao Jan 19, 2024
21b088f
Fix code based on code review
xuzhenbao Jan 19, 2024
e95dcef
Topology Manager implement dynamic IP mechanism
xuzhenbao Feb 2, 2024
66a3f10
Improve unit test of discovery_zeroconf
xuzhenbao Feb 4, 2024
2cb9b5c
Merge branch 'master' of https://github.com/xuzhenbao/celix into impr…
xuzhenbao Feb 4, 2024
ce4dc3b
Replace OSGI_RSA_ prefix to CELIX_RSA_
xuzhenbao Feb 4, 2024
8e14b97
Remove IPV6 server for RSA_DFI, because civetweb not support IPV6 in …
xuzhenbao Feb 4, 2024
e48e5ed
Improve CURL error code handling
xuzhenbao Feb 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ if (RSA_DISCOVERY_CONFIGURED)
VERSION 0.9.0
SYMBOLIC_NAME "apache_celix_rsa_discovery"
NAME "Apache Celix RSA Configured Discovery"
FILENAME celix_rsa_discovery_configured
PengZheng marked this conversation as resolved.
Show resolved Hide resolved
SOURCES
src/discovery_impl.c
)
Expand Down
1 change: 1 addition & 0 deletions bundles/remote_services/discovery_etcd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ if (RSA_DISCOVERY_ETCD)
SYMBOLIC_NAME "apache_celix_rsa_discovery_etcd"
NAME "Apache Celix RSA Discovery ETCD"
GROUP "Celix/RSA"
FILENAME celix_rsa_discovery_etcd
SOURCES
src/discovery_impl.c
src/etcd_watcher.c
Expand Down
5 changes: 4 additions & 1 deletion bundles/remote_services/discovery_zeroconf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,16 @@ if (RSA_DISCOVERY_ZEROCONF)

add_celix_bundle(rsa_discovery_zeroconf
SYMBOLIC_NAME "apache_celix_rsa_discovery_zeroconf"
VERSION "1.0.0"
VERSION "2.0.0"
NAME "Apache Celix Multicast zeroconf service discovery"
GROUP "Celix/RSA"
FILENAME celix_rsa_discovery_zeroconf
SOURCES
${RSA_DISCOVERY_ZEROCONF_SRC}
)

celix_deprecated_utils_headers(rsa_discovery_zeroconf)
celix_deprecated_framework_headers(rsa_discovery_zeroconf)

target_link_libraries(rsa_discovery_zeroconf PRIVATE ${RSA_DISCOVERY_ZEROCONF_DEPS})

Expand All @@ -58,6 +60,7 @@ if (RSA_DISCOVERY_ZEROCONF)
if (ENABLE_TESTING)
add_library(rsa_discovery_zeroconf_cut STATIC ${RSA_DISCOVERY_ZEROCONF_SRC})
celix_deprecated_utils_headers(rsa_discovery_zeroconf_cut)
celix_deprecated_framework_headers(rsa_discovery_zeroconf_cut)
target_include_directories(rsa_discovery_zeroconf_cut PUBLIC ${CMAKE_CURRENT_LIST_DIR}/src)
target_link_libraries(rsa_discovery_zeroconf_cut PUBLIC ${RSA_DISCOVERY_ZEROCONF_DEPS})
add_subdirectory(gtest)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ if (EI_TESTS)
)

celix_deprecated_utils_headers(unit_test_discovery_zeroconf)
celix_deprecated_framework_headers(unit_test_discovery_zeroconf)

target_link_libraries(unit_test_discovery_zeroconf PRIVATE
rsa_discovery_zeroconf_cut
Expand All @@ -58,6 +59,14 @@ if (EI_TESTS)
Celix::threads_ei
Celix::eventfd_ei
Celix::bundle_ctx_ei
Celix::string_hash_map_ei
Celix::long_hash_map_ei
Celix::array_list_ei
Celix::properties_ei
Celix::utils_ei
Celix::dm_component_ei
Celix::bundle_ctx_ei
Celix::log_helper_ei
Celix::mdnsresponder_ei
Celix::malloc_ei
GTest::gtest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@

#include "discovery_zeroconf_announcer.h"
#include "discovery_zeroconf_watcher.h"
#include "celix_dm_component_ei.h"
#include "celix_bundle_context_ei.h"
#include "celix_properties_ei.h"
#include "celix_log_helper_ei.h"
#include "eventfd_ei.h"
#include "celix_framework.h"
#include "celix_framework_factory.h"
Expand All @@ -41,6 +45,12 @@ class DiscoveryZeroconfActivatorTestSuite : public ::testing::Test {

~DiscoveryZeroconfActivatorTestSuite() override {
celix_ei_expect_eventfd(nullptr, 0, 0);
celix_ei_expect_celix_bundleContext_getProperty(nullptr, 0, nullptr);
celix_ei_expect_celix_bundleContext_getDependencyManager(nullptr, 0, nullptr);
celix_ei_expect_celix_dmComponent_create(nullptr, 0, nullptr);
celix_ei_expect_celix_dmServiceDependency_create(nullptr, 0, nullptr);
celix_ei_expect_celix_properties_create(nullptr, 0, nullptr);
celix_ei_expect_celix_logHelper_create(nullptr, 0, nullptr);
}

std::shared_ptr<celix_framework_t> fw{};
Expand Down Expand Up @@ -84,6 +94,108 @@ TEST_F(DiscoveryZeroconfActivatorTestSuite, DiscoveryZeroconfWatcherCreateFailed
status = celix_bundleActivator_start(act, ctx.get());
EXPECT_EQ(CELIX_ENOMEM, status);

status = celix_bundleActivator_destroy(act, ctx.get());
EXPECT_EQ(CELIX_SUCCESS, status);
}

TEST_F(DiscoveryZeroconfActivatorTestSuite, GetFrameworkUuidFailed) {
void *act{nullptr};
auto status = celix_bundleActivator_create(ctx.get(), &act);
EXPECT_EQ(CELIX_SUCCESS, status);

celix_ei_expect_celix_bundleContext_getProperty(CELIX_EI_UNKNOWN_CALLER, 0, nullptr);
status = celix_bundleActivator_start(act, ctx.get());
EXPECT_EQ(CELIX_BUNDLE_EXCEPTION, status);

status = celix_bundleActivator_destroy(act, ctx.get());
EXPECT_EQ(CELIX_SUCCESS, status);
}

TEST_F(DiscoveryZeroconfActivatorTestSuite, CreateLogHelperFailed) {
void *act{nullptr};
auto status = celix_bundleActivator_create(ctx.get(), &act);
EXPECT_EQ(CELIX_SUCCESS, status);

celix_ei_expect_celix_logHelper_create(CELIX_EI_UNKNOWN_CALLER, 0, nullptr);
status = celix_bundleActivator_start(act, ctx.get());
EXPECT_EQ(CELIX_ENOMEM, status);

status = celix_bundleActivator_destroy(act, ctx.get());
EXPECT_EQ(CELIX_SUCCESS, status);
}

TEST_F(DiscoveryZeroconfActivatorTestSuite, CreateAnnouncerDmComponentFailed) {
void *act{nullptr};
auto status = celix_bundleActivator_create(ctx.get(), &act);
EXPECT_EQ(CELIX_SUCCESS, status);

celix_ei_expect_celix_dmComponent_create(CELIX_EI_UNKNOWN_CALLER, 0, nullptr);
status = celix_bundleActivator_start(act, ctx.get());
EXPECT_EQ(CELIX_ENOMEM, status);

status = celix_bundleActivator_destroy(act, ctx.get());
EXPECT_EQ(CELIX_SUCCESS, status);
}

TEST_F(DiscoveryZeroconfActivatorTestSuite, CreateAnnouncerEndpointListenerPropertiesFailed) {
void *act{nullptr};
auto status = celix_bundleActivator_create(ctx.get(), &act);
EXPECT_EQ(CELIX_SUCCESS, status);

celix_ei_expect_celix_properties_create(CELIX_EI_UNKNOWN_CALLER, 0, nullptr);
status = celix_bundleActivator_start(act, ctx.get());
EXPECT_EQ(CELIX_ENOMEM, status);

status = celix_bundleActivator_destroy(act, ctx.get());
EXPECT_EQ(CELIX_SUCCESS, status);
}

TEST_F(DiscoveryZeroconfActivatorTestSuite, CreateWatcherDmComponentFailed) {
void *act{nullptr};
auto status = celix_bundleActivator_create(ctx.get(), &act);
EXPECT_EQ(CELIX_SUCCESS, status);

celix_ei_expect_celix_dmComponent_create(CELIX_EI_UNKNOWN_CALLER, 0, nullptr, 2);
status = celix_bundleActivator_start(act, ctx.get());
EXPECT_EQ(CELIX_ENOMEM, status);

status = celix_bundleActivator_destroy(act, ctx.get());
EXPECT_EQ(CELIX_SUCCESS, status);
}

TEST_F(DiscoveryZeroconfActivatorTestSuite, CreateEndpointListenerDependencyFailed) {
void *act{nullptr};
auto status = celix_bundleActivator_create(ctx.get(), &act);
EXPECT_EQ(CELIX_SUCCESS, status);

celix_ei_expect_celix_dmServiceDependency_create(CELIX_EI_UNKNOWN_CALLER, 0, nullptr);
status = celix_bundleActivator_start(act, ctx.get());
EXPECT_EQ(CELIX_ENOMEM, status);

status = celix_bundleActivator_destroy(act, ctx.get());
EXPECT_EQ(CELIX_SUCCESS, status);
}

TEST_F(DiscoveryZeroconfActivatorTestSuite, CreateRsaDependencyFailed) {
void *act{nullptr};
auto status = celix_bundleActivator_create(ctx.get(), &act);
EXPECT_EQ(CELIX_SUCCESS, status);

celix_ei_expect_celix_dmServiceDependency_create(CELIX_EI_UNKNOWN_CALLER, 0, nullptr, 2);
status = celix_bundleActivator_start(act, ctx.get());
EXPECT_EQ(CELIX_ENOMEM, status);

status = celix_bundleActivator_destroy(act, ctx.get());
EXPECT_EQ(CELIX_SUCCESS, status);
}

TEST_F(DiscoveryZeroconfActivatorTestSuite, GetDependencyManagerFailed) {
void *act{nullptr};
auto status = celix_bundleActivator_create(ctx.get(), &act);
EXPECT_EQ(CELIX_SUCCESS, status);
celix_ei_expect_celix_bundleContext_getDependencyManager(CELIX_EI_UNKNOWN_CALLER, 0, nullptr);
status = celix_bundleActivator_start(act, ctx.get());
EXPECT_EQ(CELIX_ENOMEM, status);
status = celix_bundleActivator_destroy(act, ctx.get());
EXPECT_EQ(CELIX_SUCCESS, status);
}
Loading
Loading