Thomas Vachuska | 8ca75a2 | 2017-08-24 16:12:59 -0700 | [diff] [blame] | 1 | module openconfig-local-routing { |
| 2 | |
| 3 | yang-version "1"; |
| 4 | |
| 5 | // namespace |
| 6 | namespace "http://openconfig.net/yang/local-routing"; |
| 7 | |
| 8 | prefix "oc-loc-rt"; |
| 9 | |
| 10 | // import some basic types |
| 11 | import openconfig-inet-types { prefix inet; } |
| 12 | import openconfig-policy-types { prefix oc-pt; } |
| 13 | import openconfig-extensions { prefix oc-ext; } |
| 14 | import openconfig-interfaces { prefix oc-if; } |
| 15 | |
| 16 | // meta |
| 17 | organization "OpenConfig working group"; |
| 18 | |
| 19 | contact |
| 20 | "OpenConfig working group |
| 21 | www.openconfig.net"; |
| 22 | |
| 23 | description |
| 24 | "This module describes configuration and operational state data |
| 25 | for routes that are locally generated, i.e., not created by |
| 26 | dynamic routing protocols. These include static routes, locally |
| 27 | created aggregate routes for reducing the number of constituent |
| 28 | routes that must be advertised, summary routes for IGPs, etc. |
| 29 | |
| 30 | This model expresses locally generated routes as generically as |
| 31 | possible, avoiding configuration of protocol-specific attributes |
| 32 | at the time of route creation. This is primarily to avoid |
| 33 | assumptions about how underlying router implementations handle |
| 34 | route attributes in various routing table data structures they |
| 35 | maintain. Hence, the definition of locally generated routes |
| 36 | essentially creates 'bare' routes that do not have any protocol- |
| 37 | specific attributes. |
| 38 | |
| 39 | When protocol-specific attributes must be attached to a route |
| 40 | (e.g., communities on a locally defined route meant to be |
| 41 | advertised via BGP), the attributes should be attached via a |
| 42 | protocol-specific policy after importing the route into the |
| 43 | protocol for distribution (again via routing policy)."; |
| 44 | |
| 45 | oc-ext:openconfig-version "1.0.1"; |
| 46 | |
| 47 | revision "2017-05-15" { |
| 48 | description |
| 49 | "Update to resolve style guide non-compliance."; |
| 50 | reference "1.0.1"; |
| 51 | } |
| 52 | |
| 53 | revision "2016-05-11" { |
| 54 | description |
| 55 | "OpenConfig public release"; |
| 56 | reference "1.0.0"; |
| 57 | } |
| 58 | |
| 59 | |
| 60 | // identity statements |
| 61 | |
| 62 | identity LOCAL_DEFINED_NEXT_HOP { |
| 63 | description |
| 64 | "A base identity type of local defined next-hops"; |
| 65 | } |
| 66 | |
| 67 | identity DROP { |
| 68 | base LOCAL_DEFINED_NEXT_HOP; |
| 69 | description |
| 70 | "Discard traffic for the corresponding destination"; |
| 71 | } |
| 72 | |
| 73 | identity LOCAL_LINK { |
| 74 | base LOCAL_DEFINED_NEXT_HOP; |
| 75 | description |
| 76 | "Treat traffic towards addresses within the specified |
| 77 | next-hop prefix as though they are connected to a local |
| 78 | link. When the LOCAL_LINK next-hop type is specified, |
| 79 | an interface must also be specified such that |
| 80 | the local system can determine which link to trigger |
| 81 | link-layer address discovery against"; |
| 82 | } |
| 83 | |
| 84 | // typedef statements |
| 85 | |
| 86 | typedef local-defined-next-hop { |
| 87 | type identityref { |
| 88 | base LOCAL_DEFINED_NEXT_HOP; |
| 89 | } |
| 90 | description |
| 91 | "Pre-defined next-hop designation for locally generated |
| 92 | routes"; |
| 93 | } |
| 94 | |
| 95 | // grouping statements |
| 96 | |
| 97 | grouping local-generic-settings { |
| 98 | description |
| 99 | "Generic options that can be set on local routes When |
| 100 | they are defined"; |
| 101 | |
| 102 | leaf set-tag { |
| 103 | type oc-pt:tag-type; |
| 104 | description |
| 105 | "Set a generic tag value on the route. This tag can be |
| 106 | used for filtering routes that are distributed to other |
| 107 | routing protocols."; |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | grouping local-static-config { |
| 112 | description |
| 113 | "Configuration data for static routes."; |
| 114 | |
| 115 | leaf prefix { |
| 116 | type inet:ip-prefix; |
| 117 | description |
| 118 | "Destination prefix for the static route, either IPv4 or |
| 119 | IPv6."; |
| 120 | } |
| 121 | |
| 122 | uses local-generic-settings; |
| 123 | } |
| 124 | |
| 125 | grouping local-static-state { |
| 126 | description |
| 127 | "Operational state data for static routes"; |
| 128 | } |
| 129 | |
| 130 | |
| 131 | grouping local-static-nexthop-config { |
| 132 | description |
| 133 | "Configuration parameters related to each next-hop entry |
| 134 | specified for a static route"; |
| 135 | |
| 136 | leaf index { |
| 137 | type string; |
| 138 | description |
| 139 | "An user-specified identifier utilised to uniquely reference |
| 140 | the next-hop entry in the next-hop list. The value of this |
| 141 | index has no semantic meaning other than for referencing |
| 142 | the entry."; |
| 143 | } |
| 144 | |
| 145 | leaf next-hop { |
| 146 | type union { |
| 147 | type inet:ip-address; |
| 148 | type local-defined-next-hop; |
| 149 | } |
| 150 | description |
| 151 | "The next-hop that is to be used for the static route |
| 152 | - this may be specified as an IP address, an interface |
| 153 | or a pre-defined next-hop type - for instance, DROP or |
| 154 | LOCAL_LINK. When this leaf is not set, and the interface-ref |
| 155 | value is specified for the next-hop, then the system should |
| 156 | treat the prefix as though it is directly connected to the |
| 157 | interface."; |
| 158 | } |
| 159 | |
| 160 | leaf metric { |
| 161 | type uint32; |
| 162 | description |
| 163 | "A metric which is utilised to specify the preference of |
| 164 | the next-hop entry when it is injected into the RIB. The |
| 165 | lower the metric, the more preferable the prefix is. When |
| 166 | this value is not specified the metric is inherited from |
| 167 | the default metric utilised for static routes within the |
| 168 | network instance that the static routes are being |
| 169 | instantiated. When multiple next-hops are specified for a |
| 170 | static route, the metric is utilised to determine which of |
| 171 | the next-hops is to be installed in the RIB. When multiple |
| 172 | next-hops have the same metric (be it specified, or simply |
| 173 | the default) then these next-hops should all be installed |
| 174 | in the RIB"; |
| 175 | } |
| 176 | |
| 177 | leaf recurse { |
| 178 | type boolean; |
| 179 | default false; |
| 180 | description |
| 181 | "Determines whether the next-hop should be allowed to |
| 182 | be looked up recursively - i.e., via a RIB entry which has |
| 183 | been installed by a routing protocol, or another static route |
| 184 | - rather than needing to be connected directly to an |
| 185 | interface of the local system within the current network |
| 186 | instance. When the interface reference specified within the |
| 187 | next-hop entry is set (i.e., is not null) then forwarding is |
| 188 | restricted to being via the interface specified - and |
| 189 | recursion is hence disabled."; |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | grouping local-static-nexthop-state { |
| 194 | description |
| 195 | "Operational state parameters relating to a next-hop entry |
| 196 | for a static route"; |
| 197 | } |
| 198 | |
| 199 | |
| 200 | grouping local-static-top { |
| 201 | description |
| 202 | "Top-level grouping for the list of static route definitions"; |
| 203 | |
| 204 | container static-routes { |
| 205 | description |
| 206 | "Enclosing container for the list of static routes"; |
| 207 | |
| 208 | list static { |
| 209 | key "prefix"; |
| 210 | description |
| 211 | "List of locally configured static routes"; |
| 212 | |
| 213 | leaf prefix { |
| 214 | type leafref { |
| 215 | path "../config/prefix"; |
| 216 | } |
| 217 | description |
| 218 | "Reference to the destination prefix list key."; |
| 219 | } |
| 220 | |
| 221 | container config { |
| 222 | description |
| 223 | "Configuration data for static routes"; |
| 224 | |
| 225 | uses local-static-config; |
| 226 | } |
| 227 | |
| 228 | container state { |
| 229 | |
| 230 | config false; |
| 231 | |
| 232 | description |
| 233 | "Operational state data for static routes"; |
| 234 | |
| 235 | uses local-static-config; |
| 236 | uses local-static-state; |
| 237 | } |
| 238 | |
| 239 | container next-hops { |
| 240 | description |
| 241 | "Configuration and state parameters relating to the |
| 242 | next-hops that are to be utilised for the static |
| 243 | route being specified"; |
| 244 | |
| 245 | list next-hop { |
| 246 | key "index"; |
| 247 | |
| 248 | description |
| 249 | "A list of next-hops to be utilised for the static |
| 250 | route being specified."; |
| 251 | |
| 252 | leaf index { |
| 253 | type leafref { |
| 254 | path "../config/index"; |
| 255 | } |
| 256 | description |
| 257 | "A reference to the index of the current next-hop. |
| 258 | The index is intended to be a user-specified value |
| 259 | which can be used to reference the next-hop in |
| 260 | question, without any other semantics being |
| 261 | assigned to it."; |
| 262 | } |
| 263 | |
| 264 | container config { |
| 265 | description |
| 266 | "Configuration parameters relating to the next-hop |
| 267 | entry"; |
| 268 | |
| 269 | uses local-static-nexthop-config; |
| 270 | } |
| 271 | |
| 272 | container state { |
| 273 | config false; |
| 274 | description |
| 275 | "Operational state parameters relating to the |
| 276 | next-hop entry"; |
| 277 | |
| 278 | uses local-static-nexthop-config; |
| 279 | uses local-static-nexthop-state; |
| 280 | } |
| 281 | |
| 282 | uses oc-if:interface-ref; |
| 283 | } |
| 284 | } |
| 285 | } |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | grouping local-aggregate-config { |
| 290 | description |
| 291 | "Configuration data for aggregate routes"; |
| 292 | |
| 293 | leaf prefix { |
| 294 | type inet:ip-prefix; |
| 295 | description |
| 296 | "Aggregate prefix to be advertised"; |
| 297 | } |
| 298 | |
| 299 | leaf discard { |
| 300 | type boolean; |
| 301 | default false; |
| 302 | description |
| 303 | "When true, install the aggregate route with a discard |
| 304 | next-hop -- traffic destined to the aggregate will be |
| 305 | discarded with no ICMP message generated. When false, |
| 306 | traffic destined to an aggregate address when no |
| 307 | constituent routes are present will generate an ICMP |
| 308 | unreachable message."; |
| 309 | } |
| 310 | |
| 311 | uses local-generic-settings; |
| 312 | |
| 313 | } |
| 314 | |
| 315 | grouping local-aggregate-state { |
| 316 | description |
| 317 | "Operational state data for local aggregate advertisement |
| 318 | definitions"; |
| 319 | } |
| 320 | |
| 321 | grouping local-aggregate-top { |
| 322 | description |
| 323 | "Top-level grouping for local aggregates"; |
| 324 | |
| 325 | container local-aggregates { |
| 326 | description |
| 327 | "Enclosing container for locally-defined aggregate |
| 328 | routes"; |
| 329 | |
| 330 | list aggregate { |
| 331 | key "prefix"; |
| 332 | description |
| 333 | "List of aggregates"; |
| 334 | |
| 335 | leaf prefix { |
| 336 | type leafref { |
| 337 | path "../config/prefix"; |
| 338 | } |
| 339 | description |
| 340 | "Reference to the configured prefix for this aggregate"; |
| 341 | } |
| 342 | |
| 343 | container config { |
| 344 | description |
| 345 | "Configuration data for aggregate advertisements"; |
| 346 | |
| 347 | uses local-aggregate-config; |
| 348 | } |
| 349 | |
| 350 | container state { |
| 351 | |
| 352 | config false; |
| 353 | |
| 354 | description |
| 355 | "Operational state data for aggregate |
| 356 | advertisements"; |
| 357 | |
| 358 | uses local-aggregate-config; |
| 359 | uses local-aggregate-state; |
| 360 | } |
| 361 | } |
| 362 | } |
| 363 | } |
| 364 | |
| 365 | grouping local-routes-config { |
| 366 | description |
| 367 | "Configuration data for locally defined routes"; |
| 368 | } |
| 369 | |
| 370 | grouping local-routes-state { |
| 371 | description |
| 372 | "Operational state data for locally defined routes"; |
| 373 | } |
| 374 | |
| 375 | grouping local-routes-top { |
| 376 | description |
| 377 | "Top-level grouping for local routes"; |
| 378 | |
| 379 | container local-routes { |
| 380 | description |
| 381 | "Top-level container for local routes"; |
| 382 | |
| 383 | container config { |
| 384 | description |
| 385 | "Configuration data for locally defined routes"; |
| 386 | |
| 387 | uses local-routes-config; |
| 388 | } |
| 389 | |
| 390 | container state { |
| 391 | |
| 392 | config false; |
| 393 | |
| 394 | description |
| 395 | "Operational state data for locally defined routes"; |
| 396 | |
| 397 | uses local-routes-config; |
| 398 | uses local-routes-state; |
| 399 | } |
| 400 | |
| 401 | uses local-static-top; |
| 402 | uses local-aggregate-top; |
| 403 | } |
| 404 | } |
| 405 | |
| 406 | uses local-routes-top; |
| 407 | |
| 408 | } |