module ieee802-dot1q-pb {
  yang-version "1.1";
  namespace urn:ieee:std:802.1Q:yang:ieee802-dot1q-pb;
  prefix dot1q-pb;
  import ieee802-dot1q-bridge {
    prefix dot1q;
  }
  import ieee802-dot1q-types {
    prefix dot1qtypes;
  }
  import ietf-interfaces {
    prefix if;
  }
  organization
    "IEEE 802.1 Working Group";
  contact
    "WG-URL: http://ieee802.org/1/
    WG-EMail: stds-802-1-l@ieee.org
    
    Contact: IEEE 802.1 Working Group Chair
    Postal: C/O IEEE 802.1 Working Group
           IEEE Standards Association
           445 Hoes Lane
           Piscataway, NJ 08854
           USA
    
    E-mail: stds-802-1-chairs@ieee.org";
  description
    "This YANG module describes the bridge configuration model for
    Provider Bridges.
    
    Copyright (C) IEEE (2022).
    
    This version of this YANG module is part of IEEE Std 802.1Q; see the
    standard itself for full legal notices.";
  revision 2022-05-06 {
    description
      "Update to rebase on Qcw";
    reference
      "IEEE Std 802.1Q-2022, Bridges and Bridged Networks.";
  }
  revision 2022-01-19 {
    description
      "Published as part of IEEE Std 802.1Q-2022.";
    reference
      "IEEE Std 802.1Q-2022, Bridges and Bridged Networks.";
  }
  revision 2020-06-04 {
    description
      "Published as part of IEEE Std 802.1Qcx-2020. Second version.";
    reference
      "IEEE Std 802.1Qcx-2020, Bridges and Bridged Networks - YANG Data
      Model for Connectivity Fault Management.";
  }
  revision 2018-03-07 {
    description
      "Published as part of IEEE Std 802.1Q-2018. Initial version.";
    reference
      "IEEE Std 802.1Q-2018, Bridges and Bridged Networks.";
  }
  augment "/if:interfaces/if:interface/dot1q:bridge-port" {
    description
      "Augment the interface model with 802.1Q Bridge Port configuration
      specific nodes.";
    leaf svid {
      type dot1qtypes:vlanid;
      description
        "Service VLAN identifier.";
      reference
        "12.13.2.1 of IEEE Std 802.1Q-2022";
    }
    list cvid-registration {
      when "/dot1q:bridges/dot1q:bridge[dot1q:name=current()" +
        "/../dot1q:bridge-name]/dot1q:component[dot1q:name=current()" +
        "/../dot1q:component-name]/dot1q:type = 'dot1q:c-vlan-component' and "+
        "../dot1q:port-type = 'dot1q:customer-edge-port'" {
        description
          "Applies when the component associated with this interface is
          a C-VLAN component and the port-type is a customer edge port.";
      }
      key "cvid";
      description
        "The C-VID Registration Table, provides a mapping between a
        C-VID and the service instance represented by an S-VID selected
        for that C-VLAN. This table provides the equivalent
        functionality of
           1) Configuring the PVID of the internal CNP on the S-VLAN
              component
           2) Adding the corresponding PEP on the C-VLAN component to
              the member set of the C-VLAN
           3) Adding the PEP and/or CEP to the untagged set of the
              C-VLAN (if it is desired that frames forwarded to that
              port are transmitted untagged for this C-VLAN).";
      leaf cvid {
        type dot1qtypes:vlanid;
        description
          "Customer VLAN identifiers associated with this bridge port.";
        reference
          "12.13.2.1 of IEEE Std 802.1Q-2022";
      }
      leaf svid {
        type dot1qtypes:vlanid;
        description
          "Service VLAN identifier.";
        reference
          "12.13.2.1 of IEEE Std 802.1Q-2022";
      }
      leaf untagged-pep {
        type boolean;
        default "true";
        description
          "A boolean indicating frames for this C-VLAN should be
          forwarded untagged through the Provider Edge Port.";
        reference
          "12.13.2.1 of IEEE Std 802.1Q-2022";
      }
      leaf untagged-cep {
        type boolean;
        default "true";
        description
          "A boolean indicating frames for this C-VLAN should be
          forwarded untagged through the Customer Edge Port.";
        reference
          "12.13.2.1 of IEEE Std 802.1Q-2022";
      }
    }
    list service-priority-regeneration {
      when "/dot1q:bridges/dot1q:bridge[dot1q:name=current() " +
        "/../dot1q:bridge-name]/dot1q:component[dot1q:name=current() " +
        "/../dot1q:component-name]/dot1q:type = 'dot1q:c-vlan-component' and "+
        "../dot1q:port-type = 'dot1q:customer-edge-port'" {
        description
          "Applies when the component associated with this interface is
          a C-VLAN component and the port-type is a customer edge port.";
      }
      key "svid";
      description
        "The Service Priority Regeneration Table, which provides the
        Priority Regeneration Table (12.6.2) for each internal CNP
        connected to the C-VLAN component associated with the CEP.";
      leaf svid {
        type dot1qtypes:vlanid;
        description
          "Service VLAN identifier.";
        reference
          "12.13.2.6 of IEEE Std 802.1Q-2022";
      }
      container priority-regeneration {
        description
          "Contains Service Priority Regeneration table nodal
          information.";
        reference
          "12.13.2.6 of IEEE Std 802.1Q-2022";
        uses dot1qtypes:priority-regeneration-table-grouping;
      }
    }
    list rcap-internal-interface {
      when "/dot1q:bridges/dot1q:bridge[dot1q:name=current() " +
        "/../dot1q:bridge-name]/dot1q:component[dot1q:name=current() " +
        "/../dot1q:component-name]/dot1q:type = 'dot1q:s-vlan-component' and "+
        "../dot1q:port-type = 'dot1q:remote-customer-access-port'" {
        description
          "Applies when the component associated with this interface is
          a C-VLAN component and the port-type is a customer edge port.";
      }
      key "external-svid";
      description
        "Designating an external port as an RCAP automatically creates a
        Port-mapping S-VLAN component associated with that port. This
        Port-mapping S-VLAN component includes one internal PNP.";
      leaf external-svid {
        type dot1qtypes:vlanid;
        description
          "External Service VLAN identifier.";
        reference
          "12.13.3.2 of IEEE Std 802.1Q-2022";
      }
      leaf internal-port-number {
        type dot1qtypes:port-number-type;
        description
          "The number of the RCAP.";
        reference
          "12.13.3.2 of IEEE Std 802.1Q-2022";
      }
      leaf internal-svid {
        type dot1qtypes:vlanid;
        description
          "Internal Service VLAN Identifier (not applicable for a
          C-tagged RCSI).";
        reference
          "12.13.3.2 of IEEE Std 802.1Q-2022";
      }
      leaf internal-interface-type {
        type enumeration {
          enum port-based-rcsi {
            description
              "Port-based RCSI";
          }
          enum c-tagged-rcsi {
            description
              "C-tagged RCSI";
          }
          enum pnp {
            description
              "Provider Network Port";
          }
          enum discard {
            description
              "Discard (external S-VID is not associated with an
              internal port).";
          }
        }
        description
          "A value indicating the type of internal interface associated
          with the external S-VID.";
        reference
          "12.13.3.2 of IEEE Std 802.1Q-2022";
      }
    }
  }
}