Migrate to libyang2
Explanation of some of the changes:
1) New libyang produces different schema paths, that don't include
choice/case nodes. This can be seen in Firewall.cpp.
2) New sysrepo does not use <map>, so it has to be included at multiple
places.
3) getUniqueSubtree is now just one line of code. Another commit can get
rid of it.
4) dataFromSysrepo sometimes gives less and sometimes more data. This is
because it now uses libyang instead of sr_val_t
- When it gives more data it's usually just lists or empty containers,
sr_val_t didn't give those.
- When it gives less data it's also just empty containers. This can
be seen with "sensor-data" in hardware_ietf-hardware.cpp.
Depends-on: https://gerrit.cesnet.cz/c/CzechLight/dependencies/+/5171
Change-Id: I388536269e790b8b74ea7791c79b180adc5d80a6
Co-authored-by: Jan Kundrát <jan.kundrat@cesnet.cz>
diff --git a/src/main-hardware.cpp b/src/main-hardware.cpp
index 3b8134a..a83a4f0 100644
--- a/src/main-hardware.cpp
+++ b/src/main-hardware.cpp
@@ -1,7 +1,7 @@
#include <docopt.h>
#include <spdlog/sinks/ansicolor_sink.h>
#include <spdlog/spdlog.h>
-#include <sysrepo-cpp/Session.hpp>
+#include <sysrepo-cpp/Connection.hpp>
#include "VELIA_VERSION.h"
#include "ietf-hardware/Factory.h"
#include "ietf-hardware/IETFHardware.h"
@@ -53,9 +53,8 @@
spdlog::get("sysrepo")->set_level(parseLogLevel("Sysrepo library", args["--sysrepo-log-level"]));
spdlog::get("hardware")->set_level(parseLogLevel("Hardware loggers", args["--hardware-log-level"]));
- auto srConn = std::make_shared<sysrepo::Connection>();
- auto srSess = std::make_shared<sysrepo::Session>(srConn);
- auto srSubscription = std::make_shared<sysrepo::Subscribe>(srSess);
+ auto srConn = sysrepo::Connection{};
+ auto srSess = srConn.sessionStart();
// initialize ietf-hardware
std::shared_ptr<velia::ietf_hardware::IETFHardware> ietfHardware;
@@ -65,7 +64,7 @@
ietfHardware = std::make_shared<velia::ietf_hardware::IETFHardware>();
}
- auto sysrepoIETFHardware = velia::ietf_hardware::sysrepo::Sysrepo(srSubscription, ietfHardware);
+ auto sysrepoIETFHardware = velia::ietf_hardware::sysrepo::Sysrepo(srSess, ietfHardware);
waitUntilSignaled();