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