Populate data/ hierarchy
[yangtools.git] / data / yang-data-impl / src / test / resources / leafref-validation / leafref-validation3.yang
1 module leafref-validation3 {
2     namespace "leafref.validation3";
3     prefix val3;
4
5     container device_types {
6         list device_type {
7             key "type1 type2 type3";
8             leaf type1 {
9                 type string;
10             }
11             leaf type2 {
12                 type string;
13             }
14             leaf type3 {
15                 type string;
16             }
17             leaf desc {
18                 type string;
19             }
20         }
21     }
22
23     container devices {
24         list device {
25             key "type_text1 sn";
26             unique "sn";
27             leaf type_text1 {
28                 type leafref {
29                     path "/device_types/device_type/type1";
30                 }
31             }
32             leaf type_text2 {
33                 type leafref {
34                     path "/device_types/device_type/type2";
35                 }
36             }
37             leaf type_text3 {
38                 type leafref {
39                     path "/device_types/device_type/type3";
40                 }
41             }
42             leaf dev_desc {
43                 type leafref {
44                     path "/device_types/device_type[type1 = current()/../type_text1][type2
45                                         = current()/../type_text2][type3 = current()/../type_text3]/desc";
46                 }
47             }
48             leaf sn {
49                 type int32;
50             }
51             leaf default_ip {
52                 type string;
53             }
54         }
55     }
56
57     container chips {
58         list chip {
59             key "dev_type";
60             leaf dev_type {
61                 type leafref {
62                     path "/devices/device/type_text";
63                 }
64             }
65             leaf chip_desc {
66                 type string;
67             }
68         }
69     }
70 }