Test for nested union in typedef and leaf added.
[yangtools.git] / code-generator / binding-generator-impl / src / test / resources / bit_and_union.yang
1 module bit-and-union-in-leaf {
2
3     namespace "urn:bit:union:in:leaf";
4     prefix "sbd";
5
6     organization "OPEN DAYLIGHT";
7     contact "http://www.opendaylight.org/";
8
9     revision 2013-06-26 {
10
11     }
12
13     typedef union-typedef {
14         type union {
15             type string {
16                 pattern "[a-g]";
17             }
18             type int16;
19         }
20     }
21
22     typedef union-typedef2 {
23         type union {
24             type string; 
25             type int16;
26         }
27     }    
28
29     container parent-container {
30         leaf bit-leaf {
31             type bits {
32                 bit first-bit;
33                 bit second-bit;
34                 bit third-bit;
35             }
36         }
37
38         leaf union-leaf {
39             type union {
40                 type int32;
41                 type string {
42                     pattern "[a-z]";
43                 }
44                 type string {
45                     pattern "[0-9]*";
46                 }
47                 type string {
48                     pattern "[a-d]*";
49                     pattern "[0-5]*";
50                 }
51                 type uint8;
52             }
53         }
54         
55 // nested union in leaf   
56         leaf lf {
57             type union {
58                                 type string;
59                                 type union {
60                                         type uint32;
61                                         type int8;
62                                         type string;
63                                         type union {
64                                                 type string;
65                                                 type uint64;
66                                         }       
67                                 }
68                         }               
69                 }        
70     }
71     
72
73
74 // nested union in typedef      
75         typedef type-union {
76                 type union {
77                         type string;
78                         type union {
79                                 type uint32;
80                                 type int8;
81                                 type string;    
82                                 type union {
83                                         type string;
84                                         type uint64;
85                                 }                               
86                         }
87                 }       
88                 
89         }    
90 }