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