aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/yang/openconfig/openconfig-packet-match-types@2018-11-21.yang
blob: 1b93d52059c9cfe3a1ef82d64317e0cbd12411d3 (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
module openconfig-packet-match-types {

  yang-version "1";

  // namespace
  namespace "http://openconfig.net/yang/packet-match-types";

  prefix "oc-pkt-match-types";

  // import some basic types
  import openconfig-inet-types { prefix oc-inet; }
  import openconfig-extensions { prefix oc-ext; }


  // meta
  organization "OpenConfig working group";

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

  description
    "This module defines common types for use in models requiring
    data definitions related to packet matches.";

  oc-ext:openconfig-version "1.0.2";

  revision "2018-11-21" {
    description
      "Add OpenConfig module metadata extensions.";
    reference "1.0.2";
  }

  revision "2018-04-15" {
    description
        "Corrected description and range for ethertype typedef";
    reference "1.0.1";
  }

  revision "2017-05-26" {
    description
        "Separated IP matches into AFs";
    reference "1.0.0";
  }

    revision "2016-08-08" {
    description
      "OpenConfig public release";
    reference "0.2.0";
  }

  revision "2016-04-27" {
    description
      "Initial revision";
    reference "TBD";
  }

  // OpenConfig specific extensions for module metadata.
  oc-ext:regexp-posix;
  oc-ext:catalog-organization "openconfig";
  oc-ext:origin "openconfig";


  // extension statements

  // feature statements

  // identity statements


  //TODO: should replace this with an official IEEE module
  // when available.  Only a select number of types are
  // defined in this identity.
  identity ETHERTYPE {
    description
      "Base identity for commonly used Ethertype values used
      in packet header matches on Ethernet frames.  The Ethertype
      indicates which protocol is encapsulated in the Ethernet
      payload.";
    reference
      "IEEE 802.3";
  }

  identity ETHERTYPE_IPV4 {
    base ETHERTYPE;
    description
      "IPv4 protocol (0x0800)";
  }

  identity ETHERTYPE_ARP {
    base ETHERTYPE;
    description
      "Address resolution protocol (0x0806)";
  }

  identity ETHERTYPE_VLAN {
    base ETHERTYPE;
    description
      "VLAN-tagged frame (as defined by IEEE 802.1q) (0x8100). Note
      that this value is also used to represent Shortest Path
      Bridging (IEEE 801.1aq) frames.";
  }

  identity ETHERTYPE_IPV6 {
    base ETHERTYPE;
    description
      "IPv6 protocol (0x86DD)";
  }

  identity ETHERTYPE_MPLS {
    base ETHERTYPE;
    description
      "MPLS unicast (0x8847)";
  }

  identity ETHERTYPE_LLDP {
    base ETHERTYPE;
    description
      "Link Layer Discovery Protocol (0x88CC)";
  }

  identity ETHERTYPE_ROCE {
    base ETHERTYPE;
    description
      "RDMA over Converged Ethernet (0x8915)";
  }


  //TODO: should replace this with an official IANA module when
  //available.  Only a select set of protocols are defined with
  //this identity.
  identity IP_PROTOCOL {
    description
      "Base identity for commonly used IP protocols used in
      packet header matches";
    reference
      "IANA Assigned Internet Protocol Numbers";
  }

  identity IP_TCP {
    base IP_PROTOCOL;
    description
      "Transmission Control Protocol (6)";
  }

  identity IP_UDP  {
    base IP_PROTOCOL;
    description
      "User Datagram Protocol (17)";
  }

  identity IP_ICMP {
    base IP_PROTOCOL;
    description
      "Internet Control Message Protocol (1)";
  }

  identity IP_IGMP {
    base IP_PROTOCOL;
    description
      "Internet Group Membership Protocol (2)";
  }

  identity IP_PIM {
    base IP_PROTOCOL;
    description
      "Protocol Independent Multicast (103)";
  }

  identity IP_RSVP {
    base IP_PROTOCOL;
    description
      "Resource Reservation Protocol (46)";
  }

  identity IP_GRE {
    base IP_PROTOCOL;
    description
      "Generic Routing Encapsulation (47)";
  }

  identity IP_AUTH {
    base IP_PROTOCOL;
    description
      "Authentication header, e.g., for IPSEC (51)";
  }

  identity IP_L2TP {
    base IP_PROTOCOL;
    description
      "Layer Two Tunneling Protocol v.3 (115)";
  }



  identity TCP_FLAGS {
    description
      "Common TCP flags used in packet header matches";
    reference
      "IETF RFC 793 - Transmission Control Protocol
      IETF RFC 3168 - The Addition of Explicit Congestion
      Notification (ECN) to IP";
  }

  identity TCP_SYN {
    base TCP_FLAGS;
    description
      "TCP SYN flag";
  }

  identity TCP_FIN {
    base TCP_FLAGS;
    description
      "TCP FIN flag";
  }

  identity TCP_RST {
    base TCP_FLAGS;
    description
      "TCP RST flag";
  }

  identity TCP_PSH {
    base TCP_FLAGS;
    description
      "TCP push flag";
  }

  identity TCP_ACK {
    base TCP_FLAGS;
    description
      "TCP ACK flag";
  }

  identity TCP_URG {
    base TCP_FLAGS;
    description
      "TCP urgent flag";
  }

  identity TCP_ECE {
    base TCP_FLAGS;
    description
      "TCP ECN-Echo flag.  If the SYN flag is set, indicates that
      the TCP peer is ECN-capable, otherwise indicates that a
      packet with Congestion Experienced flag in the IP header
      is set";
  }

  identity TCP_CWR {
    base TCP_FLAGS;
    description
      "TCP Congestion Window Reduced flag";
  }

  // typedef statements

  typedef port-num-range {
    type union {
      type string {
        pattern '^(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?[0-9]?' +
          '[0-9]?)\.\.(6[0-5][0-5][0-3][0-5]|[0-5]?[0-9]?[0-9]?' +
          '[0-9]?[0-9]?)$';
      }
      type oc-inet:port-number;
      type enumeration {
        enum ANY {
          description
            "Indicates any valid port number (e.g., wildcard)";
        }
      }
    }
    description
      "Port numbers may be represented as a single value,
      an inclusive range as <lower>..<higher>, or as ANY to
      indicate a wildcard.";
  }

  typedef ip-protocol-type {
    type union {
      type uint8 {
        range 0..254;
      }
      type identityref {
        base IP_PROTOCOL;
      }
    }
    description
      "The IP protocol number may be expressed as a valid protocol
      number (integer) or using a protocol type defined by the
      IP_PROTOCOL identity";
  }

  typedef ethertype-type {
    type union {
      type uint16 {
        range 1536..65535;
      }
      type identityref {
        base ETHERTYPE;
      }
    }
    description
      "The Ethertype value may be expressed as a 16-bit number in
      decimal notation, or using a type defined by the
      ETHERTYPE identity";
  }

}