Hide binding.model.api.DefaultType
[mdsal.git] / binding / mdsal-binding-generator-impl / src / test / resources / mdsal161.yang
1 module mdsal161 {
2     namespace "mdsal161";
3     prefix "mdsal161";
4
5     // Reported case:
6     typedef revision-identifier {
7         type string {
8             pattern '\d{4}-\d{2}-\d{2}';
9         }
10     }
11
12     grouping grp {
13         leaf name {
14             type string;
15         }
16         leaf revision {
17             type union {
18                 type revision-identifier;
19                 type string { length 0; }
20             }
21         }
22     }
23
24     list with-grp {
25         key "name revision";
26
27         uses grp;
28     }
29
30     // Simpler case: same thing without the grouping
31     list without-grp {
32         key "name revision";
33
34         leaf name {
35             type string;
36         }
37         leaf revision {
38             type union {
39                 type revision-identifier;
40                 type string { length 0; }
41             }
42         }
43     }
44
45     // Two different cases: the type is defined in a grouping typedef
46     grouping grp-typedef {
47         typedef revision-type {
48             type union {
49                 type revision-identifier;
50                 type string { length 0; }
51             }
52         }
53
54         leaf name {
55             type string;
56         }
57         leaf revision {
58             type revision-type;
59         }
60     }
61
62     list with-grp-typedef {
63         key "name revision";
64
65         uses grp-typedef;
66     }
67
68     list without-grp-typedef {
69         typedef revision-type {
70             type union {
71                 type revision-identifier;
72                 type string { length 0; }
73             }
74         }
75
76         key "name revision";
77
78         leaf name {
79             type string;
80         }
81         leaf revision {
82             type revision-type;
83         }
84     }
85
86     // Another set of cases: the type is externally typedef'd
87     typedef ext-typedef {
88         type union {
89             type revision-identifier;
90             type string { length 0; }
91         }
92     }
93
94     grouping grp-ext {
95         leaf name {
96             type string;
97         }
98         leaf revision {
99             type ext-typedef;
100         }
101     }
102
103     list with-grp-ext {
104         key "name revision";
105
106         uses grp-ext;
107     }
108
109     list without-grp-ext {
110         key "name revision";
111
112         leaf name {
113             type string;
114         }
115         leaf revision {
116             type ext-typedef;
117         }
118     }
119 }
120