Fixed some major sonar issues in yang-validation-tool
[yangtools.git] / model / ietf / ietf-topology-ospf / src / main / yang / ospf-topology@2013-10-21.yang
1 module ospf-topology {
2     yang-version 1;
3     namespace "urn:TBD:params:xml:ns:yang:ospf-topology";
4     // replace with IANA namespace when assigned
5
6     prefix "ospf";
7
8     import network-topology {
9         prefix "nt";
10         revision-date 2013-10-21;
11     }
12
13     import l3-unicast-igp-topology {
14         prefix "l3t";
15         revision-date 2013-10-21;
16     }
17     import ietf-inet-types {
18         prefix "inet";
19         revision-date 2010-09-24;
20     }
21     import ted {
22         prefix "ted";
23         revision-date 2013-10-21;
24     }
25
26     organization "TBD";
27     contact "TBD";
28     description "OSPF Topology model";
29
30     revision "2013-10-21" {
31         description "Initial revision";
32         reference "TBD";
33     }
34
35     typedef area-id {
36         description "OSPF Area ID";
37         type uint32;
38     }
39
40     grouping ospf-topology-type {
41         container ospf {
42             presence "indiates OSPF Topology";
43         }
44     }
45
46     augment "/nt:network-topology/nt:topology/nt:topology-types/l3t:l3-unicast-igp-topology" {
47         uses ospf-topology-type;
48     }
49
50     augment "/nt:network-topology/nt:topology/l3t:igp-topology-attributes" {
51         when "../nt:topology-types/l3t:l3-unicast-igp-topology/ospf";
52         container ospf-topology-attributes {
53             leaf area-id {
54                 type area-id;
55             }
56         }
57     }
58
59     augment "/nt:network-topology/nt:topology/nt:node/l3t:igp-node-attributes" {
60         when "../../nt:topology-types/l3t:l3-unicast-igp-topology/ospf";
61         uses ospf-node-attributes;
62     }
63
64     augment "/nt:network-topology/nt:topology/nt:link/l3t:igp-link-attributes" {
65         when "../../nt:topology-types/l3t:l3-unicast-igp-topology/ospf";
66         uses ospf-link-attributes;
67     }
68
69     augment "/nt:network-topology/nt:topology/nt:node/l3t:igp-node-attributes/l3t:prefix" {
70         when "../../../nt:topology-types/l3t:l3-unicast-igp-topology/ospf";
71         uses ospf-prefix-attributes;
72     }
73
74     grouping ospf-node-attributes {
75         container ospf-node-attributes {
76             choice router-type {
77                 case abr {
78                     leaf abr {
79                         type empty;
80                     }
81                 }
82                 case asbr {
83                     leaf asbr {
84                         type empty;
85                     }
86                 }
87                 case internal {
88                     leaf internal {
89                         type empty;
90                     }
91                 }
92                 case pseudonode {
93                     leaf pseudonode {
94                         type empty;
95                     }
96                 }
97             }
98             leaf dr-interface-id {
99                 when "../router-type/pseudonode";
100                 description "For pseudonodes, DR interface-id";
101                 default "0";
102                 type uint32;
103             }
104             leaf-list multi-topology-id {
105                 description "List of Multi-Topology Identifier up-to 128 (0-127). RFC 4915";
106                 max-elements "128";
107
108                 type uint8 {
109                     range "0..127";
110                 }
111             }
112             leaf capabilities {
113                 description "OSPF capabilities as bit vector. RFC 4970";
114                 type bits {
115                     bit graceful-restart-capable {
116                         position 0;
117                     }
118                     bit graceful-restart-helper {
119                         position 1;
120                     }
121                     bit stub-router-support {
122                         position 2;
123                     }
124                     bit traffic-engineering-support {
125                         position 3;
126                     }
127                     bit point-to-point-over-lan {
128                         position 4;
129                     }
130                     bit experimental-te {
131                         position 5;
132                     }
133                 }
134             }
135             container ted {
136                 uses ted:ted-node-attributes;
137             }
138         } // ospf
139     } // ospf-node-attributes
140
141     grouping ospf-link-attributes {
142         container ospf-link-attributes {
143             leaf multi-topology-id {
144                 type uint8 {
145                     range "0..127";
146                 }
147             }
148             container ted {
149                 uses ted:ted-link-attributes;
150             }
151         }
152     } // ospf-link-attributes
153
154     grouping ospf-prefix-attributes {
155         container ospf-prefix-attributes {
156
157             leaf forwarding-address {
158                 when "../../l3t:l3-unicast-igp-topology/l3t:ospf/l3t:router-type/l3t:asbr";
159                 type inet:ipv4-address;
160             }
161         }
162     }
163
164     augment "/l3t:igp-node-event" {
165         uses ospf-topology-type;
166         uses ospf:ospf-node-attributes;
167     }
168
169     augment "/l3t:igp-link-event" {
170         uses ospf-topology-type;
171         uses ospf:ospf-link-attributes;
172     }
173
174     augment "/l3t:igp-prefix-event" {
175         uses ospf-topology-type;
176         uses ospf:ospf-prefix-attributes;
177     }
178 }