summaryrefslogtreecommitdiffstats
path: root/mpls/api/src/main/yang/hc2vpp-ietf-mpls-static@2017-07-02.yang
blob: 17e9cb599b1351752d9c0478dc598b48373f7f0d (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
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
module hc2vpp-ietf-mpls-static {

  namespace "urn:ietf:params:xml:ns:yang:ietf-mpls-static";

  prefix "mpls-static";

  import hc2vpp-ietf-mpls {
    prefix mpls;
  }

  /*
    TODO: HC2VPP-307 - Remove workarounds for ODL bugs from ietf-mpls YANG.
  */
  /*
    TODO: changed to modified version of ietf-routing that we use
    Set back to ietf-routing after HC2VPP-298 is resolved.
  */
  import hc2vpp-ietf-routing {
    prefix "rt";
  }

  import ietf-routing-types {
    prefix "rt-types";
  }

  import ietf-inet-types {
    prefix inet;
  }

  import ietf-interfaces {
    prefix "if";
  }

  /* Import TE generic types */
  /*
  Yangtools has some issues with ietf-te model.
  There is no plan to support tunnels currently, so we simply comment this out.
  TODO: remove comment after following issues are resolved:
  https://jira.opendaylight.org/browse/MDSAL-182
  https://jira.opendaylight.org/browse/YANGTOOLS-677

  import ietf-te {
    prefix te;
  }
*/

  organization "IETF MPLS Working Group";

  contact
    "WG Web:   <http://tools.ietf.org/wg/mpls/>

     WG List:  <mailto:mpls@ietf.org>

     WG Chair: Loa Andersson
               <mailto:loa@pi.nu>

     WG Chair: Ross Callon
               <mailto:rcallon@juniper.net>
     WG Chair: George Swallow
               <mailto:swallow.ietf@gmail.com>

     Editor:   Tarek Saad
               <mailto:tsaad@cisco.com>

     Editor:   Kamran Raza
               <mailto:skraza@cisco.com>

     Editor:   Rakesh Gandhi
               <mailto:rgandhi@cisco.com>

     Editor:   Xufeng Liu
               <mailto: xufeng.liu.ietf@gmail.com>

     Editor:   Vishnu Pavan Beeram
               <mailto:vbeeram@juniper.net>

     Editor:   Himanshu Shah
               <mailto:hshah@ciena.com>

     Editor:   Igor Bryskin
               <mailto: Igor.Bryskin@huawei.com>

     Editor:   Xia Chen
               <mailto:jescia.chenxia@huawei.com>

     Editor:   Raqib Jones
               <mailto:raqib@Brocade.com>

     Editor:   Bin Wen
               <mailto:Bin_Wen@cable.comcast.com>";

  description
     "This YANG module augments the 'ietf-routing' module with basic
     configuration and operational state data for MPLS static";

  /*
    TODO: 2017-07-02 defines grouping in-segment but does not use it.
    Bump to newer version after HC2VPP-306 is resolved.
  */
  revision "2017-07-02" {
    description
      "Latest revision:
        - Addressed MPLS-RT review comments";
    reference "RFC 3031: A YANG Data Model for Static MPLS LSPs";
  }

  typedef static-lsp-ref {
    type leafref {
      path "/rt:routing/mpls:mpls/mpls-static:static-lsps/" +
           "mpls-static:static-lsp/mpls-static:name";
    }
    description
      "This type is used by data models that need to reference
       configured static LSP.";
  }

  typedef mpls-operations-type {
    type enumeration {
      enum impose-and-forward {
        description
          "Operation impose outgoing label(s) and forward to
           next-hop";
      }
      enum pop-and-forward {
        description
          "Operation pop incoming label and forward to next-hop";
      }
      enum pop-impose-and-forward {
        description
          "Operation pop incoming label, impose one or more
           outgoing label(s) and forward to next-hop";
      }
      enum swap-and-forward {
        description
          "Operation swap incoming label, with outgoing label and
           forward to next-hop";
      }
      enum pop-and-lookup {
        description
          "Operation pop incoming label and perform a lookup";
      }
    }
    description "MPLS operations types";
  }

  grouping path-basic_config {
    description "common definitions for statics";

    leaf next-hop {
      type inet:ip-address;
      description "next hop IP address for the LSP";
    }

    leaf outgoing-label {
      type rt-types:mpls-label;
      description
        "label value to push at the current hop for the
         LSP";
    }

    leaf outgoing-interface {
      type if:interface-ref;
      description
        "The outgoing interface";
    }
  }

  grouping path-outgoing-labels_config {
    description "Path outgoing labels grouping";
    leaf index {
      type uint8 {
        range "0..255";
      }
      description
        "Index of the label. Index 0 indicates
         top of the label stack";
    }
    leaf label {
      type rt-types:mpls-label;
      description
        "The outgoing MPLS labels to impose";
    }
  }

  grouping path-outgoing-labels {
    description "Path outgoing labels grouping";
    container outgoing-labels {
      description "List of outgoing labels";
      list outgoing-labels {
        key "index";
        description "Outgoing label list";
        leaf index {
          type leafref {
            path "../config/index";
          }
          description
            "Index of the label. Index 0 indicates
             top of the label stack";
        }
        container config {
          description
            "Configuration intended parameters";
          uses path-outgoing-labels_config;
        }
        container state {
          config false;
          description
            "Configuration applied parameters and state";
          uses path-outgoing-labels_config;
        }
      }
    }
  }

  grouping path-properties_config {
    description
      "MPLS path properties";
    leaf path-index {
      type uint16;
      description
        "Path identifier";
    }

    leaf backup-path-index {
      type uint16;
      description
        "Backup path identifier";
    }

    leaf next-hop {
      type inet:ip-address;
      description
        "The address of the next-hop";
    }

    leaf outgoing-interface {
      type if:interface-ref;
      description
        "The outgoing interface";
    }

    leaf loadshare {
      type uint16;
      description
        "This value is used to compute a loadshare to perform un-equal
         load balancing when multiple outgoing path(s) are specified. A
         share is computed as a ratio of this number to the total under
         all configured path(s).";
    }

    leaf role {
      type enumeration {
        enum PRIMARY {
          description
            "Path as primary traffic carrying";
        }
        enum BACKUP {
          description
            "Path acts as backup";
        }
        enum PRIMARY_AND_BACKUP {
          description
            "Path acts as primary and backup simultaneously";
        }
      }
      description
        "The MPLS path role";
    }
  }

  grouping static-lsp-paths {
    description "Static LSP path grouping";
    choice out-segment {
      description "The MPLS out-segment type choice";
      case simple-path {
        container simple-path {
          description "Simple path container";
          container config {
            description
              "Holds the intended configuration";
            uses path-basic_config;
          }
          container state {
            config false;
            description
              "Holds the state and inuse configuration";
            uses path-basic_config;
          }
        }
      }
      case multiple-paths {
        container paths {
          description "List of outgoing paths";
          list path {
            key path-index;
            description
              "The list of MPLS paths associated with the FEC";
            leaf path-index {
              type leafref {
                path "../config/path-index";
              }
              description "Index of the path";
            }
            container config {
              description
                "Holds the intended configuration";
              uses path-properties_config;
            }
            container state {
              config false;
              description
                "Holds the state and inuse configuration";
              uses path-properties_config;
            }
          }
          uses path-outgoing-labels;
        }
      }
    }
  }

  grouping in-segment_config {
    description "In-segment grouping";
    choice type {
      description
        "Basic FEC choice";
      case ip-prefix {
        leaf ip-prefix {
          type inet:ip-prefix;
          description "An IP prefix";
        }
      }
      case mpls-label {
        leaf incoming-label {
          type rt-types:mpls-label;
          description "label value on the incoming packet";
        }
      }
      /* Import TE generic types */
      /*
      Yangtools has some issues with ietf-te model.
      There is no plan to support tunnels currently, so we simply comment this out.
      TODO: remove comment after following issues are resolved:
      https://jira.opendaylight.org/browse/MDSAL-182
      https://jira.opendaylight.org/browse/YANGTOOLS-677

      case tunnel {
        leaf tunnel {
          type te:tunnel-ref;
          description "TE tunnel FEC mapping";
        }
      }
      */
    }
    leaf incoming-interface {
      type if:interface-ref;
      description
        "Optional incoming interface if FEC is restricted
         to traffic incoming on a specific interface";
    }
  }

  grouping in-segment {
    description "In-segment grouping";
    container in-segment {
      description
        "MPLS incoming segment";
      container config {
        description
          "Holds the intended configuration";
        uses in-segment_config;
      }
      container state {
        config false;
        description
          "Holds the state and inuse configuration";
        uses in-segment_config;
      }
    }
  }

  grouping static-lsp-top_config {
    description "Static LSP configuration grouping";
    /*
    TODO: 2017-07-02 defines grouping in-segment but was not used - HC2VPP-306.
    Added it here as it was in static-lsp-config in 2017-03-10 revision.
    This will probably be fixed in next version of this model.
    */
    uses in-segment;
    leaf name {
      type string;
      description "name to identify the LSP";
    }
    leaf operation {
      type mpls-operations-type;
      description
        "The MPLS operation to be executed on the incoming packet";
    }
  }

  grouping static-lsp-top {
    description "common definitions for static LSPs";
    container config {
      description
        "Holds the intended configuration";
      uses static-lsp-top_config;
    }
    container state {
      config false;
      description
        "Holds the state and inuse configuration";
      uses static-lsp-top_config;
    }
  }

  augment "/rt:routing/mpls:mpls" {
    description "Augmentations for MPLS Static LSPs";
    container static-lsps {
      description
        "Statically configured LSPs, without dynamic signaling";
      list static-lsp {
        key name;
        description "list of defined static LSPs";
        leaf name {
          type leafref {
            path "../config/name";
          }
          description "name to identify the LSP";
        }
        uses static-lsp-top;
        uses static-lsp-paths;
      }
    }
  }
}