system: if-statement simplifications in IETFInterfacesConfig

* use `if (auto x = foo())` pattern rather than `if (auto x = foo(); x)`
* use new `utils::getUniqueSubtree` libyang wrapper instead of manually
  calling libyang functions

Change-Id: Id35ba449455740f65601ef782cda9ade5cfab02f
diff --git a/src/system/IETFInterfacesConfig.cpp b/src/system/IETFInterfacesConfig.cpp
index 61c68b9..e8307a3 100644
--- a/src/system/IETFInterfacesConfig.cpp
+++ b/src/system/IETFInterfacesConfig.cpp
@@ -84,15 +84,15 @@
 {
     std::map<std::string, std::string> networkConfigFiles;
 
-    if (auto data = session->get_data("/ietf-interfaces:interfaces/interface"); data) {
+    if (auto data = session->get_data("/ietf-interfaces:interfaces/interface")) {
         auto linkEntries = data->find_path("/ietf-interfaces:interfaces/interface");
         for (const auto& linkEntry : linkEntries->data()) {
             std::map<std::string, std::vector<std::string>> configValues;
 
             auto linkName = utils::getValueAsString(utils::getUniqueSubtree(linkEntry, "name").value());
 
-            if (auto set = linkEntry->find_path("description"); set->number() != 0) {
-                configValues["Network"].push_back("Description="s + utils::getValueAsString(set->data().front()));
+            if (auto node = utils::getUniqueSubtree(linkEntry, "description")) {
+                configValues["Network"].push_back("Description="s + utils::getValueAsString(node.value()));
             }
 
             // if addresses present, generate them...
@@ -118,8 +118,8 @@
             // disable this behaviour when IPv6 is disabled or when link enslaved
             bool isSlave = false;
 
-            if (auto set = linkEntry->find_path("czechlight-network:bridge"); set->number() > 0) {
-                configValues["Network"].push_back("Bridge="s + utils::getValueAsString(set->data().front()));
+            if (auto node = utils::getUniqueSubtree(linkEntry, "czechlight-network:bridge")) {
+                configValues["Network"].push_back("Bridge="s + utils::getValueAsString(node.value()));
                 isSlave = true;
             }