plugins ext FEATURE initial schema-mount support

Only for XML data for now. Includes lots of other
changes needed to support this extension.
diff --git a/tests/utests/utests.h b/tests/utests/utests.h
index 46b3d04..7e85a66 100644
--- a/tests/utests/utests.h
+++ b/tests/utests/utests.h
@@ -126,16 +126,25 @@
  * @param[in] INPUT_FORMAT Format of the input data to be parsed. Can be 0 to try to detect format from the input handler.
  * @param[in] PARSE_OPTIONS Options for parser, see @ref dataparseroptions.
  * @param[in] VALIDATE_OPTIONS Options for the validation phase, see @ref datavalidationoptions.
- * @param[in] OUT_STATUS expected return status
- * @param[out] OUT_NODE Resulting data tree built from the input data. Note that NULL can be a valid result as a representation of an empty YANG data tree.
- * The returned data are expected to be freed using LYD_TREE_DESTROY().
+ * @param[in] RET expected return status
+ * @param[out] OUT_NODE Resulting data tree built from the input data. Note that NULL can be a valid result as a
+ * representation of an empty YANG data tree.
  */
-#define CHECK_PARSE_LYD_PARAM(INPUT, INPUT_FORMAT, PARSE_OPTIONS, VALIDATE_OPTIONS, OUT_STATUS, OUT_NODE) \
-    assert_int_equal(OUT_STATUS, lyd_parse_data_mem(_UC->ctx, INPUT, INPUT_FORMAT, PARSE_OPTIONS, VALIDATE_OPTIONS, &OUT_NODE)); \
-    if (OUT_STATUS == LY_SUCCESS) { \
-        assert_non_null(OUT_NODE); \
-    } else { \
-        assert_null(OUT_NODE); \
+#define CHECK_PARSE_LYD_PARAM(INPUT, INPUT_FORMAT, PARSE_OPTIONS, VALIDATE_OPTIONS, RET, OUT_NODE) \
+    { \
+        LY_ERR _r = lyd_parse_data_mem(_UC->ctx, INPUT, INPUT_FORMAT, PARSE_OPTIONS, VALIDATE_OPTIONS, &OUT_NODE); \
+        if (_r != RET) { \
+            if (_r) { \
+                fail_msg("%s != 0x%d; MSG: %s", #RET, _r, ly_err_last(_UC->ctx)->msg); \
+            } else { \
+                fail_msg("%s != 0x%d", #RET, _r); \
+            } \
+        } \
+        if (RET == LY_SUCCESS) { \
+            assert_non_null(OUT_NODE); \
+        } else { \
+            assert_null(OUT_NODE); \
+        } \
     }
 
 /**
@@ -147,10 +156,13 @@
  */
 #define CHECK_LYD_STRING_PARAM(NODE, TEXT, FORMAT, PARAM) \
     { \
-        char *test; \
-        lyd_print_mem(&test, NODE, FORMAT, PARAM); \
-        assert_string_equal(test, TEXT); \
-        free(test); \
+        char *str; \
+        LY_ERR _r = lyd_print_mem(&str, NODE, FORMAT, PARAM); \
+        if (_r) { \
+            fail_msg("Print err 0x%d; MSG: %s", _r, ly_err_last(_UC->ctx)->msg); \
+        } \
+        assert_string_equal(str, TEXT); \
+        free(str); \
     }
 
 /**
@@ -160,15 +172,15 @@
  */
 #define CHECK_LYD(NODE_1, NODE_2) \
     { \
-        char *test_1; \
-        char *test_2; \
-        assert_int_equal(LY_SUCCESS, lyd_print_mem(&test_1, NODE_1, LYD_XML, LYD_PRINT_WITHSIBLINGS | LYD_PRINT_SHRINK)); \
-        assert_int_equal(LY_SUCCESS, lyd_print_mem(&test_2, NODE_2, LYD_XML, LYD_PRINT_WITHSIBLINGS | LYD_PRINT_SHRINK)); \
-        assert_non_null(test_1); \
-        assert_non_null(test_2); \
-        assert_string_equal(test_1, test_2); \
-        free(test_1); \
-        free(test_2); \
+        char *str1; \
+        char *str2; \
+        assert_int_equal(LY_SUCCESS, lyd_print_mem(&str1, NODE_1, LYD_XML, LYD_PRINT_WITHSIBLINGS | LYD_PRINT_SHRINK)); \
+        assert_int_equal(LY_SUCCESS, lyd_print_mem(&str2, NODE_2, LYD_XML, LYD_PRINT_WITHSIBLINGS | LYD_PRINT_SHRINK)); \
+        assert_non_null(str1); \
+        assert_non_null(str2); \
+        assert_string_equal(str1, str2); \
+        free(str1); \
+        free(str2); \
     }
 
 /*
@@ -215,6 +227,7 @@
 
 /**
  * @brief check compileted type
+ *
  * @param[in] NODE pointer to lysc_type value
  * @param[in] TYPE expected type [LY_DATA_TYPE](@ref LY_DATA_TYPE)
  * @param[in] EXTS expected [sized array](@ref sizedarrays) size of extens list
@@ -225,7 +238,9 @@
     CHECK_ARRAY((NODE)->exts, EXTS); \
     assert_ptr_equal((NODE)->plugin, lyplg_find(LYPLG_TYPE, "", NULL, ly_data_type2str[TYPE]))
 
-/* @brief check compileted numeric type
+/**
+ * @brief check compileted numeric type
+ *
  * @param[in] NODE pointer to lysc_type_num value
  * @param[in] TYPE expected type [LY_DATA_TYPE](@ref LY_DATA_TYPE)
  * @param[in] EXTS expected [sized array](@ref sizedarrays) size of extens list
@@ -235,7 +250,9 @@
     CHECK_LYSC_TYPE(NODE, TYPE, EXTS);\
     CHECK_POINTER((NODE)->range, RANGE)
 
-/* @brief check compiled string type
+/**
+ * @brief check compiled string type
+ *
  * @param[in] NODE     pointer to lysc_type_num value
  * @param[in] EXTS     expected [sized array](@ref sizedarrays) size of extens list
  * @param[in] LENGTH   0 -> node dosnt have length limitation, 1 -> node have length limitation
@@ -247,7 +264,9 @@
     CHECK_POINTER((NODE)->length, LENGTH); \
     CHECK_ARRAY((NODE)->patterns, PATTERNS)
 
-/* @brief check compiled bits type
+/**
+ * @brief check compiled bits type
+ *
  * @param[in] NODE     pointer to lysc_type_num value
  * @param[in] EXTS     expected [sized array](@ref sizedarrays) size of extens list
  * @param[in] BITS     expected number of bits
@@ -266,7 +285,9 @@
     CHECK_STRING((NODE)->name, NAME); \
     CHECK_STRING((NODE)->ref, REF) \
 
-/* @brief check range
+/**
+ * @brief check range
+ *
  * @param[in] NODE     pointer to lysc_range value
  * @param[in] DSC      expected descriptin (string)
  * @param[in] EAPPTAG  expected string reprezenting error-app-tag value
@@ -284,7 +305,9 @@
     CHECK_ARRAY((NODE)->parts, PARTS); \
     CHECK_STRING((NODE)->ref, REF)
 
-/* @brief check pattern
+/**
+ * @brief check pattern
+ *
  * @param[in] NODE     pointer to lysc_pattern value
  * @param[in] DSC      expected descriptin (string)
  * @param[in] EAPPTAG  expected string reprezenting error-app-tag value
@@ -307,6 +330,7 @@
 
 /**
  * @brief assert that lysp_action_inout structure members are correct
+ *
  * @param[in] NODE      pointer to lysp_action_inout variable
  * @param[in] DATA      0 -> check if pointer to data is NULL, 1 -> check if pointer to data is not null
  * @param[in] EXTS      expected [sized array](@ref sizedarrays) size of extens list
@@ -328,6 +352,7 @@
 
 /**
  * @brief assert that lysp_action structure members are correct
+ *
  * @param[in] NODE    pointer to lysp_action variable
  * @param[in] DSC     expected description
  * @param[in] EXTS    expected [sized array](@ref sizedarrays) size of extension list
@@ -367,6 +392,7 @@
 
 /**
  * @brief assert that lysp_when structure members are correct
+ *
  * @param[in] NODE pointer to lysp_when variable
  * @param[in] COND expected string specifid condition
  * @param[in] DSC  expected string description statement
@@ -387,6 +413,7 @@
 
 /**
  * @brief assert that lysp_restr structure members are correct
+ *
  * @param[in] NODE pointer to lysp_restr variable
  * @param[in] ARG_STR expected string. The restriction expression/value
  * @param[in] DSC     expected descrition
@@ -408,6 +435,7 @@
 
 /**
  * @brief assert that lysp_import structure members are correct
+ *
  * @param[in] NODE   pointer to lysp_import variable
  * @param[in] DSC    expected description or NULL
  * @param[in] EXTS   expected [sized array](@ref sizedarrays) size of list of extensions
@@ -428,6 +456,7 @@
 
 /**
  * @brief assert that lysp_ext structure members are correct
+ *
  * @param[in] NODE pointer to lysp_ext_instance variable
  * @param[in] ARGNAME expected argument name
  * @param[in] COMPILED 0 -> compiled data dosnt exists, 1 -> compiled data exists
@@ -449,6 +478,7 @@
 
 /**
  * @brief assert that lysp_ext_instance structure members are correct
+ *
  * @param[in] NODE      pointer to lysp_ext_instance variable
  * @param[in] ARGUMENT  expected optional value of the extension's argument
  * @param[in] CHILD     0 -> node doesnt have child, 1 -> node have children
@@ -468,6 +498,7 @@
 
 /**
  * @brief assert that lysp_stmt structure members are correct
+ *
  * @param[in] NODE  pointer to lysp_stmt variable
  * @param[in] ARG   expected statemet argumet
  * @param[in] CHILD 0 -> node doesnt have child, 1 -> node have children
@@ -487,6 +518,7 @@
 
 /**
  * @brief assert that lysp_type_enum structure members are correct
+ *
  * @param[in] NODE pointer to lysp_type_enum variable
  * @param[in] DSC   expected description
  * @param[in] EXTS  expected [sized array](@ref sizedarrays) size of list of the extension instances
@@ -508,6 +540,7 @@
 
 /**
  * @brief assert that lysp_type_enum structure members are correct
+ *
  * @param[in] NODE pointer to lysp_type variable
  * @param[in] BASES  expected [sized array](@ref sizedarrays) size of list of indentifiers
  * @param[in] BITS   expected [sized array](@ref sizedarrays) size of list of bits
@@ -546,6 +579,7 @@
 
 /**
  * @brief assert that lysp_node structure members are correct
+ *
  * @param[in] NODE  pointer to lysp_node variable
  * @param[in] DSC   expected description statement
  * @param[in] EXTS  expected [sized array](@ref sizedarrays) size of list of the extension instances
@@ -575,6 +609,7 @@
 
 /**
  * @brief assert that lysp_node structure members are correct
+ *
  * @param[in] NODE  pointer to lysp_node variable
  * @param[in] DSC   expected description statement
  * @param[in] EXTS  expected [sized array](@ref sizedarrays) size of list of the extension instances
@@ -598,6 +633,7 @@
 
 /**
  * @brief assert that lysc_notif structure members are correct
+ *
  * @param[in] NODE    pointer to lysp_notif variable
  * @param[in] DATA    0 pointer is null, 1 pointer is not null
  * @param[in] DSC     expected description
@@ -628,6 +664,7 @@
 
 /**
  * @brief assert that lysc_action_inout structure members are correct
+ *
  * @param[in] NODE      pointer to lysp_notif variable
  * @param[in] DATA      0 pointer is null, 1 pointer is not null
  * @param[in] MUST      expected [sized array](@ref sizedarrays) size of list of must restrictions
@@ -641,6 +678,7 @@
 
 /**
  * @brief assert that lysc_action structure members are correct
+ *
  * @param[in] NODE    pointer to lysp_action variable
  * @param[in] DSC     string description statement
  * @param[in] EXTS    expected [sized array](@ref sizedarrays) size of list of the extension instances
@@ -679,6 +717,7 @@
 
 /**
  * @brief assert that lysc_node structure members are correct
+ *
  * @param[in] NODE    pointer to lysc_node variable
  * @param[in] DSC     expected description
  * @param[in] EXTS    expected [sized array](@ref sizedarrays) size of list of the extension instances
@@ -712,6 +751,7 @@
 
 /**
  * @brief assert that lysc_node_leaf structure members are correct
+ *
  * @param[in] NODE    pointer to lysc_node variable
  * @param[in] DSC     expected description
  * @param[in] EXTS    expected [sized array](@ref sizedarrays) size of list of the extension instances
@@ -745,6 +785,7 @@
 
 /**
  * @brief assert that lysc_node_leaf structure members are correct
+ *
  * @param[in] NODE    pointer to lysc_node variable
  * @param[in] DSC     expected description
  * @param[in] EXTS    expected [sized array](@ref sizedarrays) size of list of the extension instances
@@ -770,6 +811,7 @@
 
 /**
  * @brief assert that lyd_meta structure members are correct
+ *
  * @param[in] NODE       pointer to lyd_meta variable
  * @param[in] ANNOTATION 0 pointer is null, 1 pointer is not null
  * @param[in] NAME       expected name
@@ -788,6 +830,7 @@
 
 /**
  * @brief assert that lyd_node_term structure members are correct
+ *
  * @param[in] NODE             pointer to lyd_node_term variable
  * @param[in] FLAGS            expected [data node flags](@ref dnodeflags)
  * @param[in] META             0 -> meta is not prezent, 1 -> meta is prezent
@@ -808,6 +851,7 @@
 
 /**
  * @brief assert that lyd_node_any structure members are correct
+ *
  * @param[in] NODE       pointer to lyd_node_term variable
  * @param[in] FLAGS      expected [data node flags](@ref dnodeflags)
  * @param[in] META       0 meta isnt present , 1 meta is present
@@ -825,6 +869,7 @@
 
 /**
  * @brief assert that lyd_node_opaq structure members are correct
+ *
  * @param[in] NODE     pointer to lyd_node_opaq variable
  * @param[in] ATTR     0 if pointer is null ,1 if pointer is not null
  * @param[in] CHILD    0 if pointer is null ,1 if pointer is not null
@@ -849,6 +894,7 @@
 
 /**
  * @brief assert that lyd_node_opaq structure members are correct
+ *
  * @param[in] NODE     pointer to lyd_node_opaq variable
  * @param[in] CHILD    1 if node has children other 0
  * @param[in] HILD_HT  1 if node has children hash table other 0
@@ -873,6 +919,7 @@
 
 /**
  * @brief assert that lyd_value structure members are correct
+ *
  * @param[in] NODE     lyd_value
  * @param[in] TYPE_VAL value type. EMPTY, UNION, BITS, INST, ENUM, INT8, INT16, UINT8, STRING, LEAFREF, DEC64, BINARY, BOOL, IDENT
  *                     part of text reprezenting LY_DATA_TYPE.
@@ -890,6 +937,7 @@
 /**
  * @brief Internal macro. Assert that lyd_value structure members are correct. Lyd value is type EMPTY
  *        Example CHECK_LYD_VALUE(node->value, EMPTY, "");
+ *
  * @param[in] NODE           lyd_value variable
  * @param[in] CANNONICAL_VAL expected cannonical value
  */
@@ -903,6 +951,7 @@
  * @brief Internal macro. Assert that lyd_value structure members are correct. Lyd value is type UNION
  *        Example CHECK_LYD_VALUE(node->value, UNION, "12", INT8, "12", 12);
  * @warning   type of subvalue cannot be UNION. Example of calling
+ *
  * @param[in] NODE           lyd_value variable
  * @param[in] CANNONICAL_VAL expected cannonical value
  * @param[in] TYPE_VAL value type. EMPTY, UNION, BITS, INST, ENUM, INT8, INT16, UINT8, STRING, LEAFREF, DEC64, BINARY, BOOL, IDENT
@@ -927,6 +976,7 @@
 /**
  * @brief Internal macro. Assert that lyd_value structure members are correct. Lyd value is type BITS
  *        Example arr[] = {"a", "b"}; CHECK_LYD_VALUE(node->value, BITS, "a b", arr);
+ *
  * @param[in] NODE           lyd_value variable
  * @param[in] CANNONICAL_VAL expected cannonical value
  * @param[in] VALUE          expected array of bits names
@@ -949,6 +999,7 @@
 
 /**
  * @brief Internal macro. Assert that lyd_value structure members are correct. Lyd value is type INST
+ *
  * @param[in] NODE           lyd_value variable
  * @param[in] CANNONICAL_VAL expected cannonical value
  * @param[in] VALUE          expected array of enum ly_path_pred_type
@@ -970,6 +1021,7 @@
 /**
  * @brief Internal macro. Assert that lyd_value structure members are correct. Lyd value is type ENUM.
  *        Example CHECK_LYD_VALUE(node->value, ENUM, "item_name", "item_name");
+ *
  * @param[in] NODE           lyd_value variable
  * @param[in] CANNONICAL_VAL expected cannonical value
  * @param[in] VALUE          expected enum item name
@@ -984,6 +1036,7 @@
 /**
  * @brief Internal macro. Assert that lyd_value structure members are correct. Lyd value is type INT8
  *        Example CHECK_LYD_VALUE(node->value, INT8, "12", 12);
+ *
  * @param[in] NODE           lyd_value variable
  * @param[in] CANNONICAL_VAL expected cannonical value
  * @param[in] VALUE          expected inteager value (-128 to 127).
@@ -998,6 +1051,7 @@
 /**
  * @brief Internal macro. Assert that lyd_value structure members are correct. Lyd value is type INT16
  *        Example CHECK_LYD_VALUE(node->value, INT8, "12", 12);
+ *
  * @param[in] NODE           lyd_value variable
  * @param[in] CANNONICAL_VAL expected cannonical value
  * @param[in] VALUE          expected inteager value.
@@ -1012,6 +1066,7 @@
 /**
  * @brief Internal macro. Assert that lyd_value structure members are correct. Lyd value is type UINT8.
  *        Example CHECK_LYD_VALUE(node->value, UINT8, "12", 12);
+ *
  * @param[in] NODE           lyd_value variable
  * @param[in] CANNONICAL_VAL expected cannonical value
  * @param[in] VALUE          expected inteager (0 to 255).
@@ -1026,6 +1081,7 @@
 /**
  * @brief Internal macro. Assert that lyd_value structure members are correct. Lyd value is type UINT32.
  *        Example CHECK_LYD_VALUE(node->value, UINT32, "12", 12);
+ *
  * @param[in] NODE           lyd_value variable
  * @param[in] CANNONICAL_VAL expected cannonical value
  * @param[in] VALUE          expected inteager (0 to MAX_UINT32).
@@ -1040,6 +1096,7 @@
 /**
  * @brief Internal macro. Assert that lyd_value structure members are correct. Lyd value is type STRING.
  *        Example CHECK_LYD_VALUE(node->value, STRING, "text");
+ *
  * @param[in] NODE           lyd_value variable
  * @param[in] CANNONICAL_VAL expected cannonical value
  */
@@ -1051,7 +1108,8 @@
 
 /**
  * @brief Internal macro. Assert that lyd_value structure members are correct. Lyd value is type LEAFREF
- * @brief Example CHECK_LYD_VALUE(node->value, LEAFREF, "");
+ *        Example CHECK_LYD_VALUE(node->value, LEAFREF, "");
+ *
  * @param[in] NODE           lyd_value variable
  * @param[in] CANNONICAL_VAL expected cannonical value
  */
@@ -1065,6 +1123,7 @@
 /**
  * @brief Internal macro. Assert that lyd_value structure members are correct. Lyd value is type DEC64
  *        Example CHECK_LYD_VALUE(node->value, DEC64, "125", 125);
+ *
  * @param[in] NODE           lyd_value variable
  * @param[in] CANNONICAL_VAL expected cannonical value
  * @param[in] VALUE          expected value 64bit inteager
@@ -1079,6 +1138,7 @@
 /**
  * @brief Internal macro. Assert that lyd_value structure members are correct. Lyd value is type BINARY.
  *        Example CHECK_LYD_VALUE(node->value, BINARY, "aGVs\nbG8=");
+ *
  * @param[in] NODE           lyd_value variable
  * @param[in] CANNONICAL_VAL expected cannonical value
  * @param[in] VALUE          expected value data
@@ -1099,6 +1159,7 @@
 /**
  * @brief Internal macro. Assert that lyd_value structure members are correct. Lyd value is type BOOL.
  *        Example CHECK_LYD_VALUE(node->value, BOOL, "true", 1);
+ *
  * @param[in] NODE           lyd_value variable
  * @param[in] CANNONICAL_VAL expected cannonical value
  * @param[in] VALUE          expected boolean value 0,1
@@ -1113,6 +1174,7 @@
 /**
  * @brief Internal macro. Assert that lyd_value structure members are correct. Lyd value is type IDENT.
  *        Example CHECK_LYD_VALUE(node->value, IDENT, "types:gigabit-ethernet", "gigabit-ethernet");
+ *
  * @param[in] NODE           lyd_value variable
  * @param[in] CANNONICAL_VAL expected cannonical value
  * @param[in] VALUE          expected ident name
@@ -1126,6 +1188,7 @@
 
 /**
  * @brief Macro testing parser when parsing incorrect module;
+ *
  * @param[in] DATA     String storing the schema module representation.
  * @param[in] FORMAT   Schema format of the @p DATA
  * @param[in] FEATURES Array of module's features to enable
@@ -1143,6 +1206,7 @@
 
 /**
  * @brief Add module (from a string) into the used libyang context.
+ *
  * @param[in] DATA     String storing the schema module representation.
  * @param[in] FORMAT   Schema format of the @p DATA
  * @param[in] FEATURES Array of module's features to enable
@@ -1157,6 +1221,7 @@
 /**
  * @brief Internal macro to compare error info record with the expected error message and path.
  * If NULL is provided as MSG, no error info record (NULL) is expected.
+ *
  * @param[in] ERR Error information record from libyang context.
  * @param[in] MSG Expected error message.
  * @param[in] PATH Expected error path.