@@ -1230,6 +1230,33 @@ schema_diff_enabled_features(const struct lys_module *mod, struct lyd_node *pare
12301230 return LY_SUCCESS ;
12311231}
12321232
1233+ /**
1234+ * @brief Create list of submodules of the module as part of cmp YANG data.
1235+ *
1236+ * @param[in] mod Module to use.
1237+ * @param[in,out] parent Node to append to.
1238+ * @return LY_ERR value.
1239+ */
1240+ static LY_ERR
1241+ schema_diff_submodules (const struct lys_module * mod ,struct lyd_node * parent )
1242+ {
1243+ LY_ERR rc = LY_SUCCESS ;
1244+ LY_ARRAY_COUNT_TYPE u ;
1245+ const struct lysp_submodule * submod ;
1246+ const char * revision ;
1247+
1248+ LY_ARRAY_FOR (mod -> parsed -> includes , u ) {
1249+ submod = mod -> parsed -> includes [u ].submodule ;
1250+
1251+ /* add the includes */
1252+ revision = submod -> revs ? submod -> revs [0 ].date : NULL ;
1253+ LY_CHECK_GOTO (rc = lyd_new_list (parent , NULL , "submodule" , 0 , NULL , submod -> name , revision ), cleanup );
1254+ }
1255+
1256+ cleanup :
1257+ return rc ;
1258+ }
1259+
12331260/**
12341261 * @brief Create cmp YANG data from module imports.
12351262 *
@@ -1264,6 +1291,8 @@ schema_diff_imports(const struct lys_module *mod, const struct lysc_node *schema
12641291 /* add the imports, recursively */
12651292 LY_CHECK_GOTO (rc = lyd_new_list (diff_list , NULL , schema -> name , 0 , & mod_list , imp -> name , imp -> revision ), cleanup );
12661293 LY_CHECK_GOTO (rc = schema_diff_enabled_features (imp , mod_list ), cleanup );
1294+ LY_CHECK_GOTO (rc = schema_diff_submodules (imp , mod_list ), cleanup );
1295+
12671296 LY_CHECK_GOTO (rc = schema_diff_imports (imp , schema , diff_list ), cleanup );
12681297 }
12691298
@@ -2049,6 +2078,7 @@ lysc_diff_tree(const struct lys_module *mod1, const struct lys_module *mod2, con
20492078 LY_CHECK_GOTO (rc = lyd_new_term (mod_cont , NULL , "module" , mod1 -> name , 0 , NULL ), cleanup );
20502079 LY_CHECK_GOTO (rc = lyd_new_term (mod_cont , NULL , "revision" , mod1 -> revision , 0 , NULL ), cleanup );
20512080 LY_CHECK_GOTO (rc = schema_diff_enabled_features (mod1 , mod_cont ), cleanup );
2081+ LY_CHECK_GOTO (rc = schema_diff_submodules (mod1 , mod_cont ), cleanup );
20522082
20532083 imp_schema = lys_find_path (NULL , diff_list -> schema , "source-import" , 0 );
20542084 LY_CHECK_GOTO (rc = schema_diff_imports (mod1 , imp_schema , diff_list ), cleanup );
@@ -2058,6 +2088,7 @@ lysc_diff_tree(const struct lys_module *mod1, const struct lys_module *mod2, con
20582088 LY_CHECK_GOTO (rc = lyd_new_term (mod_cont , NULL , "module" , mod2 -> name , 0 , NULL ), cleanup );
20592089 LY_CHECK_GOTO (rc = lyd_new_term (mod_cont , NULL , "revision" , mod2 -> revision , 0 , NULL ), cleanup );
20602090 LY_CHECK_GOTO (rc = schema_diff_enabled_features (mod2 , mod_cont ), cleanup );
2091+ LY_CHECK_GOTO (rc = schema_diff_submodules (mod2 , mod_cont ), cleanup );
20612092
20622093 imp_schema = lys_find_path (NULL , diff_list -> schema , "target-import" , 0 );
20632094 LY_CHECK_GOTO (rc = schema_diff_imports (mod2 , imp_schema , diff_list ), cleanup );
0 commit comments