Implement fetching of enabled features
Change-Id: I298a3ffeba4606bd0111460830e9ec60682e5f32
diff --git a/src/sysrepo_access.cpp b/src/sysrepo_access.cpp
index 2c80c2d..f84bb91 100644
--- a/src/sysrepo_access.cpp
+++ b/src/sysrepo_access.cpp
@@ -93,8 +93,13 @@
return fetchSchema(moduleName, revision, submodule);
});
- for (const auto& it : listImplementedSchemas()) {
- m_schema->loadModule(it);
+ for (const auto& it : listSchemas()) {
+ if (it->implemented()) {
+ m_schema->loadModule(it->module_name());
+ for (unsigned int i = 0; i < it->enabled_feature_cnt(); i++) {
+ m_schema->enableFeature(it->module_name(), it->enabled_features(i));
+ }
+ }
}
}
@@ -205,9 +210,9 @@
return schema;
}
-std::vector<std::string> SysrepoAccess::listImplementedSchemas()
+std::vector<std::shared_ptr<sysrepo::Yang_Schema>> SysrepoAccess::listSchemas()
{
- std::vector<std::string> res;
+ std::vector<sysrepo::S_Yang_Schema> res;
std::shared_ptr<sysrepo::Yang_Schemas> schemas;
try {
schemas = m_session->list_schemas();
@@ -216,8 +221,7 @@
}
for (unsigned int i = 0; i < schemas->schema_cnt(); i++) {
auto schema = schemas->schema(i);
- if (schema->implemented())
- res.push_back(schema->module_name());
+ res.push_back(schema);
}
return res;
}