aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/yang/openconfig/openconfig-local-routing@2017-05-15.yang
blob: 5184fe7def391a2b0979091ea3842ff1da2d3ca3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
module openconfig-local-routing {

  yang-version "1";

  // namespace
  namespace "http://openconfig.net/yang/local-routing";

  prefix "oc-loc-rt";

  // import some basic types
  import openconfig-inet-types { prefix inet; }
  import openconfig-policy-types { prefix oc-pt; }
  import openconfig-extensions { prefix oc-ext; }
  import openconfig-interfaces { prefix oc-if; }

  // meta
  organization "OpenConfig working group";

  contact
    "OpenConfig working group
    www.openconfig.net";

  description
    "This module describes configuration and operational state data
    for routes that are locally generated, i.e., not created by
    dynamic routing protocols.  These include static routes, locally
    created aggregate routes for reducing the number of constituent
    routes that must be advertised, summary routes for IGPs, etc.

    This model expresses locally generated routes as generically as
    possible, avoiding configuration of protocol-specific attributes
    at the time of route creation.  This is primarily to avoid
    assumptions about how underlying router implementations handle
    route attributes in various routing table data structures they
    maintain.  Hence, the definition of locally generated routes
    essentially creates 'bare' routes that do not have any protocol-
    specific attributes.

    When protocol-specific attributes must be attached to a route
    (e.g., communities on a locally defined route meant to be
    advertised via BGP), the attributes should be attached via a
    protocol-specific policy after importing the route into the
    protocol for distribution (again via routing policy).";

  oc-ext:openconfig-version "1.0.1";

  revision "2017-05-15" {
    description
      "Update to resolve style guide non-compliance.";
    reference "1.0.1";
  }

  revision "2016-05-11" {
    description
      "OpenConfig public release";
    reference "1.0.0";
  }


  // identity statements

  identity LOCAL_DEFINED_NEXT_HOP {
    description
      "A base identity type of local defined next-hops";
  }

  identity DROP {
    base LOCAL_DEFINED_NEXT_HOP;
    description
      "Discard traffic for the corresponding destination";
  }

  identity LOCAL_LINK {
    base LOCAL_DEFINED_NEXT_HOP;
    description
      "Treat traffic towards addresses within the specified
      next-hop prefix as though they are connected to a local
      link. When the LOCAL_LINK next-hop type is specified,
      an interface must also be specified such that
      the local system can determine which link to trigger
      link-layer address discovery against";
  }

  // typedef statements

  typedef local-defined-next-hop {
    type identityref {
      base LOCAL_DEFINED_NEXT_HOP;
    }
    description
      "Pre-defined next-hop designation for locally generated
      routes";
  }

  // grouping statements

  grouping local-generic-settings {
    description
      "Generic options that can be set on local routes When
      they are defined";

    leaf set-tag {
      type oc-pt:tag-type;
      description
        "Set a generic tag value on the route. This tag can be
        used for filtering routes that are distributed to other
        routing protocols.";
    }
  }

  grouping local-static-config {
    description
      "Configuration data for static routes.";

    leaf prefix {
      type inet:ip-prefix;
      description
        "Destination prefix for the static route, either IPv4 or
        IPv6.";
    }

    uses local-generic-settings;
  }

  grouping local-static-state {
    description
      "Operational state data for static routes";
  }


  grouping local-static-nexthop-config {
    description
      "Configuration parameters related to each next-hop entry
      specified for a static route";

    leaf index {
      type string;
      description
        "An user-specified identifier utilised to uniquely reference
        the next-hop entry in the next-hop list. The value of this
        index has no semantic meaning other than for referencing
        the entry.";
    }

    leaf next-hop {
      type union {
        type inet:ip-address;
        type local-defined-next-hop;
      }
      description
        "The next-hop that is to be used for the static route
        - this may be specified as an IP address, an interface
        or a pre-defined next-hop type - for instance, DROP or
        LOCAL_LINK. When this leaf is not set, and the interface-ref
        value is specified for the next-hop, then the system should
        treat the prefix as though it is directly connected to the
        interface.";
    }

    leaf metric {
      type uint32;
      description
        "A metric which is utilised to specify the preference of
        the next-hop entry when it is injected into the RIB. The
        lower the metric, the more preferable the prefix is. When
        this value is not specified the metric is inherited from
        the default metric utilised for static routes within the
        network instance that the static routes are being
        instantiated. When multiple next-hops are specified for a
        static route, the metric is utilised to determine which of
        the next-hops is to be installed in the RIB. When multiple
        next-hops have the same metric (be it specified, or simply
        the default) then these next-hops should all be installed
        in the RIB";
    }

    leaf recurse {
      type boolean;
      default false;
      description
        "Determines whether the next-hop should be allowed to
        be looked up recursively - i.e., via a RIB entry which has
        been installed by a routing protocol, or another static route
        - rather than needing to be connected directly to an
        interface of the local system within the current network
        instance. When the interface reference specified within the
        next-hop entry is set (i.e., is not null) then forwarding is
        restricted to being via the interface specified - and
        recursion is hence disabled.";
    }
  }

  grouping local-static-nexthop-state {
    description
      "Operational state parameters relating to a next-hop entry
      for a static route";
  }


  grouping local-static-top {
    description
      "Top-level grouping for the list of static route definitions";

    container static-routes {
      description
        "Enclosing container for the list of static routes";

      list static {
        key "prefix";
        description
          "List of locally configured static routes";

        leaf prefix {
          type leafref {
            path "../config/prefix";
          }
          description
            "Reference to the destination prefix list key.";
        }

        container config {
          description
            "Configuration data for static routes";

          uses local-static-config;
        }

        container state {

          config false;

          description
            "Operational state data for static routes";

          uses local-static-config;
          uses local-static-state;
        }

        container next-hops {
          description
            "Configuration and state parameters relating to the
            next-hops that are to be utilised for the static
            route being specified";

          list next-hop {
            key "index";

            description
              "A list of next-hops to be utilised for the static
              route being specified.";

            leaf index {
              type leafref {
                path "../config/index";
              }
              description
                "A reference to the index of the current next-hop.
                The index is intended to be a user-specified value
                which can be used to reference the next-hop in
                question, without any other semantics being
                assigned to it.";
            }

            container config {
              description
                "Configuration parameters relating to the next-hop
                entry";

              uses local-static-nexthop-config;
            }

            container state {
              config false;
              description
                "Operational state parameters relating to the
                next-hop entry";

              uses local-static-nexthop-config;
              uses local-static-nexthop-state;
            }

            uses oc-if:interface-ref;
          }
        }
      }
    }
  }

  grouping local-aggregate-config {
    description
      "Configuration data for aggregate routes";

    leaf prefix {
      type inet:ip-prefix;
      description
        "Aggregate prefix to be advertised";
    }

    leaf discard {
      type boolean;
      default false;
      description
        "When true, install the aggregate route with a discard
        next-hop -- traffic destined to the aggregate will be
        discarded with no ICMP message generated.  When false,
        traffic destined to an aggregate address when no
        constituent routes are present will generate an ICMP
        unreachable message.";
    }

    uses local-generic-settings;

  }

  grouping local-aggregate-state {
    description
      "Operational state data for local aggregate advertisement
      definitions";
  }

  grouping local-aggregate-top {
    description
      "Top-level grouping for local aggregates";

    container local-aggregates {
      description
        "Enclosing container for locally-defined aggregate
        routes";

      list aggregate {
        key "prefix";
        description
          "List of aggregates";

        leaf prefix {
          type leafref {
            path "../config/prefix";
          }
          description
            "Reference to the configured prefix for this aggregate";
        }

        container config {
          description
            "Configuration data for aggregate advertisements";

          uses local-aggregate-config;
        }

        container state {

          config false;

          description
            "Operational state data for aggregate
            advertisements";

          uses local-aggregate-config;
          uses local-aggregate-state;
        }
      }
    }
  }

  grouping local-routes-config {
    description
      "Configuration data for locally defined routes";
  }

  grouping local-routes-state {
    description
      "Operational state data for locally defined routes";
  }

  grouping local-routes-top {
    description
      "Top-level grouping for local routes";

    container local-routes {
      description
        "Top-level container for local routes";

      container config {
        description
          "Configuration data for locally defined routes";

        uses local-routes-config;
      }

      container state {

        config false;

        description
          "Operational state data for locally defined routes";

        uses local-routes-config;
        uses local-routes-state;
      }

      uses local-static-top;
      uses local-aggregate-top;
    }
  }

  uses local-routes-top;

}