Port to libyang-cpp and sysrepo-cpp API change to std::string

Change-Id: I2e922014ec0d280cccafc1fd5aa4ef6a575b1c9d
Depends-on: https://gerrit.cesnet.cz/c/CzechLight/dependencies/+/5564
Depends-on: https://gerrit.cesnet.cz/c/CzechLight/netconf-cli/+/5570
diff --git a/tests/hardware_ietf-hardware.cpp b/tests/hardware_ietf-hardware.cpp
index f6d4ff4..bbcf647 100644
--- a/tests/hardware_ietf-hardware.cpp
+++ b/tests/hardware_ietf-hardware.cpp
@@ -411,10 +411,10 @@
         {
             const auto xpath = modulePrefix + "/component[name='ne:ctrl:emmc:lifetime']/class";
             client.switchDatastore(sysrepo::Datastore::Operational);
-            auto val = client.getData(xpath.c_str());
+            auto val = client.getData(xpath);
             client.switchDatastore(sysrepo::Datastore::Running);
             REQUIRE(val);
-            REQUIRE(val->findPath(xpath.c_str())->asTerm().valueStr() == "iana-hardware:sensor"s);
+            REQUIRE(val->findPath(xpath)->asTerm().valueStr() == "iana-hardware:sensor"s);
         }
     }
 }
diff --git a/tests/sysrepo_system-ietfinterfaces.cpp b/tests/sysrepo_system-ietfinterfaces.cpp
index e20503e..2a54676 100644
--- a/tests/sysrepo_system-ietfinterfaces.cpp
+++ b/tests/sysrepo_system-ietfinterfaces.cpp
@@ -89,8 +89,8 @@
                                              {"osc", "iana-if-type:ethernetCsmacd"},
                                              {"oscW", "iana-if-type:ethernetCsmacd"},
                                              {"oscE", "iana-if-type:ethernetCsmacd"}}) {
-                client.setItem(("/ietf-interfaces:interfaces/interface[name='"s + name + "']/type").c_str(), type);
-                client.setItem(("/ietf-interfaces:interfaces/interface[name='"s + name + "']/enabled").c_str(), "false");
+                client.setItem("/ietf-interfaces:interfaces/interface[name='"s + name + "']/type", type);
+                client.setItem("/ietf-interfaces:interfaces/interface[name='"s + name + "']/enabled", "false");
             }
             client.applyChanges();
         }
diff --git a/tests/sysrepo_system-leds.cpp b/tests/sysrepo_system-leds.cpp
index 3d4dce3..923ed40 100644
--- a/tests/sysrepo_system-leds.cpp
+++ b/tests/sysrepo_system-leds.cpp
@@ -101,7 +101,7 @@
             expectedBrightness = "256";
         }
 
-        auto rpcInput = client.getContext().newPath("/czechlight-system:leds/uid/state", state.c_str());
+        auto rpcInput = client.getContext().newPath("/czechlight-system:leds/uid/state", state);
 
         auto res = client.sendRPC(rpcInput);
         REQUIRE(res.child() == std::nullopt);
diff --git a/tests/sysrepo_two-daemons_daemon.cpp b/tests/sysrepo_two-daemons_daemon.cpp
index 39ed864..d58928d 100644
--- a/tests/sysrepo_two-daemons_daemon.cpp
+++ b/tests/sysrepo_two-daemons_daemon.cpp
@@ -18,9 +18,9 @@
 {
     for (const auto& [propertyName, value] : values) {
         if (!parent) {
-            parent = session.getContext().newPath((prefix + propertyName).c_str(), value.c_str(), libyang::CreationOptions::Output);
+            parent = session.getContext().newPath(prefix + propertyName, value, libyang::CreationOptions::Output);
         } else {
-            parent->newPath((prefix + propertyName).c_str(), value.c_str(), libyang::CreationOptions::Output);
+            parent->newPath(prefix + propertyName, value, libyang::CreationOptions::Output);
         }
     }
 }
@@ -65,9 +65,9 @@
 
 
         srSub = srSess.onOperGet(
-            MODULE_NAME.c_str(),
+            MODULE_NAME,
             cb,
-            (MODULE_PREFIX + "/*").c_str(),
+            MODULE_PREFIX + "/*",
             sysrepo::SubscribeOptions::Passive | sysrepo::SubscribeOptions::OperMerge);
     } else if (isDaemonSetItem) {
         data = {
@@ -77,7 +77,7 @@
 
         srSess.switchDatastore(sysrepo::Datastore::Operational);
         for (const auto& [k, v] : data) {
-            srSess.setItem((MODULE_PREFIX + k).c_str(), v.c_str());
+            srSess.setItem(MODULE_PREFIX + k, v);
         }
         srSess.applyChanges();
         srSess.switchDatastore(sysrepo::Datastore::Running);
diff --git a/tests/test_sysrepo_helpers.h b/tests/test_sysrepo_helpers.h
index 1df3dc9..b1959a7 100644
--- a/tests/test_sysrepo_helpers.h
+++ b/tests/test_sysrepo_helpers.h
@@ -17,9 +17,9 @@
 {
     spdlog::get("main")->error("dataFrom {}", xpath);
     std::map<std::string, std::string> res;
-    auto data = session.getData((xpath + "/*").c_str());
+    auto data = session.getData(xpath + "/*");
     REQUIRE(data);
-    for (const auto& sibling : data->findXPath(xpath.c_str())) { // Use findXPath here in case the xpath is list without keys.
+    for (const auto& sibling : data->findXPath(xpath)) { // Use findXPath here in case the xpath is list without keys.
         for (const auto& node : sibling.childrenDfs()) {
             const auto briefXPath = std::string(node.path()).substr(boost::algorithm::ends_with(xpath, ":*") ? xpath.size() - 1 : xpath.size());
 
@@ -37,9 +37,9 @@
 auto rpcFromSysrepo(sysrepo::Session session, const std::string& rpcPath, std::map<std::string, std::string> input)
 {
     spdlog::get("main")->info("rpcFromSysrepo {}", rpcPath);
-    auto inputNode = session.getContext().newPath(rpcPath.c_str(), nullptr);
+    auto inputNode = session.getContext().newPath(rpcPath, std::nullopt);
     for (const auto& [k, v] : input) {
-        inputNode.newPath((rpcPath + "/" + k).c_str(), v.c_str());
+        inputNode.newPath(rpcPath + "/" + k, v);
     }
 
     auto output = session.sendRPC(inputNode);