summaryrefslogtreecommitdiffstats
path: root/v3po/api/src/main/yang/dot1q-types.yang
blob: 594b9d6ce0baecc408f2c2dfdd945fe6cdbb3cf8 (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
module dot1q-types {
  namespace "urn:ieee:params:xml:ns:yang:dot1q-types";
  prefix dot1q;

  organization
    "Cisco Systems, Inc.
     Customer Service

     Postal: 170 W Tasman Drive
     San Jose, CA 95134

     Tel: +1 1800 553-NETS

     E-mail: cs-yang@cisco.com";

  contact
    "Robert Wilton - rwilton@cisco.com";

  description
    "This module contains a collection of generally useful YANG types
     that are specific to 802.1Q VLANs that can be usefully shared
     between multiple models.

     Terms and Acronyms

     802.1Q: IEEE 802.1Q VLANs

     VLAN (vlan): Virtual Local Area Network
     ";

  revision 2015-06-26 {
    description "Latest revision, changed namespace";

    reference "Intended to be standardized IEEE 802.1";
  }

  typedef PCP {
    type uint8 {
      range "0..7";
    }
    description
      "Priority Code Point. PCP is a 3-bit field that refers to the
       class of service applied to an 802.1Q VLAN tagged frame.  The
       field specifies a priority value between 0 and 7, these values
       can be used by quality of service (QoS) to prioritize
       different classes of traffic.";
    reference "IEEE 802.1Q (2014)";
  }

  /*
   * Defines what it means to be an 802.1Q VLAN Id, where values 0
   * and 4095 are reserved.
   */
  typedef dot1q-vlan-id {
    type uint16 {
      range "1..4094";
    }
    description "An 802.1Q VLAN Identifier";
    reference "IEEE 802.1Q (2014)";
  }

  /*
   * Defines the supported IEEE 802.1Q types that can be used for
   * VLAN tag matching.
   */
  identity dot1q-tag-vlan-type {
    description "Base identity from which all 802.1Q VLAN tag types
                 are derived from";
  }

  identity c-vlan {
    base dot1q-tag-vlan-type;
    description
      "An 802.1Q Customer-VLAN tag, normally using the 0x8100
       Ethertype";
  }

  identity s-vlan {
    base dot1q-tag-vlan-type;
    description
      "An 802.1Q Service-VLAN tag, using the 0x88a8 Ethertype
       originally introduced in 802.1ad, and incorporated into
       802.1Q (2011)";
  }

  typedef dot1q-tag-type {
    type identityref {
      base "dot1q-tag-vlan-type";
    }
    description "Identifies a specific 802.1Q tag type";
    reference "IEEE 802.1Q (2014)";
  }

  /*
   * Defines the type used to represent ranges of VLAN Ids.
   *
   * Ideally we would model that as a list of VLAN Ids in YANG, but
   * the model is easier to use if this is just represented as a
   * string.
   *
   * This type is used to match an ordered list of VLAN Ids, or
   * contiguous ranges of VLAN Ids.  Valid VLAN Ids must be in the
   * range 1 to 4094, and included in the list in non overlapping
   * ascending order.
   *
   * E.g. "1, 10-100, 50, 500-1000"
   */
  typedef dot1q-vlan-id-ranges {
    type string {
      pattern "([0-9]{1,4}(-[0-9]{1,4})?(,[0-9]{1,4}" +
              "(-[0-9]{1,4})?)*)";
    }
    description "A list of VLAN Ids, or non overlapping VLAN ranges,
                 in ascending order, between 1 and 4094";
  }

  /*
   * A grouping which represents an 802.1Q VLAN tag, matching both
   * the tag Ethertype and a single VLAN Id.  The PCP and DEI fields
   * in the 802.1Q tag are ignored for tag matching purposes.
   */
  grouping dot1q-tag {
    description "Grouping to allow configuration to identify a single
                 802.1Q VLAN tag";
    container dot1q-tag {
      description "Identifies an 802.1Q VLAN tag with an explicit
                   tag-type and a single VLAN Id";
      leaf tag-type {
        type dot1q-tag-type;
        mandatory true;
        description "VLAN tag type";
      }
      leaf vlan-id {
        type dot1q-vlan-id;
        mandatory true;
        description "VLAN Id";
      }
    }
  }

  /*
   * A grouping which represents an 802.1Q VLAN tag, matching both
   * the tag Ethertype and a single VLAN Id or "any" to match on any
   * VLAN Id.  The PCP and DEI fields in the 802.1Q tag are ignored
   * for tag matching purposes.
   */
  grouping dot1q-tag-or-any {
    description "Grouping to allow configuration to identify a single
                 802.1Q VLAN tag or the 'any' value to match any VLAN
                 Id not matched by a more specific VLAN Id match";
    container dot1q-tag {
      description "Identifies an 802.1Q VLAN tag with an explicit
                   tag-type and a single VLAN Id, or 'any' VLAN Id";
      leaf tag-type {
        type dot1q-tag-type;
        mandatory true;
        description "VLAN tag type";
      }
      leaf vlan-id {
        type union {
          type dot1q-vlan-id;
          type enumeration {
            enum "any" {
              value 4096;
              description
                "Matches 'any' VLAN tag in the range 1 to 4094 that
                 is not matched by a more specific VLAN Id match";
            }
          }
        }
        mandatory true;
        description "VLAN Id or any";
      }
    }
  }

  /*
   * A grouping which represents an 802.1Q tag that matches a range
   * of VLAN Ids.  The PCP and DEI fields in the 802.1Q tag are
   * ignored for tag matching purposes.
   */
  grouping dot1q-tag-ranges {
    description "Grouping to allow configuration to identify an
                 802.1Q VLAN tag that matches any VLAN Id within a
                 set of non overlapping VLAN Id ranges";
    container dot1q-tag {
      description "Identifies an 802.1Q VLAN tag with an explicit
                   tag-type and and a range of VLAN Ids";
      leaf tag-type {
        type dot1q-tag-type;
        mandatory true;
        description "VLAN tag type";
      }
      leaf vlan-ids {
        type dot1q-vlan-id-ranges;
        mandatory true;
        description "VLAN Ids";
      }
    }
  }

  /*
   * A grouping which represents an 802.1Q VLAN tag, matching both
   * the tag Ethertype and a single VLAN Id, ordered list of ranges,
   * or "any" to match on any VLAN Id.  The PCP and DEI fields in the
   * 802.1Q tag are ignored for tag matching purposes.
   */
  grouping dot1q-tag-ranges-or-any {
    description "Grouping to allow configuration to identify an
                 802.1Q VLAN tag that matches any specific VLAN Id
                 within a set of non overlapping VLAN Id ranges, or
                 the 'any' value to match any VLAN Id";
    container dot1q-tag {
      description "Identifies an 802.1Q VLAN tag with an explicit
                   tag-type, an ordered list of VLAN Id ranges, or
                   'any' VLAN Id";
      leaf tag-type {
        type dot1q-tag-type;
        mandatory true;
        description "VLAN tag type";
      }
      leaf vlan-id {
        type union {
          type dot1q-vlan-id-ranges;
          type enumeration {
            enum "any" {
              description "Matches 'any' VLAN tag in the range 1 to
                           4094";
            }
          }
        }
        mandatory true;
        description "VLAN Ids or any";
      }
    }
  }
}