Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions schemas/module-a-dv.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module module-a-dv {

namespace "urn:jmu:params:xml:ns:yang:module-a-dv";
prefix dv;

import module-a {
prefix a;
}

description
"Contains some deviations to module-a";

deviation "/a:top/a:hidden" {
deviate not-supported;
}
}
21 changes: 21 additions & 0 deletions schemas/module-a-dv2.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module module-a-dv2 {

namespace "urn:jmu:params:xml:ns:yang:module-a-dv2";
prefix dv2;

import module-a {
prefix a;
}

description
"Contains some deviations to module-a";

deviation "/a:top/a:type" {
deviate add {
default "admin";
must "count(.) = 1";
}
}

}

23 changes: 23 additions & 0 deletions schemas/module-a.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module module-a {

namespace "urn:jmu:params:xml:ns:yang:module-a";
prefix a;

description "This is a simple user module";

container top {

leaf name {
type string;
}

leaf type {
type string;
}

leaf hidden {
type boolean;
}

}
}
1 change: 1 addition & 0 deletions src/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,7 @@ nc_server_get_cpblts_version(struct ly_ctx *ctx, LYS_VERSION version)
strcat(str, "&deviations=");
str_len += 12;
dev_count = 0;
v = 0;
while ((devmod = ly_ctx_get_module_iter(ctx, &v))) {
if (devmod == mod) {
continue;
Expand Down
9 changes: 9 additions & 0 deletions tests/test_server_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,9 @@ tls_client_thread(void *arg)
session = nc_connect_tls("127.0.0.1", 6501, NULL);
nc_assert(session);

/* verify some capabilities */
nc_assert( nc_session_cpblt(session, "urn:jmu:params:xml:ns:yang:module-a?module=module-a&deviations=module-a-dv,module-a-dv2") );

nc_session_free(session, NULL);

fprintf(stdout, "TLS client finished.\n");
Expand Down Expand Up @@ -657,6 +660,12 @@ main(void)
ctx = ly_ctx_new(TESTS_DIR"/../schemas", 0);
nc_assert(ctx);
ly_ctx_load_module(ctx, "ietf-netconf", NULL);

/* load some application models with deviations */
nc_assert( ly_ctx_load_module(ctx, "module-a", NULL) );
nc_assert( ly_ctx_load_module(ctx, "module-a-dv", NULL) );
nc_assert( ly_ctx_load_module(ctx, "module-a-dv2", NULL) );

nc_server_init(ctx);

pthread_barrier_init(&barrier, NULL, thread_count);
Expand Down