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