module openconfig-packet-match { yang-version "1"; // namespace namespace "http://openconfig.net/yang/header-fields"; prefix "oc-pkt-match"; // import some basic types import openconfig-inet-types { prefix oc-inet; } import openconfig-yang-types { prefix oc-yang; } import openconfig-packet-match-types { prefix oc-pkt-match-types; } import openconfig-extensions { prefix oc-ext; } // meta organization "OpenConfig working group"; contact "OpenConfig working group www.openconfig.net"; description "This module defines data related to packet header fields used in matching operations, for example in ACLs. When a field is omitted from a match expression, the effect is a wildcard ('any') for that field."; oc-ext:openconfig-version "1.1.1"; revision "2018-11-21" { description "Add OpenConfig module metadata extensions."; reference "1.1.1"; } revision "2017-12-15" { description "Add MPLS packet field matches"; reference "1.1.0"; } 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"; // Physical Layer fields // ethernet-header grouping ethernet-header-config { description "Configuration data of fields in Ethernet header."; leaf source-mac { type oc-yang:mac-address; description "Source IEEE 802 MAC address."; } leaf source-mac-mask { type oc-yang:mac-address; description "Source IEEE 802 MAC address mask."; } leaf destination-mac { type oc-yang:mac-address; description "Destination IEEE 802 MAC address."; } leaf destination-mac-mask { type oc-yang:mac-address; description "Destination IEEE 802 MAC address mask."; } leaf ethertype { type oc-pkt-match-types:ethertype-type; description "Ethertype field to match in Ethernet packets"; } } grouping ethernet-header-state { description "State information of fields in Ethernet header."; } grouping ethernet-header-top { description "Top level container for fields in Ethernet header."; container l2 { description "Ethernet header fields"; container config { description "Configuration data"; uses ethernet-header-config; } container state { config false; description "State Information."; uses ethernet-header-config; uses ethernet-header-state; } } } grouping mpls-header-top { description "Top-level container for fields in an MPLS header."; container mpls { description "MPLS header fields"; container config { description "Configuration parameters relating to fields within the MPLS header."; uses mpls-header-config; } container state { config false; description "Operational state parameters relating to fields within the MPLS header"; uses mpls-header-config; } } } grouping mpls-header-config { description "Configuration parameters relating to matches within MPLS header fields."; leaf traffic-class { type uint8 { range "0..7"; } description "The value of the MPLS traffic class (TC) bits, formerly known as the EXP bits."; } } grouping ip-protocol-fields-common-config { description "IP protocol fields common to IPv4 and IPv6"; leaf dscp { type oc-inet:dscp; description "Value of diffserv codepoint."; } leaf protocol { type oc-pkt-match-types:ip-protocol-type; description "The protocol carried in the IP packet, expressed either as its IP protocol number, or by a defined identity."; } leaf hop-limit { type uint8 { range 0..255; } description "The IP packet's hop limit -- known as TTL (in hops) in IPv4 packets, and hop limit in IPv6"; } } // IP Layer // ip-protocol-fields grouping ipv4-protocol-fields-config { description "Configuration data of IP protocol fields for IPv4"; leaf source-address { type oc-inet:ipv4-prefix; description "Source IPv4 address prefix."; } leaf destination-address { type oc-inet:ipv4-prefix; description "Destination IPv4 address prefix."; } uses ip-protocol-fields-common-config; } grouping ipv4-protocol-fields-state { description "State information of IP header fields for IPv4"; } grouping ipv4-protocol-fields-top { description "IP header fields for IPv4"; container ipv4 { description "Top level container for IPv4 match field data"; container config { description "Configuration data for IPv4 match fields"; uses ipv4-protocol-fields-config; } container state { config false; description "State information for IPv4 match fields"; uses ipv4-protocol-fields-config; uses ipv4-protocol-fields-state; } } } grouping ipv6-protocol-fields-config { description "Configuration data for IPv6 match fields"; leaf source-address { type oc-inet:ipv6-prefix; description "Source IPv6 address prefix."; } leaf source-flow-label { type oc-inet:ipv6-flow-label; description "Source IPv6 Flow label."; } leaf destination-address { type oc-inet:ipv6-prefix; description "Destination IPv6 address prefix."; } leaf destination-flow-label { type oc-inet:ipv6-flow-label; description "Destination IPv6 Flow label."; } uses ip-protocol-fields-common-config; } grouping ipv6-protocol-fields-state { description "Operational state data for IPv6 match fields"; } grouping ipv6-protocol-fields-top { description "Top-level grouping for IPv6 match fields"; container ipv6 { description "Top-level container for IPv6 match field data"; container config { description "Configuration data for IPv6 match fields"; uses ipv6-protocol-fields-config; } container state { config false; description "Operational state data for IPv6 match fields"; uses ipv6-protocol-fields-config; uses ipv6-protocol-fields-state; } } } // Transport fields grouping transport-fields-config { description "Configuration data of transport-layer packet fields"; leaf source-port { type oc-pkt-match-types:port-num-range; description "Source port or range"; } leaf destination-port { type oc-pkt-match-types:port-num-range; description "Destination port or range"; } leaf-list tcp-flags { type identityref { base oc-pkt-match-types:TCP_FLAGS; } description "List of TCP flags to match"; } } grouping transport-fields-state { description "State data of transport-fields"; } grouping transport-fields-top { description "Destination transport-fields top level grouping"; container transport { description "Transport fields container"; container config { description "Configuration data"; uses transport-fields-config; } container state { config false; description "State data"; uses transport-fields-config; uses transport-fields-state; } } } }