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