|
@@ -23,6 +23,72 @@
|
|
|
#include "pline.h"
|
|
|
|
|
|
|
|
|
+static int sr_ly_module_is_internal(const struct lys_module *ly_mod)
|
|
|
+{
|
|
|
+ if (!ly_mod->revision) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!strcmp(ly_mod->name, "ietf-yang-metadata")
|
|
|
+ && !strcmp(ly_mod->revision, "2016-08-05")) {
|
|
|
+ return 1;
|
|
|
+ } else if (!strcmp(ly_mod->name, "yang")
|
|
|
+ && !strcmp(ly_mod->revision, "2021-04-07")) {
|
|
|
+ return 1;
|
|
|
+ } else if (!strcmp(ly_mod->name, "ietf-inet-types")
|
|
|
+ && !strcmp(ly_mod->revision, "2013-07-15")) {
|
|
|
+ return 1;
|
|
|
+ } else if (!strcmp(ly_mod->name, "ietf-yang-types")
|
|
|
+ && !strcmp(ly_mod->revision, "2013-07-15")) {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+static int sr_module_is_internal(const struct lys_module *ly_mod, bool_t enable_nacm)
|
|
|
+{
|
|
|
+ if (!ly_mod->revision) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (sr_ly_module_is_internal(ly_mod)) {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!strcmp(ly_mod->name, "ietf-datastores")
|
|
|
+ && !strcmp(ly_mod->revision, "2018-02-14")) {
|
|
|
+ return 1;
|
|
|
+ } else if (!strcmp(ly_mod->name, "ietf-yang-schema-mount")) {
|
|
|
+ return 1;
|
|
|
+ } else if (!strcmp(ly_mod->name, "ietf-yang-library")) {
|
|
|
+ return 1;
|
|
|
+ } else if (!strcmp(ly_mod->name, "ietf-netconf")) {
|
|
|
+ return 1;
|
|
|
+ } else if (!strcmp(ly_mod->name, "ietf-netconf-with-defaults")
|
|
|
+ && !strcmp(ly_mod->revision, "2011-06-01")) {
|
|
|
+ return 1;
|
|
|
+ } else if (!strcmp(ly_mod->name, "ietf-origin")
|
|
|
+ && !strcmp(ly_mod->revision, "2018-02-14")) {
|
|
|
+ return 1;
|
|
|
+ } else if (!strcmp(ly_mod->name, "ietf-netconf-notifications")
|
|
|
+ && !strcmp(ly_mod->revision, "2012-02-06")) {
|
|
|
+ return 1;
|
|
|
+ } else if (!strcmp(ly_mod->name, "sysrepo")) {
|
|
|
+ return 1;
|
|
|
+ } else if (!strcmp(ly_mod->name, "sysrepo-monitoring")) {
|
|
|
+ return 1;
|
|
|
+ } else if (!strcmp(ly_mod->name, "sysrepo-plugind")) {
|
|
|
+ return 1;
|
|
|
+ } else if (!strcmp(ly_mod->name, "ietf-netconf-acm") && !enable_nacm) {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
static pexpr_t *pexpr_new(void)
|
|
|
{
|
|
|
pexpr_t *pexpr = NULL;
|
|
@@ -757,7 +823,7 @@ pline_t *pline_parse(sr_session_ctx_t *sess, faux_argv_t *argv, pline_opts_t *op
|
|
|
// Iterate all modules
|
|
|
i = 0;
|
|
|
while ((module = ly_ctx_get_module_iter(ctx, &i))) {
|
|
|
- if (sr_module_is_internal(module))
|
|
|
+ if (sr_module_is_internal(module, opts->enable_nacm))
|
|
|
continue;
|
|
|
if (!module->compiled)
|
|
|
continue;
|