Added model generation from ietf-topology models
[yangtools.git] / model / ietf / ietf-topology-l3-unicast-igp / src / main / yang / l3-unicast-igp-topology@2013-07-12.yang
1 module l3-unicast-igp-topology {
2     yang-version 1;
3     namespace "urn:TBD:params:xml:ns:yang:nt:l3-unicast-igp-topology";
4     // replace with IANA namespace when assigned
5     prefix "l3t";
6     import network-topology {
7         prefix "nt";
8     }
9     
10     import ietf-inet-types {
11         prefix "inet";
12     }
13
14     organization "TBD";
15     contact "TBD";
16
17     revision "2013-07-12" {
18         description "Initial revision";
19         reference "TBD";
20     }
21     
22     typedef igp-event-type {
23         description "IGP Event type for notifications";
24         type enumeration {
25             enum "add" {
26                 value 0;
27                     description "An IGP node or link or prefix or termination-point has been added";
28             }
29             enum "remove" {
30                 value 1;
31                 description "An IGP node or link or prefix or termination-point has been removed";
32             }
33             enum "update" {
34                 value 2;
35                 description "An IGP node or link or prefix or termination-point has been updated";
36             }
37         }
38     } // igp-event-type
39
40     identity flag-identity {
41         description "Base type for flags";
42     }
43     identity undefined-flag {
44         base "flag-identity";
45     }
46     
47     typedef flag-type {
48         type identityref {
49             base "flag-identity";
50         }
51     }
52     
53     grouping igp-prefix-attributes {
54         leaf prefix {
55             type inet:ip-prefix;
56         }
57         leaf metric {
58             type uint32;
59         }
60         leaf-list flag {
61             type flag-type;
62         }
63     }
64     
65     grouping l3-unicast-igp-topology-type {
66         container l3-unicast-igp-topology {
67             presence "indicates L3 Unicast IGP Topology";
68         }
69     }
70     
71     grouping igp-topology-attributes {
72         container igp-topology-attributes { 
73             leaf name {
74                 description "Name of the topology";
75                     type string;
76             }
77             leaf-list flag {
78                 description "Topology flags";
79                 type flag-type;
80             }
81         }
82     }
83
84     grouping igp-node-attributes {
85         container igp-node-attributes {
86             leaf name {
87                 description "Node name";
88                 type inet:domain-name; 
89             }
90             leaf-list flag {
91                 description "Node operational flags";
92                 type flag-type; 
93             }
94             
95             leaf-list router-id {
96                 description "Router-id for the node";
97                 type inet:ip-address;
98             }
99             
100             list prefix {  
101                 key "prefix";
102                 uses igp-prefix-attributes; 
103             }
104         }
105     }
106
107     grouping igp-link-attributes {
108         container igp-link-attributes { 
109             leaf name {
110                 description "Link Name";
111                 type string;
112             }
113             leaf-list flag {
114                 description "Link flags";
115                 type flag-type; 
116             }
117             leaf metric {
118                 description "Link Metric";
119                 type uint32 {
120                     range "0..16777215"  {
121                         description "
122                         "; 
123                         // OSPF/ISIS supports max 3 byte metric. 
124                         // Ideally we would like this restriction to be
125                         // defined in the derived models, however,  
126                         // we are not allowed to augment a "must" statement. 
127                     }
128                 }
129             }
130         }
131     } // grouping igp-link-attributes
132
133     grouping igp-termination-point-attributes {
134         container igp-termination-point-attributes {
135             choice termination-point-type {  
136                 case ip {
137                    leaf-list ip-address {
138                     description "IPv4 or IPv6 address";
139                     type inet:ip-address;
140                     }
141                 }
142                 case unnumbered {
143                     leaf unnumbered-id {  
144                     description "Unnumbered interface identifier";
145                     type uint32;
146                     }
147                 }
148             }
149         }
150     } // grouping igp-termination-point-attributes
151     
152     
153     augment "/nt:network-topology/nt:topology/nt:topology-types" {  
154         uses l3-unicast-igp-topology-type; 
155     }
156     
157     
158     augment "/nt:network-topology/nt:topology" {
159         when "topology-types/l3-unicast-igp-topology";
160         uses igp-topology-attributes;  
161     }
162     
163     augment "/nt:network-topology/nt:topology/nt:node" {
164         when "../../topology-types/l3-unicast-igp-topology";
165         uses igp-node-attributes; 
166     }
167     
168
169     augment "/nt:network-topology/nt:topology/nt:link" {
170         when "../../topology-types/l3-unicast-igp-topology";
171         uses igp-link-attributes; 
172     }
173     augment "/nt:network-topology/nt:topology/nt:node/nt:termination-point" {
174         when "../../topology-types/l3-unicast-igp-topology";
175         uses igp-termination-point-attributes; 
176     }
177     
178     notification igp-node-event {
179         leaf igp-event-type {
180             type igp-event-type;
181         }
182         leaf topology-ref {
183             type nt:topology-ref;
184         }
185         uses l3-unicast-igp-topology-type; 
186         uses nt:node-attributes;
187         uses igp-node-attributes;
188     }
189
190     notification igp-link-event {
191         leaf igp-event-type {
192             type igp-event-type;
193         }
194         leaf topology-ref {
195             type nt:topology-ref;
196         }
197         uses l3-unicast-igp-topology-type; 
198         uses nt:link-attributes; 
199         uses igp-link-attributes; 
200     }
201
202     notification igp-prefix-event {
203         leaf igp-event-type {
204             type igp-event-type;
205         }
206         leaf topology-ref {
207             type nt:topology-ref;
208         }
209         leaf node-ref {
210             type nt:node-ref;
211         }
212         uses l3-unicast-igp-topology-type; 
213         container prefix {
214             uses igp-prefix-attributes;
215         }
216     }   
217
218     notification termination-point-event {
219         leaf igp-event-type {
220             type igp-event-type;
221         }
222         leaf topology-ref {
223             type nt:topology-ref;
224         }
225         leaf node-ref {
226             type nt:node-ref;
227         }
228         uses l3-unicast-igp-topology-type;
229         uses nt:tp-attributes;
230         uses igp-termination-point-attributes;
231     }
232 }