system: Move lldp-systemd-networkd-sysrepo to velia
We agreed that maintaining standalone lldp-systemd-networkd-sysrepo
project is excessive. For example, many compilation units in the
project are copied from velia. Also, velia manages a lot of
system (and network) related things so why should the access to LLDP
neighbours via sysrepo be a standalone project?
This commit copies lldp-systemd-networkd-sysrepo project into velia.
The source repository commit is
39bd89ff7e57cd7bf4ebfdab5fce41fb4fdedcf0.
Only necessary stuff was changed (some naming and compilation issues).
We *might* be changing this code soon if our patch for LLDP neighbours
extraction in JSON format[1] is merged into systemd.
Of course, this also needs a br2-external update because this commit
effectively deprecates lldp-systemd-networkd-sysrepo project and it
should not be used in br2-external anymore.
[1] https://github.com/systemd/systemd/pull/20333
Change-Id: Ide2ed4e5eb8f1c3b10f0e2af7820f83c04cb81e8
diff --git a/src/main-system.cpp b/src/main-system.cpp
index 9a9c18d..fe367db 100644
--- a/src/main-system.cpp
+++ b/src/main-system.cpp
@@ -4,13 +4,15 @@
#include <sysrepo-cpp/Session.hpp>
#include "VELIA_VERSION.h"
#include "main.h"
+#include "system_vars.h"
#include "system/Authentication.h"
#include "system/Firmware.h"
#include "system/IETFInterfaces.h"
#include "system/IETFInterfacesConfig.h"
#include "system/IETFSystem.h"
#include "system/LED.h"
-#include "system_vars.h"
+#include "system/LLDP.h"
+#include "system/LLDPCallback.h"
#include "utils/exceptions.h"
#include "utils/exec.h"
#include "utils/journal.h"
@@ -104,6 +106,10 @@
auto leds = velia::system::LED(srConn, "/sys/class/leds");
+ auto lldp = std::make_shared<velia::system::LLDPDataProvider>("/run/systemd/netif/lldp", *g_dbusConnection, "org.freedesktop.network1");
+ auto srSubs = std::make_shared<sysrepo::Subscribe>(srSess);
+ srSubs->oper_get_items_subscribe("czechlight-lldp", velia::system::LLDPCallback(lldp), "/czechlight-lldp:nbr-list");
+
DBUS_EVENTLOOP_END
return 0;
} catch (std::exception& e) {