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/system/LED.cpp b/src/system/LED.cpp
index f658644..ce3abee 100644
--- a/src/system/LED.cpp
+++ b/src/system/LED.cpp
@@ -26,10 +26,10 @@
 
 namespace velia::system {
 
-LED::LED(const std::shared_ptr<::sysrepo::Connection>& srConn, std::filesystem::path sysfsLeds)
+LED::LED(::sysrepo::Connection srConn, std::filesystem::path sysfsLeds)
     : m_log(spdlog::get("system"))
-    , m_srSession(std::make_shared<::sysrepo::Session>(srConn))
-    , m_srSubscribe(std::make_shared<::sysrepo::Subscribe>(m_srSession))
+    , m_srSession(srConn.sessionStart())
+    , m_srSubscribe()
     , m_thrRunning(true)
 {
     utils::ensureModuleImplemented(m_srSession, CZECHLIGHT_SYSTEM_MODULE_NAME, "2021-01-13");
@@ -51,9 +51,9 @@
     const auto triggerFile = sysfsLeds / UID_LED / "trigger";
     const auto brightnessFile = sysfsLeds / UID_LED / "brightness";
 
-    m_srSubscribe->rpc_subscribe_tree(
+    m_srSubscribe = m_srSession.onRPCAction(
         (CZECHLIGHT_SYSTEM_LEDS_MODULE_PREFIX + "uid").c_str(),
-        [this, uidMaxBrightness, triggerFile, brightnessFile](auto session, auto, auto input, auto, auto, auto) {
+        [this, uidMaxBrightness, triggerFile, brightnessFile](auto session, auto, auto, auto input, auto, auto, auto) {
             std::string val = utils::getValueAsString(utils::getUniqueSubtree(input, (CZECHLIGHT_SYSTEM_LEDS_MODULE_PREFIX + "uid/state").c_str()).value());
 
             try {
@@ -69,11 +69,11 @@
                 }
             } catch (const std::invalid_argument& e) {
                 m_log->warn("Failed to set state of the UID LED: '{}'", e.what());
-                session->set_error("Failed to set state of the UID LED", nullptr);
-                return SR_ERR_OPERATION_FAILED;
+                utils::setErrors(session, "Failed to set state of the UID LED");
+                return sysrepo::ErrorCode::OperationFailed;
             }
 
-            return SR_ERR_OK;
+            return sysrepo::ErrorCode::Ok;
         });
 }
 
@@ -104,7 +104,7 @@
             }
         }
 
-        utils::valuesPush(data, {}, m_srSession, SR_DS_OPERATIONAL);
+        utils::valuesPush(data, {}, m_srSession, sysrepo::Datastore::Operational);
 
         std::this_thread::sleep_for(POLL_INTERVAL);
     }