303edc295d770d1cfe898a42507292821bb5d791
[controller.git] / opendaylight / sal / yang-prototype / code-generator / code-generator-demo / src / main / resources / demo-topology.yang
1 module demo-topology {
2     yang-version 1;
3     namespace "urn:demo.simple-topology";
4     prefix "tp";
5     import simple-list-demo { prefix "simple"; revision-date 2008-01-01; }
6     import controller-network {prefix "cn";}
7         import mount  {prefix "mnt";}
8
9     organization "OPEN DAYLIGHT";
10     contact "http://www.opendaylight.org/";
11
12     description "
13         This module contains the definitions of elements that creates network 
14         topology i.e. definition of network nodes and links. This module is
15         not designed to be used solely for network representation. This module
16         SHOULD be used as base module in defining the network topology.
17     ";
18
19     revision "2013-02-08"{
20         reference " WILL BE DEFINED LATER";
21     }
22     
23     
24     
25     
26     
27     deviation /base:system/base:user/base:type {
28          deviate add {
29              default "admin"; // new users are 'admin' by default
30          }
31      }
32      
33     deviation /base:system/base:name-server {
34          deviate replace {
35              max-elements 3;
36          }
37      }
38      
39      deviation "/base:system" {
40          deviate delete {
41              must "daytime or time";
42          }
43      }
44      
45      
46      
47      
48      
49     
50     grouping target {
51         status "current";
52          leaf address {
53              type inet:ip-address;
54              description "Target IP address";
55          }
56          leaf port {
57              type inet:port-number;
58              description "Target port number";
59          }
60      }
61      
62      augment "/cn:network/cn:topologies/cn:topology" {
63         container prefixes {
64             container "prefix" {
65                 leaf id {
66                     type string;
67
68                     description "";
69                 }
70
71                 leaf-list advertising-node-id {
72                     type cn:node-ref;
73
74                     description "";
75                 }
76             }
77         }
78         mnt:mountpoint point  {
79                 mnt:target-ref target;
80            
81             } 
82     }
83
84      container peer {
85          container destination {
86              uses target;
87          }
88      }
89
90     container topology {
91     
92         leaf ifType {
93              type enumeration {
94                  enum ethernet;
95                  enum atm;
96              }
97          }
98          leaf ifMTU {
99              type uint32;
100          }
101          must "ifType != 'ethernet' or " +
102               "(ifType = 'ethernet' and ifMTU = 1500)" {
103              error-message "An ethernet MTU must be 1500";
104          }
105     
106         presence "test-presence";
107     
108         description "
109             This is the model of abstract topology which contains only Network
110             Nodes and Network Links. Each topology MUST be identified by
111             unique topology-id for reason that the store could contain many
112             topologies.
113         ";
114
115         leaf topology-id {
116             type string;
117             description "
118                 It is presumed that datastore will contain many topologies. To
119                 distinguish between topologies it is vital to have UNIQUE
120                 topology identifier.
121             ";
122         }
123
124         container network-nodes {
125             list network-node {
126                 ordered-by system;
127                 description "The list of network nodes defined for topology.";
128
129                 key "node-id";
130
131                 leaf node-id {
132                     type string;
133                     description "The Topology identifier of network-node.";
134                 }
135                 
136                 list network-interface {
137                     key "interface-id";
138                     
139                     leaf interface-id {
140                         type uint8;
141                     }
142                     
143                     leaf interface-address {
144                         type string;
145                     }
146                 }
147                 
148                 container node-attributes {
149                     description "
150                         Additional attributes that can Network Node contains.
151                     ";
152
153                     leaf geo-latitude {
154                         type decimal64 {
155                             fraction-digits 2;
156                         }
157                         config true;
158                     }
159
160                     leaf geo-longitude {
161                         type decimal64 {
162                             fraction-digits 2;
163                         }
164                         config true;
165                     }
166                 }
167             }
168         }
169         
170         container network-links {
171             list network-link {
172                 description "
173                     The Network Link which is defined by Local (Source) and
174                     Remote (Destination) Network Nodes. Every link MUST be
175                     defined either by identifier and his local and remote
176                     Network Nodes (in real applications it is common that many
177                     links are originated from one node and end up in same
178                     remote node). To ensure that we would always know to
179                     distinguish between links, every link SHOULD have
180                     identifier.
181                 ";
182                 key "link-id";
183
184                 leaf link-id {
185                     type string;
186                     description "";
187                 }
188
189                 container source {
190                     leaf node-id {
191                         type string;
192                         description "Source node identifier.";
193                     }
194                 }
195
196                 container destination {
197                     leaf node-id {
198                         type string;
199                         description "Destination node identifier.";
200                     }
201                 }
202
203                 container link-attributes {
204                     description "Aditional attributes that can Network Link contains.";
205                 }
206             }
207         }
208     }
209     
210     rpc activate-software-image {
211          input {
212              leaf image-name {
213                  type string;
214              }
215          }
216          output {
217              leaf status {
218                  type string;
219              }
220          }
221      }
222      
223 }