Added Support for Union Type def resolving and bug fixes.
[controller.git] / opendaylight / sal / yang-prototype / code-generator / samples / maven-code-gen-sample / src / main / yang / controller-network.yang
1 module controller-network {
2         yang-version 1;
3         namespace "urn:opendaylight:controller:network";
4         prefix "topos";
5         
6         import ietf-inet-types { prefix "inet"; }
7         
8         revision 2013-05-20 {
9            description "Initial demo";
10         }
11         
12
13         
14         typedef topology-id {
15                 type string;
16         }
17
18         typedef node-id {
19                 type string;
20         }
21
22         typedef link-id {
23                 type string;
24         }
25
26         typedef tp-id {
27                 type string;
28                 description "identifier for termination points on a port";
29         }
30
31         typedef tp-ref {
32                 type leafref {
33                         path "/network/topologies/topology/nodes/node/termination-points/termination-point/tp-id";
34                 }
35         }
36         typedef topology-ref {
37                 type leafref {
38                         path "/network/topologies/topology/topology-id";
39                 }
40                 description "This type is used for leafs that reference topology identifier instance.";
41                 // currently not used
42         }
43
44         typedef node-ref {
45                 type leafref {
46                         path "/network/topologies/topology/nodes/node/node-id";
47                 }
48                 description "This type is used for leafs that reference a node instance.";
49         }
50
51         typedef link-ref {
52                 type leafref {
53                         path "/network/topologies/topology/links/link/link-id";
54                 }
55                 description "This type is used for leafs that reference a link instance.";
56                 // currently not used
57         }
58         
59         typedef network-element-ref {
60                 type leafref {
61                         path "/network/network-elements/network-element/element-id";
62                 }
63         }
64
65
66         typedef element-id {
67                 type string;
68         }
69         
70         container network {
71                 container topologies {
72                         list topology {
73                                 description "
74                                         This is the model of abstract topology which contains only Network
75                                         Nodes and Network Links. Each topology MUST be identified by
76                                         unique topology-id for reason that the store could contain many
77                                         topologies.
78                                 ";
79                                 key "topology-id";
80                                 leaf topology-id {
81                                         type topology-id; 
82                                         description "
83                                                 It is presumed that datastore will contain many topologies. To
84                                                 distinguish between topologies it is vital to have UNIQUE
85                                                 topology identifier.
86                                         ";
87                                 }
88
89                                 container types {
90                                         description "
91                                                 The container for definition of topology types.
92                                                 The augmenting modules should add empty optional leaf 
93                                                 to this container to signalize topology type.
94                                         ";
95                                 }
96
97                                 container nodes {
98                                         list node {
99                                                 description "The list of network nodes defined for topology.";
100
101                                                 key "node-id";
102                                                 leaf node-id {
103                                                         type node-id;
104                                                         description "The Topology identifier of network-node.";
105                                                 }
106
107                                                 leaf supporting-ne {
108                                                         type network-element-ref;
109                                                 }
110                                                 
111                                                 container termination-points {
112                                                         list termination-point {
113                                                                 key "tp-id";
114                                                                 leaf tp-id {
115                                                                         type tp-id;
116                                                                 }
117                                                         }
118                                                 }
119                                         }
120                                 }
121                 
122                                 container links {
123                                         list link {
124                                                 description "
125                                                         The Network Link which is defined by Local (Source) and
126                                                         Remote (Destination) Network Nodes. Every link MUST be
127                                                         defined either by identifier and his local and remote
128                                                         Network Nodes (in real applications it is common that many
129                                                         links are originated from one node and end up in same
130                                                         remote node). To ensure that we would always know to
131                                                         distinguish between links, every link SHOULD have
132                                                         identifier.
133                                                 ";
134                                                 key "link-id";
135                 
136                                                 leaf link-id {
137                                                         type link-id;
138                                                 }
139                                                 container source { 
140                                                         leaf source-node {
141                                                                 type node-ref;
142                                                                 description "Source node identifier.";
143                                                         }
144                                                         leaf source-tp {
145                                                                 type tp-ref;
146                                                         }
147                                                 }
148                                                 container destination { 
149                                                         leaf dest-node {
150                                                                 type node-ref;
151                                                                 description "Destination node identifier.";
152                                                         }
153                                                         leaf dest-tp {
154                                                                 type tp-ref;
155                                                         }
156                                                 }
157                                         }
158                                 }
159                         }
160                 }
161                 container network-elements {
162                         config true;
163                         list network-element {
164                                 key "element-id";
165                                 leaf element-id {
166                                         type element-id;
167                                 }
168                         }
169                 }
170         }
171 }