Added more tests for yang parser. Updated current tests.
[controller.git] / opendaylight / sal / yang-prototype / code-generator / yang-model-parser-impl / src / test / resources / model / types.yang
1 module types {
2     yang-version 1;
3     namespace "urn:simple.types.test";
4     prefix "t";
5     
6     organization "opendaylight";
7     contact "http://www.opendaylight.org/";
8     description "This is types-data test description";
9
10     revision "2013-07-03" {
11         reference " WILL BE DEFINED LATER";
12     }
13
14     typedef int32-ext1 {
15         type int32 {
16             range "2..20";
17         }
18     }
19
20     typedef int32-ext2 {
21         type int32-ext1 {
22             range "3..9|11..max";
23         }
24         units "mile";
25         default "11";
26     }
27
28     typedef string-ext1 {
29         type string {
30             pattern "[a-k]*";
31             length "5..11";
32         }
33     }
34
35     typedef string-ext2 {
36         type string-ext1 {
37             length "6..10";
38         }
39     }
40     
41     typedef string-ext3 {
42         type string-ext2 {
43             pattern "[b-u]*";
44         }
45     }
46
47     typedef string-ext4 {
48         type string-ext3 {
49             pattern "[e-z]*";
50         }
51     }
52
53     typedef my-decimal-type {
54         type decimal64 {
55             fraction-digits 6;
56         }
57     }
58
59     typedef my-union {
60         type union {
61             type int16 {
62                 range "1..100";
63             }
64             type int32;
65         }
66     }
67
68     typedef my-union-ext {
69         type my-union;
70     }
71
72     typedef nested-union2 {
73         type union {
74             type my-union-ext;
75             type string;
76         }
77     }
78
79     container interfaces {
80          list ifEntry {
81              key "ifIndex";
82
83              leaf ifIndex {
84                  type uint32;
85                  units minutes;
86              }
87
88              leaf ifMtu {
89                  type int32;
90              }
91
92              min-elements 1;
93              max-elements 11;
94          }
95     }
96
97 }