File: data_type.test

package info (click to toggle)
libyang 5.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 11,212 kB
  • sloc: ansic: 131,170; xml: 671; sh: 448; tcl: 325; makefile: 19
file content (107 lines) | stat: -rw-r--r-- 5,540 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
source [expr {[info exists ::env(TESTS_DIR)] ? "$env(TESTS_DIR)/non-interactive/ly.tcl" : "ly.tcl"}]

set mdir "$::env(YANG_MODULES_DIR)"
set ddir "$::env(TESTS_DIR)/data"
set modnc "$mdir/ietf-netconf@2011-06-01.yang"

test data_type_data {data --type data} {
    ly_cmd "-t data $mdir/modconfig.yang $ddir/modconfig.xml"
} {}

test data_type_config {data --type config} {
    ly_cmd_err "-t config $mdir/modconfig.yang $ddir/modconfig.xml" "Unexpected data state node \"lff\""
    ly_cmd "-t config $mdir/modconfig.yang $ddir/modconfig2.xml"
} {}

test data_type_get {data --type get} {
    ly_cmd_err "-t data $mdir/modleafref.yang $ddir/modleafref2.xml" "Invalid leafref value"
    ly_cmd "-t get $mdir/modleafref.yang $ddir/modleafref2.xml"
} {}

test data_type_getconfig_no_state {No state node for data --type getconfig} {
    ly_cmd_err "-t getconfig $mdir/modconfig.yang $ddir/modconfig.xml" "Unexpected data state node \"lff\""
    ly_cmd "-t getconfig $mdir/modconfig.yang $ddir/modconfig2.xml"
} {}

test data_type_getconfig_parse_only {No validation performed for data --type getconfig} {
    ly_cmd_err "-t data $mdir/modleafref.yang $ddir/modleafref2.xml" "Invalid leafref value"
    ly_cmd "-t getconfig $mdir/modleafref.yang $ddir/modleafref2.xml"
} {}

test data_type_edit_no_state {No state node for data --type edit} {
    ly_cmd_err "-t edit $mdir/modconfig.yang $ddir/modconfig.xml" "Unexpected data state node \"lff\""
    ly_cmd "-t edit $mdir/modconfig.yang $ddir/modconfig2.xml"
} {}

test data_type_edit_parse_only {No validation performed for data --type edit} {
    ly_cmd_err "-t data $mdir/modleafref.yang $ddir/modleafref2.xml" "Invalid leafref value"
    ly_cmd "-t edit $mdir/modleafref.yang $ddir/modleafref2.xml"
} {}

test data_type_rpc {Validation of rpc-statement by data --type rpc} {
    ly_cmd_err "-t rpc $mdir/modleaf.yang $ddir/modleaf.xml" "Missing the operation node."
    ly_cmd "-t rpc $mdir/modrpc.yang $ddir/modrpc.xml"
} {}

test data_type_rpc_nc {Validation of rpc-statement by data --type nc-rpc} {
    ly_cmd_err "-t nc-rpc $modnc $mdir/modleaf.yang $ddir/modleaf.xml" "Missing NETCONF <rpc> envelope"
    ly_cmd "-t nc-rpc $modnc $mdir/modrpc.yang $ddir/modrpc_nc.xml"
} {}

test data_type_rpc_reply {Validation of rpc-reply by data --type reply} {
    ly_cmd_err "-t rpc $mdir/modleaf.yang $ddir/modleaf.xml" "Missing the operation node."
    ly_cmd_wrn "-t reply -R $ddir/modrpc.xml $mdir/modrpc.yang $ddir/modrpc_reply.xml" "needed only for NETCONF"
    ly_cmd "-t reply $mdir/modrpc.yang $ddir/modrpc_reply.xml"
} {}

test data_type_rpc_reply_nc {Validation of rpc-reply by data --type nc-reply} {
    set err1 "Missing NETCONF <rpc-reply> envelope"
    ly_cmd_err "-t nc-reply -R $ddir/modrpc_nc.xml $mdir/modrpc.yang $mdir/modleaf.yang $ddir/modleaf.xml" $err1
    ly_cmd_err "-t nc-reply $mdir/modrpc.yang $ddir/modrpc_reply_nc.xml" "Missing source RPC"
    ly_cmd "-t nc-reply -R $ddir/modrpc_nc.xml $mdir/modrpc.yang $ddir/modrpc_reply_nc.xml"
} {}

test data_type_rpc_action {Validation of action-statement by data --type rpc} {
    ly_cmd_err "-t rpc $mdir/modleaf.yang $ddir/modleaf.xml" "Missing the operation node."
    ly_cmd "-t rpc -O $ddir/modaction_ds.xml $mdir/modaction.yang $ddir/modaction.xml"
} {}

test data_type_rpc_action_nc {Validation of action-statement by data --type nc-rpc} {
    ly_cmd_err "-t nc-rpc $mdir/modleaf.yang $ddir/modleaf.xml" "Missing NETCONF <rpc> envelope"
    ly_cmd "-t nc-rpc -O $ddir/modaction_ds.xml $mdir/modaction.yang $ddir/modaction_nc.xml"
} {}

test data_type_rpc_action_reply {Validation of action-reply by data --type reply} {
    ly_cmd_err "-t rpc $mdir/modleaf.yang $ddir/modleaf.xml" "Missing the operation node."
    ly_cmd "-t reply -O $ddir/modaction_ds.xml $mdir/modaction.yang $ddir/modaction_reply.xml"
} {}

test data_type_rpc_action_reply_nc {Validation of action-reply by data --type nc-reply} {
    set err1 "Missing NETCONF <rpc-reply> envelope"
    set err2 "operational parameter needed"
    ly_cmd_err "-t nc-reply -R $ddir/modaction_nc.xml $mdir/modaction.yang $mdir/modleaf.yang $ddir/modleaf.xml" $err1
    ly_cmd_err "-t nc-reply $mdir/modaction.yang $ddir/modaction_reply_nc.xml" "Missing source RPC"
    ly_cmd_err "-t nc-reply -R $ddir/modaction_nc.xml $mdir/modaction.yang $ddir/modaction_reply_nc.xml" $err2
    ly_cmd "-t nc-reply -O $ddir/modaction_ds.xml -R $ddir/modaction_nc.xml $mdir/modaction.yang $ddir/modaction_reply_nc.xml"
} {}

test data_type_notif {Validation of notification-statement by data --type notif} {
    ly_cmd_err "-t notif $mdir/modleaf.yang $ddir/modleaf.xml" "Missing the operation node."
    ly_cmd "-t notif $mdir/modnotif.yang $ddir/modnotif2.xml"
} {}

test data_type_notif_nc {Validation of notification-statement by data --type nc-notif} {
    ly_cmd_err "-t nc-notif $modnc $mdir/modleaf.yang $ddir/modleaf.xml" "Missing NETCONF <notification> envelope"
    ly_cmd "-t nc-notif $modnc $mdir/modnotif.yang $ddir/modnotif2_nc.xml"
} {}

test data_type_notif_nested {Validation of nested-notification-statement by data --type notif} {
    ly_cmd "-t notif -O $ddir/modnotif_ds.xml $mdir/modnotif.yang $ddir/modnotif.xml"
} {}

test data_type_notif_nested_nc {Validation of nested-notification-statement by data --type nc-notif} {
    ly_cmd_err "-t nc-notif $modnc $mdir/modleaf.yang $ddir/modleaf.xml" "Missing NETCONF <notification> envelope"
    ly_cmd "-t nc-notif -O $ddir/modnotif_ds.xml $modnc $mdir/modnotif.yang $ddir/modnotif_nc.xml"
} {}

cleanupTests