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"; } } } }