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