Merge branch 'master' of ../controller
[yangtools.git] / yang / yang-maven-plugin-it / src / test / resources / test-parent / GenerateTest1 / src / main / resources / testfile2.yang
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 module types2 {
9     yang-version 1;
10     namespace "urn:simple.types.data.demo.types2";
11     prefix "t2";
12     
13     organization "opendaylight";
14     contact "http://www.opendaylight.org/";
15     
16     description "This is types-data test description";
17
18     revision "2013-02-27" {
19         reference " WILL BE DEFINED LATER";
20     }
21     
22     typedef my-base-int32-type {
23         type int32 {
24             range "2..20";
25         }
26     }
27
28     typedef my-type1 {
29         type my-base-int32-type {
30             range "11..max";
31         }
32         units "mile";
33         default "11";
34     }
35     
36     typedef my-custom-string {
37         type string {
38             pattern "[a-k]*";
39             length "5..11";
40         }
41     }
42     
43     typedef my-string-type {
44         type my-custom-string {
45             length "5..10";
46         }
47     }
48     
49     typedef my-string-type2 {
50         type my-string-type {
51             pattern "[b-u]*";
52         }
53     }
54
55     typedef my-string-type-ext {
56         type my-string-type2 {
57             pattern "[e-z]*";
58         }
59     }
60
61     typedef my-int-type {
62         type int32 {
63             range "10..20";
64         }
65     }
66     
67     typedef my-int-type2 {
68         type my-int-type {
69             range "12..18";
70         }
71     }
72     
73     typedef my-int-type-ext {
74         type my-int-type2 {
75             range "14..16";
76         }
77     }
78     
79     typedef my-decimal-type {
80         type decimal64 {
81             fraction-digits 6;
82         }
83     }
84     
85     typedef my-decimal-type-ext {
86         type decimal64 {
87             fraction-digits 5;
88         }
89     }
90
91     typedef my-union {
92         type union {
93                 type int16 {
94                         range "1..100";
95                 }
96                 type int32;
97         }
98     }
99
100     typedef my-union-ext {
101         type my-union;
102     }
103
104     typedef nested-union1 {
105         type nested-union2;
106     }
107
108     typedef nested-union2 {
109         type union {
110                 type my-union-ext;
111                 type string;
112         }
113     }
114
115     leaf if-name {
116         type leafref {
117             path "/interface/name";
118         }
119     }
120      
121     leaf name {
122         type string;
123     }
124      
125     leaf nested-type-leaf {
126         type my-type1;
127     }
128     
129     extension c-define {
130         description
131         "Takes as argument a name string.
132         Makes the code generator use the given name in the
133         #define.";
134         argument "name" {
135             yin-element "true";
136         }
137     }
138     
139     container system {
140         leaf user {
141             type string;
142         }
143     }
144     
145     grouping target {
146         leaf address {
147             type string;
148             description "Target IP address";
149         }
150         container port {
151             description "Target port container";
152         }
153     }
154
155     container peer {
156         container destination {
157             uses target {
158                 refine address {
159                     default "1.2.3.4";
160                 }
161                 refine port {
162                     description "new port description updated by refine";
163                 }
164             }
165         }
166     }
167     
168     container interfaces {
169          list ifEntry {
170              key "ifIndex";
171
172              leaf ifIndex {
173                  type uint32;
174                  units minutes;
175              }
176              
177              leaf ifMtu {
178                  type int32;
179              }
180          }
181     }
182
183 }