netconfcentral logo

ietf-l2vpn@2017-09-21



  module ietf-l2vpn {

    yang-version 1;

    namespace
      "urn:ietf:params:xml:ns:yang:ietf-l2vpn";

    prefix l2vpn;

    import ietf-inet-types {
      prefix inet;
    }
    import ietf-yang-types {
      prefix yang;
    }
    import ietf-routing-types {
      prefix rt-types;
    }
    import ietf-pseudowires {
      prefix pw;
    }

    organization "ietf";

    contact "ietf";

    description "l2vpn";

    revision "2017-09-21" {
      description
        "Seventh revision "
          + "  - Fixed yangdump errors "
          + "";
      reference
        "";

    }

    revision "2017-06-26" {
      description
        "Sixth revision "
          + "  - Removed unused module mpls "
          + "  - Renamed l2vpn-instances-state to l2vpn-instances "
          + "  - Added pseudowire status as defined in RFC4446 and "
          + "    IANA Pseudowire Status Codes Register "
          + "  - Added notifications "
          + "  - Moved PW definition out of L2VPN "
          + "  - Moved model to NMDA style specified in "
          + "    draft-dsdt-nmda-guidelines-01.txt "
          + "  - Renamed l2vpn-instances and l2vpn-instance to "
          + "    instances and instance to shorten xpaths "
          + "";
      reference
        "";

    }

    revision "2017-03-06" {
      description
        "Sixth revision "
          + "  - Removed the 'common' container and move pw-templates "
          + "    and redundancy-group-templates up a level "
          + "  - Consolidated the endpoint configuration such that "
          + "    all L2VPN instances has a list of endpoint.  For "
          + "    certain types of L2VPN instances such as VPWS where "
          + "    each L2VPN instance is limited to at most two "
          + "    endpoint, additional augment statements were included "
          + "    to add necessary constraints "
          + "  - Removed discovery-type and signaling-type operational "
          + "    state from VPLS pseudowires, as these two parameters "
          + "    are configured as L2VPN parameters rather than "
          + "    pseudowire paramteres "
          + "  - Renamed l2vpn-instances to l2vpn-instances-state "
          + "    in the operational state branch "
          + "  - Removed BGP parameter groupings and reused "
          + "    ietf-routing-types.yang module instead "
          + "";
      reference
        "";

    }

    revision "2016-10-24" {
      description
        "Fifth revision "
          + "  - Edits based on Giles's comments "
          + "    5) Remove relative leafrefs in groupings, "
          + "       and the resulting new groupings are: "
          + "       (a) bgp-auto-discovery-parameters-grp "
          + "       (b) bgp-signaling-parameters-grp "
          + "       (c) endpoint-grp "
          + "    11) Merge VPLS and VPWS into one single list "
          + "       and use augment statements to handle "
          + "       differences between VPLS and VPWS "
          + "  - Add a new grouping l2vpn-common-parameters-grp "
          + "    to make VPLS and VPWS more consistent";
      reference
        "";

    }

    revision "2016-05-31" {
      description
        "Fourth revision "
          + "  - Edits based on Giles's comments "
          + "    1) Change enumeration to identityref type for: "
          + "       (a) l2vpn-service-type "
          + "       (b) l2vpn-discovery-type "
          + "       (c) l2vpn-signaling-type "
          + "       bgp-rt-type, cw-negotiation, and "
          + "       pbb-component remain enumerations "
          + "    2) Define i-sid-type for leaf 'i-sid' "
          + "       (which is renamed from 'i-tag') "
          + "    3) Rename 'vpn-targets' to 'vpn-target' "
          + "    4) Import ietf-mpls.yang and reuse the "
          + "       'mpls-label' type defined in ietf-mpls.yang "
          + "       transmit-label and receive-label "
          + "    8) Change endpoint list's key to name "
          + "    9) Changed MTU to type uint16 "
          + "";
      reference
        "";

    }

    revision "2016-03-07" {
      description
        "Third revision "
          + "  - Changed the module name to ietf-l2vpn "
          + "  - Merged EVPN into L2VPN "
          + "  - Eliminated the definitions of attachment "
          + "    circuit with the intention to reuse other "
          + "    layer-2 definitions "
          + "  - Added state branch";
      reference
        "";

    }

    revision "2015-10-08" {
      description
        "Second revision "
          + "  - Added container vpls-instances "
          + "  - Rearranged groupings and typedefs to be "
          + "    reused across vpls-instance and vpws-instances";
      reference
        "";

    }

    revision "2015-06-30" {
      description "Initial revision";
      reference
        "";

    }


    identity l2vpn-instance-type {
      base 
      description
        "Base identity from which identities of "
          + "l2vpn service instance types are derived";
    }

    identity vpws-instance-type {
      base l2vpn-instance-type;
      description
        "This identity represents VPWS instance type";
    }

    identity vpls-instance-type {
      base l2vpn-instance-type;
      description
        "This identity represents VPLS instance type";
    }

    identity link-discovery-protocol {
      base 
      description
        "Base identiy from which identities describing "
          + "link discovery protocols are derived";
    }

    identity lacp {
      base link-discovery-protocol;
      description
        "This identity represents LACP";
    }

    identity lldp {
      base link-discovery-protocol;
      description
        "This identity represents LLDP";
    }

    identity bpdu {
      base link-discovery-protocol;
      description
        "This identity represens BPDU";
    }

    identity cpd {
      base link-discovery-protocol;
      description
        "This identity represents CPD";
    }

    identity udld {
      base link-discovery-protocol;
      description
        "This identity represens UDLD";
    }

    identity l2vpn-service {
      base 
      description
        "Base identity from which identities describing "
          + "L2VPN services are derived";
    }

    identity Ethernet {
      base l2vpn-service;
      description
        "This identity represents Ethernet service";
    }

    identity ATM {
      base l2vpn-service;
      description
        "This identity represents Asynchronous Transfer "
          + "Mode service";
    }

    identity FR {
      base l2vpn-service;
      description
        "This identity represent Frame-Relay service";
    }

    identity TDM {
      base l2vpn-service;
      description
        "This identity represent Time Devision "
          + "Multiplexing service";
    }

    identity l2vpn-discovery {
      base 
      description
        "Base identity from which identities describing "
          + "L2VPN discovery protocols are derived";
    }

    identity manual-discovery {
      base l2vpn-discovery;
      description
        "Manual configuration of l2vpn service";
    }

    identity bgp-auto-discovery {
      base l2vpn-discovery;
      description
        "Border Gateway Protocol (BGP) auto-discovery of "
          + "l2vpn service";
    }

    identity ldp-discovery {
      base l2vpn-discovery;
      description
        "Label Distribution Protocol (LDP) discovery of "
          + "l2vpn service";
    }

    identity mixed-discovery {
      base l2vpn-discovery;
      description
        "Mixed discovery methods of l2vpn service";
    }

    identity l2vpn-signaling {
      base 
      description
        "Base identity from which identities describing "
          + "L2VPN signaling protocols are derived";
    }

    identity static-configuration {
      base l2vpn-signaling;
      description
        "Static configuration of labels (no signaling)";
    }

    identity ldp-signaling {
      base l2vpn-signaling;
      description
        "Label Distribution Protocol (LDP) signaling";
    }

    identity bgp-signaling {
      base l2vpn-signaling;
      description
        "Border Gateway Protocol (BGP) signaling";
    }

    identity mixed-signaling {
      base l2vpn-signaling;
      description "Mixed signaling methods";
    }

    identity l2vpn-notification-state {
      base 
      description
        "The base identity on which notification states "
          + "are based";
    }

    identity MAC-limit-reached {
      base l2vpn-notification-state;
      description "MAC limit is reached";
    }

    identity MAC-limit-cleared {
      base l2vpn-notification-state;
      description "MAC limit is cleared";
    }

    identity MTU-mismatched {
      base l2vpn-notification-state;
      description "MAC is mismatched";
    }

    identity MTU-mismatched-cleared {
      base l2vpn-notification-state;
      description
        "MAC is mismatch is cleared";
    }

    identity state-changed-to-up {
      base l2vpn-notification-state;
      description "State is changed to UP";
    }

    identity state-changed-to-down {
      base l2vpn-notification-state;
      description "State is changed to down";
    }

    identity MAC-move-limit-exceeded {
      base l2vpn-notification-state;
      description
        "MAC move limit is exceeded";
    }

    identity MAC-move-limit-exceeded-cleared {
      base l2vpn-notification-state;
      description
        "MAC move limit exceeded is cleared";
    }

    identity MAC-flap-detected {
      base l2vpn-notification-state;
      description "MAC flap detected";
    }

    identity port-disabled-due-to-MAC-flap {
      base l2vpn-notification-state;
      description
        "Port disabled due to MAC flap";
    }

    typedef l2vpn-service-type {
      type identityref {
        base l2vpn-service;
      }
      description "L2VPN service type";
    }

    typedef l2vpn-discovery-type {
      type identityref {
        base l2vpn-discovery;
      }
      description "L2VPN discovery type";
    }

    typedef l2vpn-signaling-type {
      type identityref {
        base l2vpn-signaling;
      }
      description "L2VPN signaling type";
    }

    typedef link-discovery-protocol-type {
      type identityref {
        base link-discovery-protocol;
      }
      description
        "This type is used to identify "
          + "link discovery protocol";
    }

    typedef pbb-component-type {
      type enumeration {
        enum "b-component" {
          value 0;
          description
            "Identifies as a b-component";
        }
        enum "i-component" {
          value 1;
          description
            "Identifies as an i-component";
        }
      }
      description
        "This type is used to identify "
          + "the type of PBB component";
    }

    typedef redundancy-group-template-ref {
      type leafref {
        path "/l2vpn:l2vpn/l2vpn:redundancy-group-templates/l2vpn:redundancy-group-template/l2vpn:name";
      }
      description
        "redundancy-group-template-ref";
    }

    typedef l2vpn-instance-name-ref {
      type leafref {
        path "/l2vpn:l2vpn/l2vpn:instances/l2vpn:instance/l2vpn:name";
      }
      description "l2vpn-instance-name-ref";
    }

    typedef l2vpn-instance-type-ref {
      type leafref {
        path "/l2vpn:l2vpn/l2vpn:instances/l2vpn:instance/l2vpn:type";
      }
      description "l2vpn-instance-type-ref";
    }

    typedef operational-state-type {
      type enumeration {
        enum "up" {
          value 0;
          description
            "Operational state is up";
        }
        enum "down" {
          value 1;
          description
            "Operational state is down";
        }
      }
      description "operational-state-type";
    }

    typedef i-sid-type {
      type uint32 {
        range "0..16777216";
      }
      description
        "I-SID type that is 24-bits. "
          + "This should be moved to ieee-types.yang at "
          + "http://www.ieee802.org/1/files/public/docs2015"
          + "/new-mholness-ieee-types-yang-v01.yang";
    }

    grouping pbb-parameters-grp {
      description "PBB parameters grouping";
      container pbb-parameters {
        description "pbb-parameters";
        choice component-type {
          description "PBB component type";
          case i-component {
            leaf i-sid {
              type i-sid-type;
              description "I-SID";
            }

            leaf backbone-src-mac {
              type yang:mac-address;
              description "backbone-src-mac";
            }
          }  // case i-component

          case b-component {
            leaf bind-b-component-name {
              type l2vpn-instance-name-ref;
              must
                "/l2vpn:l2vpn"
                  + "/l2vpn:instances"
                  + "/l2vpn:instance[l2vpn:name=current()]"
                  + "/type = 'vpls-instance-type'" {
                description
                  "A b-component must be an L2VPN instance "
                    + "of type vpls-instance-type";
              }
              description
                "Reference to the associated b-component";
            }

            leaf bind-b-component-type {
              type identityref {
                base l2vpn-instance-type;
              }
              must
                ". = 'l2vpn:vpls-instance-type'" {
                description
                  "The associated b-component must have "
                    + "type vpls-instance-type";
              }
              config false;
              description
                "Type of the associated b-component";
            }
          }  // case b-component
        }  // choice component-type
      }  // container pbb-parameters
    }  // grouping pbb-parameters-grp

    grouping pbb-parameters-state-grp {
      description "PBB parameters grouping";
      container pbb-parameters {
        description "pbb-parameters";
        choice component-type {
          description "PBB component type";
          case i-component {
            leaf i-sid {
              type i-sid-type;
              description "I-SID";
            }

            leaf backbone-src-mac {
              type yang:mac-address;
              description "backbone-src-mac";
            }
          }  // case i-component

          case b-component {
            leaf bind-b-component-name {
              type string;
              description
                "Name of the associated b-component";
            }

            leaf bind-b-component-type {
              type identityref {
                base l2vpn-instance-type;
              }
              must
                ". = 'l2vpn:vpls-instance-type'" {
                description
                  "The associated b-component must have "
                    + "type vpls-instance-type";
              }
              description
                "Type of the associated b-component";
            }
          }  // case b-component
        }  // choice component-type
      }  // container pbb-parameters
    }  // grouping pbb-parameters-state-grp

    grouping l2vpn-common-parameters-grp {
      description "L2VPN common parameters";
      leaf name {
        type string;
        description
          "Name of L2VPN service instance";
      }

      leaf type {
        type identityref {
          base l2vpn-instance-type;
        }
        description
          "Type of L2VPN service instance";
      }

      leaf mtu {
        type uint16;
        description "MTU of L2VPN service";
      }

      leaf mac-aging-timer {
        type uint32;
        description
          "mac-aging-timer, the duration after which"
            + "a MAC entry is considered aged out";
      }

      leaf service-type {
        type l2vpn-service-type;
        default 'Ethernet';
        description "L2VPN service type";
      }

      leaf discovery-type {
        type l2vpn-discovery-type;
        default 'manual-discovery';
        description
          "L2VPN service discovery type";
      }

      leaf signaling-type {
        type l2vpn-signaling-type;
        mandatory true;
        description "L2VPN signaling type";
      }
    }  // grouping l2vpn-common-parameters-grp

    grouping bgp-signaling-parameters-grp {
      description
        "BGP parameters for signaling";
      leaf site-id {
        type uint16;
        description "Site ID";
      }

      leaf site-range {
        type uint16;
        description "Site Range";
      }
    }  // grouping bgp-signaling-parameters-grp

    grouping redundancy-group-properties-grp {
      description
        "redundancy-group-properties-grp";
      leaf protection-mode {
        type enumeration {
          enum "frr" {
            value 0;
            description "fast reroute";
          }
          enum "master-slave" {
            value 1;
            description "master-slave";
          }
          enum "independent" {
            value 2;
            description "independent";
          }
        }
        description "protection-mode";
      }

      leaf reroute-mode {
        type enumeration {
          enum "immediate" {
            value 0;
            description "immediate reroute";
          }
          enum "delayed" {
            value 1;
            description "delayed reroute";
          }
          enum "never" {
            value 2;
            description "never reroute";
          }
        }
        description "reroute-mode";
      }

      leaf dual-receive {
        type boolean;
        description
          "allow extra traffic to be carried by backup";
      }

      leaf revert {
        type boolean;
        description
          "allow forwarding to revert to primary "
            + "after restoring primary";
      }

      leaf reroute-delay {
        when "../reroute-mode = 'delayed'" {
          description
            "Specify amount of time to "
              + "delay reroute only when "
              + "delayed route is configured";
        }
        type uint16;
        description
          "amount of time to delay reroute";
      }

      leaf revert-delay {
        when "../revert = 'true'" {
          description
            "Specify the amount of time to "
              + "wait to revert to primary "
              + "only if reversion is configured";
        }
        type uint16;
        description
          "amount ot time to wait to revert to primary";
      }
    }  // grouping redundancy-group-properties-grp

    grouping endpoint-grp {
      description
        "A grouping that defines the structure of "
          + "an endpoint";
      choice ac-or-pw-or-redundancy-grp {
        description
          "A choice ofattachment circuit or "
            + "pseudowire or redundancy group";
        case ac {
          description
            "Attachment circuit(s) as an endpoint";
        }  // case ac

        case pw {
          description
            "Pseudowire(s) as an endpoint";
        }  // case pw

        case redundancy-grp {
          description
            "Redundancy group as an endpoint";
          choice primary {
            mandatory true;
            description "primary options";
            case primary-ac {
              description "primary-ac";
            }  // case primary-ac

            case primary-pw {
              description "primary-pw";
            }  // case primary-pw
          }  // choice primary

          choice backup {
            description "backup options";
            case backup-ac {
              description "backup-ac";
            }  // case backup-ac

            case backup-pw {
              description "backup-pw";
            }  // case backup-pw
          }  // choice backup
        }  // case redundancy-grp
      }  // choice ac-or-pw-or-redundancy-grp
    }  // grouping endpoint-grp

    container l2vpn {
      description "l2vpn";
      container redundancy-group-templates {
        description
          "redundancy group templates";
        list redundancy-group-template {
          key "name";
          description
            "redundancy-group-template";
          leaf name {
            type string;
            description "name";
          }

          uses redundancy-group-properties-grp;
        }  // list redundancy-group-template
      }  // container redundancy-group-templates

      container instances {
        description
          "A list of L2VPN instances";
        list instance {
          key "name type";
          description
            "An L2VPN service instance";
          uses l2vpn-common-parameters-grp;

          container bgp-auto-discovery {
            description
              "BGP auto-discovery parameters";
            leaf route-distinguisher {
              type rt-types:route-distinguisher;
              description
                "BGP route distinguisher";
            }

            leaf vpn-id {
              type string;
              description "VPN ID";
            }

            uses rt-types:vpn-route-targets;
          }  // container bgp-auto-discovery

          container bgp-signaling {
            when
              "../signaling-type = 'bgp-signaling'" {
              description
                "Check signaling type: "
                  + "Can only configure BGP signaling if "
                  + "signaling type is BGP";
            }
            description
              "BGP signaling parameters";
            uses bgp-signaling-parameters-grp;
          }  // container bgp-signaling

          list endpoint {
            key "name";
            description "An endpoint";
            leaf name {
              type string;
              description "endpoint name";
            }

            uses endpoint-grp {
              augment ac-or-pw-or-redundancy-grp/ac {
                description
                  "Augment for attachment circuit(s) "
                    + "as an endpoint";
                list ac {
                  key "name";
                  description
                    "An L2VPN instance's "
                      + "attachment circuit list";
                  leaf name {
                    type string;
                    description
                      "Name of attachment circuit.  "
                        + "This field is intended to "
                        + "reference standardized "
                        + "layer-2 definitions.";
                  }

                  leaf state {
                    type operational-state-type;
                    config false;
                    description
                      "attachment circuit up/down state";
                  }
                }  // list ac
              }

              augment ac-or-pw-or-redundancy-grp/pw {
                description
                  "Augment for pseudowire(s) as an endpoint";
                list pw {
                  key "name";
                  description
                    "An L2VPN instance's pseudowire list";
                  leaf name {
                    type pw:pseudowire-ref;
                    must
                      "(../../../type = "
                        + " 'l2vpn:vpws-instance-type') or "
                        + "(not(boolean(/pw:pseudowires"
                        + "     /pw:pseudowire[pw:name = current()]"
                        + "     /vccv-ability)) and "
                        + " not(boolean(/pw:pseudowires"
                        + "     /pw:pseudowire[pw:name = current()]"
                        + "     /request-vlanid)) and "
                        + " not(boolean(/pw:pseudowires"
                        + "     /pw:pseudowire[pw:name = current()]"
                        + "     /vlan-tpid)) and "
                        + " not(boolean(/pw:pseudowires"
                        + "     /pw:pseudowire[pw:name = current()]"
                        + "     /ttl)))" {
                      description
                        "Only a VPWS PW has parameters "
                          + "vccv-ability, request-vlanid, "
                          + "vlan-tpid, and ttl";
                    }
                    description
                      "Pseudowire name";
                  }

                  leaf state {
                    type leafref {
                      path
                        "/pw:pseudowires"
                          + "/pw:pseudowire[pw:name=current()/../name]"
                          + "/pw:state";
                    }
                    config false;
                    description
                      "Pseudowire state";
                  }
                }  // list pw
              }

              augment ac-or-pw-or-redundancy-grp/redundancy-grp/primary/primary-ac {
                description
                  "Augment for primary-ac";
                container primary-ac {
                  description "Primary AC";
                  leaf name {
                    type string;
                    description
                      "Name of attachment circuit.  "
                        + "This field is intended to "
                        + "reference standardized "
                        + "layer-2 definitions.";
                  }

                  leaf state {
                    type operational-state-type;
                    config false;
                    description
                      "attachment circuit up/down state";
                  }
                }  // container primary-ac
              }

              augment ac-or-pw-or-redundancy-grp/redundancy-grp/primary/primary-pw {
                description
                  "Augment for primary-pw";
                list primary-pw {
                  key "name";
                  description
                    "An L2VPN instance's pseudowire list";
                  leaf name {
                    type pw:pseudowire-ref;
                    must
                      "(../../../type = "
                        + " 'l2vpn:vpws-instance-type') or "
                        + "(not(boolean(/pw:pseudowires"
                        + "     /pw:pseudowire[pw:name = current()]"
                        + "     /vccv-ability)) and "
                        + " not(boolean(/pw:pseudowires"
                        + "     /pw:pseudowire[pw:name = current()]"
                        + "     /request-vlanid)) and "
                        + " not(boolean(/pw:pseudowires"
                        + "     /pw:pseudowire[pw:name = current()]"
                        + "     /vlan-tpid)) and "
                        + " not(boolean(/pw:pseudowires"
                        + "     /pw:pseudowire[pw:name = current()]"
                        + "     /ttl)))" {
                      description
                        "Only a VPWS PW has parameters "
                          + "vccv-ability, request-vlanid, "
                          + "vlan-tpid, and ttl";
                    }
                    description
                      "Pseudowire name";
                  }

                  leaf state {
                    type leafref {
                      path
                        "/pw:pseudowires"
                          + "/pw:pseudowire[pw:name=current()/../name]"
                          + "/pw:state";
                    }
                    config false;
                    description
                      "Pseudowire state";
                  }
                }  // list primary-pw
              }

              augment ac-or-pw-or-redundancy-grp/redundancy-grp/backup/backup-ac {
                description
                  "Augment for backup-ac";
                container backup-ac {
                  description "Backup AC";
                  leaf name {
                    type string;
                    description
                      "Name of attachment circuit.  "
                        + "This field is intended to "
                        + "reference standardized "
                        + "layer-2 definitions.";
                  }

                  leaf state {
                    type operational-state-type;
                    config false;
                    description
                      "attachment circuit up/down state";
                  }
                }  // container backup-ac
              }

              augment ac-or-pw-or-redundancy-grp/redundancy-grp/backup/backup-pw {
                description
                  "Augment for backup-pw";
                list backup-pw {
                  key "name";
                  description
                    "A list of backup pseudowires";
                  leaf name {
                    type pw:pseudowire-ref;
                    must
                      "(../../../type = "
                        + " 'l2vpn:vpws-instance-type') or "
                        + "(not(boolean(/pw:pseudowires"
                        + "     /pw:pseudowire[pw:name = current()]"
                        + "     /vccv-ability)) and "
                        + " not(boolean(/pw:pseudowires"
                        + "     /pw:pseudowire[pw:name = current()]"
                        + "     /request-vlanid)) and "
                        + " not(boolean(/pw:pseudowires"
                        + "     /pw:pseudowire[pw:name = current()]"
                        + "     /vlan-tpid)) and "
                        + " not(boolean(/pw:pseudowires"
                        + "     /pw:pseudowire[pw:name = current()]"
                        + "     /ttl)))" {
                      description
                        "Only a VPWS PW has parameters "
                          + "vccv-ability, request-vlanid, "
                          + "vlan-tpid, and ttl";
                    }
                    description
                      "Pseudowire name";
                  }

                  leaf state {
                    type leafref {
                      path
                        "/pw:pseudowires"
                          + "/pw:pseudowire[pw:name=current()/../name]"
                          + "/pw:state";
                    }
                    config false;
                    description
                      "Pseudowire state";
                  }
                }  // list backup-pw
              }

              augment ac-or-pw-or-redundancy-grp/redundancy-grp {
                description
                  "Augment for redundancy group properties";
                leaf template {
                  type leafref {
                    path
                      "/l2vpn/redundancy-group-templates"
                        + "/redundancy-group-template/name";
                  }
                  description
                    "Reference a redundancy group "
                      + "properties template";
                }

                uses redundancy-group-properties-grp;
              }
            }
          }  // list endpoint
        }  // list instance
      }  // container instances
    }  // container l2vpn

    augment /pw:pseudowires/pw:pseudowire {
      description
        "Augment for peudowire parameters for "
          + "VPWS pseudowires";
      leaf vccv-ability {
        type boolean;
        description "vccvability";
      }

      leaf request-vlanid {
        type uint16;
        description "request vlanid";
      }

      leaf vlan-tpid {
        type string;
        description "vlan tpid";
      }

      leaf ttl {
        type uint8;
        description "time-to-live";
      }
    }

    augment /pw:pseudowires/pw:pseudowire/pw:pw-type {
      description
        "Additional pseudowire types";
      container bgp-pw {
        description "BGP pseudowire";
        leaf remote-pe-id {
          type inet:ip-address;
          description "remote pe id";
        }
      }  // container bgp-pw
      container bgp-ad-pw {
        description
          "BGP auto-discovery pseudowire";
        leaf remote-ve-id {
          type uint16;
          description "remote ve id";
        }
      }  // container bgp-ad-pw
    }

    augment /l2vpn/instances/instance {
      when
        "type = 'l2vpn:vpws-instance-type'" {
        description
          "Constraints only for VPWS pseudowires";
      }
      description
        "Augment for VPWS instance";
      container vpws-constraints {
        must
          "(count(../endpoint) <= 2) and "
            + "(count(../endpoint/pw) <= 1) and "
            + "(count(../endpoint/ac) <= 1) and "
            + "(count(../endpoint/primary-pw) <= 1) and "
            + "(count(../endpoint/backup-pw) <= 1) " {
          description
            "A VPWS L2VPN instance has at most 2 endpoints "
              + "and each endpoint has at most 1 pseudowire or "
              + "1 attachment circuit";
        }
        description "VPWS constraints";
      }  // container vpws-constraints
    }

    augment /l2vpn/instances/instance {
      when
        "type = 'l2vpn:vpls-instance-type'" {
        description
          "Parameters specifically for a VPLS instance";
      }
      description
        "Augment for parameters for a VPLS instance";
      uses pbb-parameters-grp;
    }

    augment /l2vpn/instances/instance/endpoint {
      when
        "../type = 'l2vpn:vpls-instance-type'" {
        description
          "Endpoint parameter specifically for "
            + "a VPLS instance";
      }
      description
        "Augment for endpoint parameters for a VPLS instance";
      leaf split-horizon-group {
        type string;
        description
          "Identify a split horizon group";
      }
    }

    augment /l2vpn/instances/instance/endpoint/ac-or-pw-or-redundancy-grp/redundancy-grp/backup/backup-pw/backup-pw {
      when
        "../../type = 'l2vpn:vpls-instance-type'" {
        description
          "Backup pseudowire parameter specifically for "
            + "a VPLS instance";
      }
      description
        "Augment for backup pseudowire paramters for "
          + "a VPLS instance";
      leaf precedence {
        type uint32;
        description
          "precedence of the pseudowire";
      }
    }

    notification l2vpn-state-change-notification {
      description
        "L2VPN and constituents state change notification";
      leaf l2vpn-instance-name {
        type l2vpn-instance-name-ref;
        description
          "The L2VPN instance name";
      }

      leaf l2vpn-instance-type {
        type leafref {
          path "/l2vpn:l2vpn/l2vpn:instances/l2vpn:instance[l2vpn:name=current()/../l2vpn-instance-name]/l2vpn:type";
        }
        description
          "The L2VPN instance type";
      }

      leaf endpoint {
        type leafref {
          path "/l2vpn:l2vpn/l2vpn:instances/l2vpn:instance[l2vpn:name=current()/../l2vpn-instance-name][l2vpn:type=current()/../l2vpn-instance-type]/l2vpn:endpoint/l2vpn:name";
        }
        description "The endpoint";
      }

      uses endpoint-grp {
        augment ac-or-pw-or-redundancy-grp/ac {
          description
            "Augment for attachment circuit(s) "
              + "as an endpoint";
          leaf ac {
            type leafref {
              path
                "/l2vpn/instances/instance"
                  + "[name=current()/../l2vpn-instance-name]"
                  + "[type=current()/../l2vpn-instance-type]"
                  + "/endpoint[name=current()/../endpoint]/ac/name";
            }
            description
              "Related attachment circuit";
          }
        }

        augment ac-or-pw-or-redundancy-grp/pw {
          description
            "Augment for pseudowire(s) as an endpoint";
          leaf pw {
            type leafref {
              path
                "/l2vpn/instances/instance"
                  + "[name=current()/../l2vpn-instance-name]"
                  + "[type=current()/../l2vpn-instance-type]"
                  + "/endpoint[name=current()/../endpoint]/pw/name";
            }
            description "Related pseudowire";
          }
        }

        augment ac-or-pw-or-redundancy-grp/redundancy-grp/primary/primary-ac {
          description
            "Augment for primary-ac";
          leaf primary-ac {
            type leafref {
              path
                "/l2vpn/instances/instance"
                  + "[name=current()/../l2vpn-instance-name]"
                  + "[type=current()/../l2vpn-instance-type]"
                  + "/endpoint[name=current()/../endpoint]/primary-ac/name";
            }
            description
              "Related primary attachment circuit";
          }
        }

        augment ac-or-pw-or-redundancy-grp/redundancy-grp/primary/primary-pw {
          description
            "Augment for primary-pw";
          leaf primary-pw {
            type leafref {
              path
                "/l2vpn/instances/instance"
                  + "[name=current()/../l2vpn-instance-name]"
                  + "[type=current()/../l2vpn-instance-type]"
                  + "/endpoint[name=current()/../endpoint]/primary-pw/name";
            }
            description
              "Related primary pseudowire";
          }
        }

        augment ac-or-pw-or-redundancy-grp/redundancy-grp/backup/backup-ac {
          description
            "Augment for backup-ac";
          leaf backup-ac {
            type leafref {
              path
                "/l2vpn/instances/instance"
                  + "[name=current()/../l2vpn-instance-name]"
                  + "[type=current()/../l2vpn-instance-type]"
                  + "/endpoint[name=current()/../endpoint]/backup-ac/name";
            }
            description
              "Related backup attachment circuit";
          }
        }

        augment ac-or-pw-or-redundancy-grp/redundancy-grp/backup/backup-pw {
          description
            "Augment for backup-pw";
          leaf backup-pw {
            type leafref {
              path
                "/l2vpn/instances/instance"
                  + "[name=current()/../l2vpn-instance-name]"
                  + "[type=current()/../l2vpn-instance-type]"
                  + "/endpoint[name=current()/../endpoint]/backup-pw/name";
            }
            description
              "Related backup pseudowire";
          }
        }
      }

      leaf state {
        type identityref {
          base l2vpn-notification-state;
        }
        description
          "State change notification";
      }
    }  // notification l2vpn-state-change-notification
  }  // module ietf-l2vpn