Thomas Vachuska | 8ca75a2 | 2017-08-24 16:12:59 -0700 | [diff] [blame] | 1 | module openconfig-packet-match { |
| 2 | |
| 3 | yang-version "1"; |
| 4 | |
| 5 | // namespace |
| 6 | namespace "http://openconfig.net/yang/header-fields"; |
| 7 | |
| 8 | prefix "oc-pkt-match"; |
| 9 | |
| 10 | // import some basic types |
| 11 | import openconfig-inet-types { prefix oc-inet; } |
| 12 | import openconfig-yang-types { prefix oc-yang; } |
| 13 | import openconfig-packet-match-types { prefix oc-pkt-match-types; } |
| 14 | import openconfig-extensions { prefix oc-ext; } |
| 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 defines data related to packet header fields |
| 25 | used in matching operations, for example in ACLs. When a |
| 26 | field is omitted from a match expression, the effect is a |
| 27 | wildcard ('any') for that field."; |
| 28 | |
| 29 | oc-ext:openconfig-version "1.0.0"; |
| 30 | |
| 31 | revision "2017-05-26" { |
| 32 | description |
| 33 | "Separated IP matches into AFs"; |
| 34 | reference "1.0.0"; |
| 35 | } |
| 36 | |
| 37 | revision "2016-08-08" { |
| 38 | description |
| 39 | "OpenConfig public release"; |
| 40 | reference "0.2.0"; |
| 41 | } |
| 42 | |
| 43 | revision "2016-04-27" { |
| 44 | description |
| 45 | "Initial revision"; |
| 46 | reference "TBD"; |
| 47 | } |
| 48 | |
| 49 | |
| 50 | // Physical Layer fields |
| 51 | // ethernet-header |
| 52 | grouping ethernet-header-config { |
| 53 | description |
| 54 | "Configuration data of fields in Ethernet header."; |
| 55 | |
| 56 | leaf source-mac { |
| 57 | type oc-yang:mac-address; |
| 58 | description |
| 59 | "Source IEEE 802 MAC address."; |
| 60 | } |
| 61 | |
| 62 | leaf source-mac-mask { |
| 63 | type oc-yang:mac-address; |
| 64 | description |
| 65 | "Source IEEE 802 MAC address mask."; |
| 66 | } |
| 67 | |
| 68 | leaf destination-mac { |
| 69 | type oc-yang:mac-address; |
| 70 | description |
| 71 | "Destination IEEE 802 MAC address."; |
| 72 | } |
| 73 | |
| 74 | leaf destination-mac-mask { |
| 75 | type oc-yang:mac-address; |
| 76 | description |
| 77 | "Destination IEEE 802 MAC address mask."; |
| 78 | } |
| 79 | |
| 80 | leaf ethertype { |
| 81 | type oc-pkt-match-types:ethertype-type; |
| 82 | description |
| 83 | "Ethertype field to match in Ethernet packets"; |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | grouping ethernet-header-state { |
| 88 | description |
| 89 | "State information of fields in Ethernet header."; |
| 90 | } |
| 91 | |
| 92 | grouping ethernet-header-top { |
| 93 | description |
| 94 | "Top level container for fields in Ethernet header."; |
| 95 | |
| 96 | container l2 { |
| 97 | description |
| 98 | "Ethernet header fields"; |
| 99 | |
| 100 | container config { |
| 101 | description |
| 102 | "Configuration data"; |
| 103 | uses ethernet-header-config; |
| 104 | } |
| 105 | |
| 106 | container state { |
| 107 | config false; |
| 108 | description |
| 109 | "State Information."; |
| 110 | uses ethernet-header-config; |
| 111 | uses ethernet-header-state; |
| 112 | } |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | grouping ip-protocol-fields-common-config { |
| 117 | description |
| 118 | "IP protocol fields common to IPv4 and IPv6"; |
| 119 | |
| 120 | leaf dscp { |
| 121 | type oc-inet:dscp; |
| 122 | description |
| 123 | "Value of diffserv codepoint."; |
| 124 | } |
| 125 | |
| 126 | leaf protocol { |
| 127 | type oc-pkt-match-types:ip-protocol-type; |
| 128 | description |
| 129 | "The protocol carried in the IP packet, expressed either |
| 130 | as its IP protocol number, or by a defined identity."; |
| 131 | } |
| 132 | |
| 133 | leaf hop-limit { |
| 134 | type uint8 { |
| 135 | range 0..255; |
| 136 | } |
| 137 | description |
| 138 | "The IP packet's hop limit -- known as TTL (in hops) in |
| 139 | IPv4 packets, and hop limit in IPv6"; |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | // IP Layer |
| 144 | // ip-protocol-fields |
| 145 | grouping ipv4-protocol-fields-config { |
| 146 | description |
| 147 | "Configuration data of IP protocol fields |
| 148 | for IPv4"; |
| 149 | |
| 150 | leaf source-address { |
| 151 | type oc-inet:ipv4-prefix; |
| 152 | description |
| 153 | "Source IPv4 address prefix."; |
| 154 | } |
| 155 | |
| 156 | leaf destination-address { |
| 157 | type oc-inet:ipv4-prefix; |
| 158 | description |
| 159 | "Destination IPv4 address prefix."; |
| 160 | } |
| 161 | |
| 162 | uses ip-protocol-fields-common-config; |
| 163 | |
| 164 | } |
| 165 | |
| 166 | grouping ipv4-protocol-fields-state { |
| 167 | description |
| 168 | "State information of IP header fields for IPv4"; |
| 169 | } |
| 170 | |
| 171 | grouping ipv4-protocol-fields-top { |
| 172 | description |
| 173 | "IP header fields for IPv4"; |
| 174 | |
| 175 | container ipv4 { |
| 176 | description |
| 177 | "Top level container for IPv4 match field data"; |
| 178 | |
| 179 | container config { |
| 180 | description |
| 181 | "Configuration data for IPv4 match fields"; |
| 182 | uses ipv4-protocol-fields-config; |
| 183 | } |
| 184 | |
| 185 | container state { |
| 186 | config false; |
| 187 | description |
| 188 | "State information for IPv4 match fields"; |
| 189 | uses ipv4-protocol-fields-config; |
| 190 | uses ipv4-protocol-fields-state; |
| 191 | } |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | grouping ipv6-protocol-fields-config { |
| 196 | description |
| 197 | "Configuration data for IPv6 match fields"; |
| 198 | |
| 199 | leaf source-address { |
| 200 | type oc-inet:ipv6-prefix; |
| 201 | description |
| 202 | "Source IPv6 address prefix."; |
| 203 | } |
| 204 | |
| 205 | leaf source-flow-label { |
| 206 | type oc-inet:ipv6-flow-label; |
| 207 | description |
| 208 | "Source IPv6 Flow label."; |
| 209 | } |
| 210 | |
| 211 | leaf destination-address { |
| 212 | type oc-inet:ipv6-prefix; |
| 213 | description |
| 214 | "Destination IPv6 address prefix."; |
| 215 | } |
| 216 | |
| 217 | leaf destination-flow-label { |
| 218 | type oc-inet:ipv6-flow-label; |
| 219 | description |
| 220 | "Destination IPv6 Flow label."; |
| 221 | } |
| 222 | |
| 223 | uses ip-protocol-fields-common-config; |
| 224 | } |
| 225 | |
| 226 | grouping ipv6-protocol-fields-state { |
| 227 | description |
| 228 | "Operational state data for IPv6 match fields"; |
| 229 | } |
| 230 | |
| 231 | grouping ipv6-protocol-fields-top { |
| 232 | description |
| 233 | "Top-level grouping for IPv6 match fields"; |
| 234 | |
| 235 | container ipv6 { |
| 236 | description |
| 237 | "Top-level container for IPv6 match field data"; |
| 238 | |
| 239 | container config { |
| 240 | description |
| 241 | "Configuration data for IPv6 match fields"; |
| 242 | |
| 243 | uses ipv6-protocol-fields-config; |
| 244 | } |
| 245 | |
| 246 | container state { |
| 247 | |
| 248 | config false; |
| 249 | |
| 250 | description |
| 251 | "Operational state data for IPv6 match fields"; |
| 252 | |
| 253 | uses ipv6-protocol-fields-config; |
| 254 | uses ipv6-protocol-fields-state; |
| 255 | } |
| 256 | } |
| 257 | } |
| 258 | |
| 259 | // Transport fields |
| 260 | grouping transport-fields-config { |
| 261 | description |
| 262 | "Configuration data of transport-layer packet fields"; |
| 263 | |
| 264 | leaf source-port { |
| 265 | type oc-pkt-match-types:port-num-range; |
| 266 | description |
| 267 | "Source port or range"; |
| 268 | } |
| 269 | |
| 270 | leaf destination-port { |
| 271 | type oc-pkt-match-types:port-num-range; |
| 272 | description |
| 273 | "Destination port or range"; |
| 274 | } |
| 275 | |
| 276 | leaf-list tcp-flags { |
| 277 | type identityref { |
| 278 | base oc-pkt-match-types:TCP_FLAGS; |
| 279 | } |
| 280 | description |
| 281 | "List of TCP flags to match"; |
| 282 | } |
| 283 | } |
| 284 | |
| 285 | grouping transport-fields-state { |
| 286 | description |
| 287 | "State data of transport-fields"; |
| 288 | } |
| 289 | |
| 290 | grouping transport-fields-top { |
| 291 | description |
| 292 | "Destination transport-fields top level grouping"; |
| 293 | |
| 294 | container transport { |
| 295 | description |
| 296 | "Transport fields container"; |
| 297 | |
| 298 | container config { |
| 299 | description |
| 300 | "Configuration data"; |
| 301 | uses transport-fields-config; |
| 302 | } |
| 303 | |
| 304 | container state { |
| 305 | config false; |
| 306 | description |
| 307 | "State data"; |
| 308 | uses transport-fields-config; |
| 309 | uses transport-fields-state; |
| 310 | } |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | } |