NETMOD Working Group Y. Zhuang
Internet-Draft Huawei
Intended status: Standards Track March 11, 2017
Expires: September 12, 2017

A YANG Data Model for Power over Ethernet System management
draft-zhuang-netmod-yang-poe-management-01

Abstract

This memo defines a YANG data model for Power over Ethernet System for use with network management protocols. This document augments the IEEE 802.3 PSE module with attributes to manage PSE port and provide notification of powering states. Besides, it also provides power source management for the whole system.

Status of This Memo

This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.

Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at http://datatracker.ietf.org/drafts/current/.

Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."

This Internet-Draft will expire on September 12, 2017.

Copyright Notice

Copyright (c) 2017 IETF Trust and the persons identified as the document authors. All rights reserved.

This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.


Table of Contents

1. Introduction

This document defines a YANG [RFC7950] data model for the management of power over Ethernet [IEEE 802.3at] Power Sourcing Equipment (PSE).

2. Definitions an Acronyms

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].

2.1. Terminology

The following abbreviations are defined in [IEEE-802.3at] and will be used with the same significance in this document:

PSE - Power Sourcing Equipment;

PD - Powered Device

2.2. Tree diagram

The following notations are used within the data tree and carry the meaning as below.

 Each node is printed as:
   <status> <flags> <name> <opts> <type>

   <status> is one of:
        +  for current
        x  for deprecated
        o  for obsolete
   <flags> is one of:
       rw for configuration data
       ro for non-configuration data
       -x for rpcs
       -n for notifications
   <name> is the name of the node

   If the node is augmented into the tree from another module, its name
   is printed as <prefix>:<name>.
   <opts> is one of:
        ?  for an optional leaf or choice
        !  for a presence container
        *  for a leaf-list or list
        [<keys>] for a list's keys
   <type> is the name of the type for leafs and leaf-lists

In this document, these words will appear with that interpretation only when in ALL CAPS. Lower case uses of these words are not to be interpreted as carrying RFC-2119 significance.

3. Overview

Power over Ethernet (PoE) provides a way to allows devices receiving power over the same cable used for data transmission. It also enables applications of powered devices connected to the network and managed by a remote management application. The IEEE 802.3 Working Group has finished two standardization projects on this subject, known as IEEE 802.3af and IEEE 802.3at.

With the increase of required power level in nowadays, the Working Group is now working on the 4-pair PoE which provides up to 90 watts powering known as IEEE 802.3bt [IEEE 802.3bt] to enable more applications such as lighting over Ethernet for intelligent lighting system.

The IEEE 802.3 WG is currently also working on a YANG data model for the management of Power Source Equipment in [IEEE P802.3.2], however, it did not define a full management interface, but only the managed objects based on the hardware registers. The module defined in this document is an extension to that module to provide management required for the poe system and ports as defined in Power Ethernet MIB[RFC3621], so as to be used by the system administrator for management.

4. Design of the data model

This document defines the YANG module "ietf-poe-power-management", which has two parts: main power source management and pse port management. Besides, the module also defines several notifications for the port and power source. The model structure is as follows:

module: ietf-poe-power-management
    +--rw main-power-source-config
    |  +--rw main-power-source-entry* [slot-id]
    |     +--rw slot-id            uint32
    |     +--rw usage-threshold?   percentage
    +--ro main-power-sources-state
       +--ro main-power-source-entry* [slot-id]
          +--ro slot-id       uint32
          +--ro power-info
          |  +--ro total-power?       decimal64
          |  +--ro reserved-power?    percentage
          |  +--ro consuming-power?   decimal64
          |  +--ro remained-power?    decimal64
          |  +--ro peak-power?        decimal64
          |  +--ro usage-threshold?   percentage
          +--ro operStatus?   enumeration
  augment /if:interfaces/if:interface/eth:ethernet/pse:poe-pse:
    +--rw event-notification-enable?   boolean
  augment /if:interfaces/if:interface/eth:ethernet/pse:poe-pse/pse:multi-pair:
    +--rw poe-ports-config
       +--rw power-priority?      uint32
        +--rw connected-pd-type?   string
notifications:
    +---n poe-port-notification
    |  +--ro event* [if-name event-type]
    |     +--ro if-name          string
    |     +--ro event-type       identityref
    |     +--ro event-content
    |        +--ro detection-status?       pse-detection-state
    |        +--ro pd-connection-events    identityref
    +---n poe-power-notification
       +--ro event* [slot-id event-type]
          +--ro slot-id          uint8
          +--ro event-type       identityref
          +--ro event-content
             +--ro power-usage
                +--ro consuming-power    uint32
                +--ro usage-threshold?   uint32

		

4.1. Main Power Source management

As defined Power Etherent MIB[RFC3621], the main power source container defines the management attributes for a managed main power source in a PSE device. Ethernet switches are one example of boxes that would support these objects.

		module: poe-power-management
    +--rw main-power-source-config
    |  +--rw main-power-source-entry* [slot-id]
    |     +--rw slot-id            uint32
    |     +--rw usage-threshold?   percentage
    +--ro main-power-sources-state
       +--ro main-power-source-entry* [slot-id]
          +--ro slot-id       uint32
          +--ro power-info
          |  +--ro total-power?       decimal64
          |  +--ro reserved-power?    percentage
          |  +--ro consuming-power?   decimal64
          |  +--ro remained-power?    decimal64
          |  +--ro peak-power?        decimal64
          |  +--ro usage-threshold?   percentage
          +--ro operStatus?   enumeration

		

Container "poe-power-management" contains a list of main power source entry in both configuration and operational state. In configuration, the entry contains a slot-id node to indicate its belonged chassis id. It also provides a usage-threhold to express in percents for comparing the measured power and initiating an alarm if the threshold is exceeded.

For the operational state, the main power source entry provides power information for the management, including the total power, reserved power, consuming power, remained power, peak power etc al. It also provide "operStauts" node to indicate current operational status of the main PSE whether it is on/off/faulty.

4.2. PSE port management

The pse port management augments the YANG module "ieee802-pse.yang" with extra management objects defined in Power Ethernet MIB [RFC3621] for required management of the pse ports.

		augment /if:interfaces/if:interface/eth:ethernet/pse:poe-pse:
    +--rw event-notification-enable?   boolean
		augment /if:interfaces/if:interface/eth:ethernet/pse:poe-pse/pse:multi-pair:
    +--rw poe-ports-config
       +--rw power-priority?      uint32
       +--rw connected-pd-type?   String
		

Under the poe-pse container in ieee802-pse module, this document defines a data node to control the notification of event. Besides, for the multiple pair PSE, it defines power priority as pethPsePortPowerPrority object defined in PoE MIB to control the priority of the port from the point of view of a power management system. The node "connected-pd-type" is the same as the pethPsePortType object in PoE MIB for a managr to indicate the type of the powered device that is connected to the port.

4.3. Notification

Consist with notifications defined in Power Etherent MIB [RFC3621], this document also provides notifications for pse ports and power source to be transmitted from the agent to a management application.

		notifications:
    +---n poe-port-notification
    |  +--ro event* [if-name event-type]
    |     +--ro if-name          string
    |     +--ro event-type       identityref
    |     +--ro event-content
    |        +--ro detection-status?       pse-detection-state
    |        +--ro pd-connection-events    identityref
    +---n poe-power-notification
       +--ro event* [slot-id event-type]
          +--ro slot-id          uint8
          +--ro event-type       identityref
          +--ro event-content
             +--ro power-usage
                +--ro consuming-power    uint32
                +--ro usage-threshold?   uint32
		

This module defines two sets of notification for pse port and the power supply.

5. POE Power Management module

	<CODE BEGINS> file "ietf-poe-power-management@2017-03-07.yang"
module ietf-poe-power-management{
	namespace "urn:ietf:params:xml:ns:yang:ietf-poe-power-management";
    prefix poe-power;

	import ietf-interfaces { 
		prefix if;
	}
	import ieee802-ethernet-interface { 
        prefix eth;
    }
	import ieee802-pse {
		prefix pse;
	}

  
	/**Meta information**/
    organization
    "IETF NETMOD (NETCONF Data Modeling Language) Working Group"; 
 
 
    contact 
     "WG Web:   < http://tools.ietf.org/wg/netmod/ >
        WG List:  <mailto:netmod@ietf.org >
        WG Chair: Lou Berger
                  <mailto:lberger@labn.net >
        WG Chair: Kent Watsen
                  <mailto:kwatsen@juniper.net >
		
		Editor: Yan Zhuang
				<mailto:zhuangyan.zhuang@huawei.com.com >
	 ";

  
  description
    "This module contains YANG defintions for configuring and 
     managing power system for Power Over Ethernet feature defined by
     IEEE 802.3. It provdes functionality roughly equivalent to
     that of the POWER-ETHERNET-MIB defined in RFC3621.";
  
  revision 2017-03-09{
	description
	"Initial version of power management for IEEE 802.3 PSE.";
	reference
	"draft-zhuang-netmod-yang-poe-management-00.txt";
  }
  
  /*Identities and typedef*/
  typedef percentage { 
    type uint8 {
      range "0..100";
    }
	description "Percentage value in integer format.";
  }
  
  identity poe-port-event {
    description "Poe port event notification base type.";
  }
  
  identity poe-power-module-event {
	description "Poe power module event notification base type.";
  }
  
  identity power-usage-alarm {
	base poe-power-module-event ;
	description
	"Base identity for power usage event";
  }
  identity power-status-event {
    base poe-port-event ;
	description "Poe port power status change notification.";
  }
  
  identity pd-connection-status-event {
    base poe-port-event ;
	description "Poe port peer,the power device status change notification.";
  }
  
  identity power-absence-event {
    base poe-port-event ;
    description "Poe port power absence notification.";
  } 
  identity pd-connection-status {
    description
      "Base identity for the PD connnection status";
  }
    identity pd-connected {
    base pd-connection-status;
    description
      "pd is connected";
  }
  
  identity pd-disconnected {
    base pd-connection-status;
    description
      "pd is disconnected";
  }
  
  identity pd-class-invalid {
    base pd-connection-status;
    description "pd class is invalid";
  }
  
  identity pd-class-over-current {
    base pd-connection-status;
    description "pd class is over current";
  }
  
  typedef pse-detection-state {       
    type enumeration {
      enum disabled {
        value 1;
        description "PSE disabled";
      }
      enum searching {
        value 2;
        description "PSE is searching";
      }
      enum deliveringPower {
        value 3;
        description "PSE is delivering power";
      }
      enum fault {
        value 4;
        description "PSE fault detected";
      }
      enum test {
        value 5;
        description "PSE test mode";
      }
      enum otherFault {
        value 6;
        description "PSE implementation specific fault detected";
      }
    }
	description
     "detection state of a multi-pair PSE";
    reference
     "IEEE Std 802.3, 30.9.1.1.5";
  }
  
  /************* PSE port management ******************/
  augment "/if:interfaces/if:interface/eth:ethernet/pse:poe-pse"{
  	description "enable pse port notification";
	leaf event-notification-enable {
          type boolean ;
          default false ;
		  description "PSE port event notification switch.";
        }
  }
  
  augment "/if:interfaces/if:interface/eth:ethernet/pse:poe-pse/pse:multi-pair"{
  description "configuration of pse port management";
	container poe-ports-config {
		description "configuration for all poe ports.";
	  leaf power-priority {
          type uint32;
          description
             "This object controls the priority of the port from the point
            of view of a power management algorithm.";
        }
		leaf connected-pd-type {
          type string;
          description
            "A manager will set the value of this variable to indicate
            the type of powered device that is connected to the port.
            The default value supplied by the agent if no value has
            ever been set should be a zero-length octet string";
        }
	}
  }
  augment "/if:interfaces-state/if:interface/eth:ethernet/pse:poe-pse/pse:multi-pair"{
  description "operational state for pse port";
  container poe-ports-state {
		config false;
		description "operational state for all poe ports.";
		
		leaf power-priority {
          type uint32;
          description
             "This object controls the priority of the port from the point
            of view of a power management algorithm.";
        }
		leaf connected-pd-type {
          type string;
          description
            "A manager will set the value of this variable to indicate
            the type of powered device that is connected to the port.
            The default value supplied by the agent if no value has
            ever been set should be a zero-length octet string";
        }
	}
  }

  
  /************** power source management ***************/
  /* Poe power module usage alarm configuration */
  container main-power-source-config {
       
   list main-power-source-entry{
		key "slot-id";
		description "main power source entry";
		
		leaf slot-id {
			type uint32;
			description "Poe power module installed slot.";
		}
		leaf usage-threshold {
			type percentage ;
          description
          "The usage threshold expressed in percents for 
           comparing the measured power and initiating an alarm 
           if the threshold is exceeded.";

        }
	}
	description "Configurations of the main power source.";
  }
  
  /*main source operational state*/
  container main-power-sources-state {
    config false;
       
    description
      "operational state for main power source";
       
    list main-power-source-entry {
      key "slot-id";
      description "main power source entry";
          
      leaf slot-id {
		type uint32;
        description "Poe power module installed slot.";
      }
          
      container power-info {
        description 
          "power information of the main power source";
        
        leaf total-power {
          type decimal64 {
            fraction-digits 4;
          }
          units 'watt';
          description
            "The nominal power of the PSE expressed in Watts";
        }
        
        leaf reserved-power {
          type percentage ;
          description
            "The percent of power that the system reserved.";
        }
        
        leaf consuming-power {
          type decimal64 {
            fraction-digits 4;
          }
          units 'watt';
          description
            "Measured usage power";
        }
        
        leaf remained-power {
          type decimal64 {
            fraction-digits 4 ;
          }
          units 'watt';
          description
            "total power * (1-reserved power)-consuming Power";
        }
        
        leaf peak-power {
          type decimal64 {
            fraction-digits 4;
          }
          units 'watt';
          description
            "the peak power";
        }
        
        leaf usage-threshold {
          type percentage ;
          
          description
            "The usage threshold expressed in percents for
             comparing the measured power and initiating
             an alarm if the threshold is exceeded.";
        }
        
      }

          
      leaf operStatus {
        type enumeration {
          enum on {
            value 1;
            description "the main pse is on";
          }
          enum off {
            value 2;
            description "the main pse is off";
          }
          enum faulty {
            value 3;
            description "the main pse is faulty";
          }
        }
      
        default on;
        description
          "The operational status of the main PSE";
      }
    }
  }
  

   /*
   * Notifications
   */
   
      /*
   * Notifications
   */
  notification poe-port-notification {
    description "Port event notification when the notification switch is on.";
    
      list event {
      key "if-name event-type";
      description "list of events";
      leaf if-name {
		type string ;
        description "Poe port interface name";
      }
      
      leaf event-type {
        type identityref {
          base poe-port-event ;
        }
		description "event type for poe port.";
      }
      
      container event-content {
        description "Event notification content.";
        
        leaf detection-status {
          when " ../../event-type = 'pse:power-status-event' " ;
          type pse-detection-state;
          description "pse detection status";
        }
        
        leaf pd-connection-events {
          when " ../../event-type = 'pse:pd-connection-status-event'" ;          
          
          type identityref {
            base pd-connection-status;
          }
		  mandatory true;
		  description "pd connection events";
        }
      }
    }
  }
  notification poe-power-notification {
    description "power event notification when the notification switch is on.";
    
      list event {
      key "slot-id event-type";
      description "list of power events.";
      leaf slot-id {
        type uint8 ;
		description "Slot id of the power source";
      }
      
      leaf event-type {
        type identityref {
          base poe-power-module-event ;
        }
		description "event type for main power source.";
      }
      
      container event-content {
        description "Event notification content.";
        
        container power-usage {
          when " ../../event-type = 'poe-power:power-usage-alarm' " ;
          description "poe usage event content.";
		  
          leaf consuming-power {
            type uint32;
			mandatory true;
            description "consuming power";
          }
          
          leaf usage-threshold {
            type uint32;
            description "usage threshold";
          } 
        }
      }
    }
  }
}
    <CODE ENDS>
	

6. Security Consideration

TBD

7. Acknowledgements

8. Normative References

[IEEE-802.3.2] IEEE 802.3 Working Group, , "IEEE P802.3.2 - YANG Data Model Definitions (ongoing)"
[IEEE-802.3af] IEEE 802.3 Working Group, , "IEEE Std 802.3af-2003 - Data Terminal Equipment (DTE) Power via Media Dependent Interface (MDI)", 2003.
[IEEE-802.3at] IEEE 802.3 Working Group, , "IEEE Std 802.3at-2009-DTE Power Enhancements", 2009.
[IEEE-802.3bt] IEEE 802.3 Working Group, , "DTE Power via MDI over 4-Pair (ongoing)"
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997.
[RFC3621] Berger, A. and D. Romascanu, "Power Ethernet MIB", December 2003.
[RFC7950] Bjorklund, M., "The YANG 1.1 Data Modeling Language", RFC 7950, DOI 10.17487/RFC7950, Augest 2016.

Appendix A. Related modules

	<CODE BEGINS> file "ieee802-ethernet-interface.yang"
	module ieee802-ethernet-interface {
  yang-version "1.1";

  namespace
    "urn:ieee:params:xml:ns:yang:ieee802-ethernet-interface";

  prefix eth-if;

  import ietf-yang-types {
    prefix yang;
  }

  import ietf-interfaces {
    prefix if;
  }

  import iana-if-type {
    prefix ianaift;
  }

  organization
    "Web URL: http://www.ieee802.org/3/

     Working Group Chair:
       David Law
       dlaw@hpe.com

     Working Group Vice-chair:
       Adam Healey
       adam.healey@broadcom.com

     Acting YANG Data Model Definitions Task Force Chair:
       Yan Zhuang
       zhuangyan.zhuang@huawei.com

     Editor:
       Robert Wilton
       rwilton@cisco.com";

  contact
    "Robert Wilton - rwilton@cisco.com";
  
  description
    "This module contains YANG definitions for configuring IEEE 802.3
     Ethernet Interfaces.

     In this YANG module, 'Ethernet interface' can be interpretted
     as referring to 'IEEE 802.3 standard compliant Ethernet
     interfaces'";
  reference "IEEE 802.3-2015, unless dated explicitly";
  
  revision 2017-02-23 {
    description
      "Initial revision of YANG model for IEEE 802.3 Ethernet
       interfaces.

       Changes from previous draft:
       - Changed speed to decimal64, in Gb/s to 3 decimal places.
       - Moved Ethernet stats under the Ethernet interface container,
         since someone retrieving the higher layer stats may not want
         to get Ethernet statistics at the same time because they
         are a lower layer.
       - Changed counters from uint64 to yang:counter64:
         - More consistent with the RFC 7223 and MIB counters.
       - Rejigged auto-neg, duplex, speed, fc, pfc to be more inline
         with how IETF NETMOD thinks that future models should look
         like.  Specifically to allow for an easy migrate to combined
         config and state trees.";
         
    reference 
      "IEEE P802.3.2 (IEEE 802.3cf) YANG Data Model Definitions Task
       Force";
  }

  typedef eth-if-speed-type {
    type decimal64 {
      fraction-digits 3;
    }
    units "Gb/s";
    description
      "Used to represent the configured, negotiated, or actual speed
       of an Ethernet interface in Gigabits per second (Gb/s),
       accurate to 3 decimal places (i.e. accurate to 1 Mb/s)";
  }

  typedef duplex-type {
    type enumeration {
      enum full {
        description "Full duplex";
      }

      enum half {
        description "Half duplex";
      }
    }
    default full;
    description 
      "The current duplex mode of operation of an Ethernet
       interface.";
    reference "IEEE Std 802.3, 30.3.1.1.32, aDuplexStatus";
  }

  typedef pause-fc-direction-type {
    type enumeration {
      enum "disabled" {
        description 
          "Flow-control disabled in both ingress and egress
           directions. I.e. PAUSE frames are not transmitted and
           PAUSE frames received on ingress are discarded without
           processing";
      }
      enum "ingress-only" {
        description
         "Flow control is enabled in the ingress direction only.
          I.e. PAUSE frames may be transmitted to reduce the ingress
          traffic flow, but PAUSE frames received on ingress are
          dicarded without reducing the egress traffic rate.";
      }
      enum "egress-only" {
        description
          "Flow control is enabled in the egress direction only.
           I.e. PAUSE frames are not transmitted, but PAUSE frames
           received on ingress are processed to reduce the egress
           traffic rate.";
      }
      enum "bi-directional" {
        description
         "Flow control is enabled in both ingress and egress
          directions. I.e. PAUSE frames may be transmitted to reduce
          the ingress traffic flow, and PAUSE frames received on
          ingress are processed to reduce the egress traffic rate.";
      }
    }
    description
      "Enumerates the possible PAUSE frame based flow control
       settings that can be used in explicit configuration, or when
       reporting the operational state";
    /*
     * TODO - Remove/replace references to 802.3.1 here, is there
     * a clause 30 equivalent?
     */
    reference
      "IEEE 802.3.1, dot3PauseAdminMode and dot3PauseOperMode";
  }

  feature ethernet-pfc {
    description
      "This device supports Ethernet priority flow-control";
  }

  // TODO - How should MPCP be handled?

  augment "/if:interfaces/if:interface" {
    when "if:type = 'ianaift:ethernetCsmacd'" {
      description "Applies to all P2P Ethernet interfaces";
    }
    description 
      "Augment interface model with IEEE 802.3 Ethernet interface
       specific configuration nodes";

    container ethernet {
      description
        "Contains all Ethernet interface related configuration";
           
      container auto-negotiation {
        description
          "Contains auto-negotiation transmission parameters

           XXX, reference the general interface configuration.
           Allows the advertised duplex value in the negotiation to
           be restricted.

           If not specified then the default behaviour is to
           negotiate all available values for the particular type of
           Ethernet PHY associated with the interface.

           If auto-negotiation is enabled, and flow control has not
           been explicitly configured, then the default flow control
           capabilities that are negotiated allows for bi-directional
           or egress-only flow control to be negotiated (depending on
           the peer device capabilities/configuration).

           If auto-negotiation is enabled, and flow control has been
           explicitly configured, then the configuration settings
           restrict the values that may be negotiated.  However, it
           should be noted that the protocol does not allow only
           egress flow control to be negotiated without also allowing
           bi-directional flow control.";
        reference "IEEE 802.3 section 28 and annexes 28A-D";

        leaf enable {
          type boolean;
          
          description
            "Controls whether auto-negotiation is enabled or
             disabled.
             
             For interface types that support auto-negotiation then
             it defaults to being enabled.  TODO - Or should the
             default just be left to vendor discretion?";
        }
      }
    
      leaf duplex {
        type duplex-type;
        default full;
        description 
          "Force the Ethernet interface to run in full or half duplex
           mode (if supported).

           If auto-negotiation is enabled then explicitly configuring
           duplex restricts the duplex value that may be negotiated.
           If the peer device does not accept a configured duplex
           value then auto-negotiation will fail, and the link will
           not come up.

           Half duplex can only be negotiated for some interface
           types - as specified in 802.3, annex section 28B.3.";
        reference "IEEE 802.3, 30.3.1.1.32, aDuplexStatus";
      }
            
      leaf speed {
        type eth-if-speed-type;

        description
          "For PHY types that may operate at various speeds, this
           leaf allows the interface to be forced to operate at a
           particular speed.  Without any explicit configuration,
           Ethernet interfaces run at the maximum speed that they are
           capable of operating at

           Allows the advertised speed value (Gb/s) in the
           negotiation to be restricted. Speed is only negotiated for
           some PHYs, many higher speed PHYs operate at a fixed
           speed.  If this leaf is not set then the default behaviour
           is to negotiate all available speeds, generally choosing
           the fastest speed as per 802.3 Annex 28B.3.";
      }

      container flow-control {
        description
          "Holds the different types of Ethernet flow control that
           can be enabled";
        container pause {
          description "802.3 PAUSE frame based flow control";
          reference "IEEE 802.3, xxx";
            leaf direction {
            type pause-fc-direction-type;
            description
              "Indicates which direction flow control is enabled in,
               or whether it is disabled.  The default flow-control
               settings are vendor specific.

               If auto-negotiation is enabled, then PAUSE based
               flow-control is negoiated by default.";
          }
        }

        container pfc {
          if-feature "ethernet-pfc";
          description "802.3 Priority-based flow control";
          reference "IEEE 802.3, Annex 31 D";

          leaf enable {
            type boolean;
              // TODO - Add must statement to enforce pfc xor pause,
              // must "";

            description
              "True indicates that 802.3 priority-based flow control
               is enabled, false indicates that 802.3 priority-based
               flow control is disabled.

               For interfaces that have auto-negotiation, then
               priority-based flow control is negotiated by default.

               If explicitly configured, when auto-negotiated is
               enabled, then the configuration will restrict the
               priority flow control settings that can be negotiated.
               ";
          }
        }
        
        leaf force-flow-control {
          type boolean;
          default false;
          description
            "Explicitly force the local flow control settings
             regardless of what has been negotiated.

             Since the auto-negotiation of flow-control settings
             doesn't allow all sane combinations to be negotiated
             (e.g.  consider a device that is only capable of sending
             PAUSE frames connected to a peer device that is only
             capable of receiving and acting on PAUSE frames) and
             failing to agree on the flow-control settings doesn't
             cause the auto-negotation to fail completely, then it is
             sometimes useful to be able to explicitly enable
             particular flow control settings on the local device
             regardless of what is being advertised or negotiated";
          reference
            "IEEE 802.3 Table 28B-3-Pause resolution";
        }
      }
    }
  }  

  /*
   * Operational State.
   */
  augment "/if:interfaces-state/if:interface" {
    when "if:type = 'ianaift:ethernetCsmacd'" {
      description "Applies to all Ethernet interfaces";
    }
    description 
      "Augments interfaces-state model with 802.3 Ethernet
       specific operational state nodes";

    container ethernet {
      description
        "Contains operational state for Ethernet interfaces";
      
      container auto-negotiation {
        description
          "Holds all operational state related to auto-negotiation.";

        leaf enable {
          type boolean;
          
          description
            "Indicates whether auto-negotiation is enabled or
             disabled.  If the interface is not capable of supporting
             auto-negotiation then this must be reported as false";
        }
        
        leaf negotiation-status {
          when "../enable = 'true'";
          type enumeration {
            enum in-progress {
              description
                "The auto-negotiation protocol is running and
                 negotiation is currently in-progress";
            }
            enum complete {
              description
                "The auto-negotation protocol has completed
                 successfully";
            }
            enum failed {
              description
                "The auto-negotation protocol has failed.";
            }
            enum unknown {
              description
                "The auto-negotiation status is not currently known,
                 this could be because it is still negotiating or the
                 protocol cannot run (e.g. if no medium is present)";
            }
          }
          description
            "The status of the auto-negotiation protocol";
          reference "IEEE 802.3, 30.6.1.1.4, aAutoNegAutoConfig";
        }
      }

      leaf duplex {
        type duplex-type;
        description 
          "Operational duplex mode of the Ethernet interface.";
        reference "IEEE Std 802.3, 30.3.1.1.32, aDuplexStatus";
      }
      
      leaf speed {
        type eth-if-speed-type;
        units "Gb/s";
        description "Operational speed of the Ethernet interface";
      }

      container flow-control {
        description
          "Holds the different types of Ethernet flow control that
           can be enabled";
        container pause {
          description "802.3 PAUSE frame based flow control";
          reference "IEEE 802.3, xxx";
          leaf direction {
            type pause-fc-direction-type;
            description
              "Indicates which direction flow control is enabled in,
               or whether it is disabled.  The default flow-control
               settings are vendor specific.

               If auto-negotiation is enabled, then PAUSE based
               flow-control is negoiated by default.";
          }

          container statistics {
            description
              "Contains the number of PAUSE frames received or
               transmitted";
            leaf in-pkts-pause {
              type yang:counter64;
              units frames;
              description 
                "A count of PAUSE MAC Control frames transmitted on
                 this Ethernet interface.

                 Discontinuities in the values of this counters in
                 this container can occur at re-initialization of the
                 management system, and at other times as indicated
                 by the value of the 'discontinuity-time' leaf
                 defined in the ietf-interfaces YANG module (RFC
                 7223).";
              reference 
                "IEEE 802.3, 30.3.4.3, aPAUSEMACCtrlFramesReceived";
            }
            leaf out-pkts-pause {
              type yang:counter64;
              units frames;
              description 
                "A count of PAUSE MAC Control frames transmitted on
                 this Ethernet interface.

                 Discontinuities in the values of this counters in
                 this container can occur at re-initialization of the
                 management system, and at other times as indicated
                 by the value of the 'discontinuity-time' leaf
                 defined in the ietf-interfaces YANG module (RFC
                 7223).";
              reference 
                "IEEE 802.3, 30.3.4.2, 
                 aPAUSEMACCtrlFramesTransmitted";
            }
          }
        }

        container pfc {
          if-feature "ethernet-pfc";
          description "802.3 Priority-based flow control";
          reference "IEEE 802.3, Annex 31 D";

          leaf enable {
            type boolean;
              // TODO - Add must statement to enforce pfc or pause,
              // not both.
              // must "";

            description
              "True indicates that 802.3 priority-based flow control
               is enabled, false indicates that 802.3 priority-based
               flow control is disabled.

               For interfaces that have auto-negotiation, then
               priority-based flow control is negotiated by default.

               If explicitly configured, when auto-negotiated is
               enabled, then the configuration will restrict the
               priority flow control settings that can be
               negotiated.";
          }

          container statistics {
            description "TODO";

            leaf in-pkts-pfc {
              type yang:counter64;
              units frames;
              description 
                "A count of PFC MAC Control frames received on this
                 Ethernet interface.

                 Discontinuities in the values of this counters in
                 this container can occur at re-initialization of the
                 management system, and at other times as indicated
                 by the value of the 'discontinuity-time' leaf
                 defined in the ietf-interfaces YANG module (RFC
                 7223).";
              reference "IEEE 802.3.1, dot3HCInPFCFrames";
            }

            leaf out-pkts-pfc {
              type yang:counter64;
              units frames;
              description 
                "A count of PFC MAC Control frames transmitted on
                 this interface.

                 Discontinuities in the values of this counters in
                 this container can occur at re-initialization of the
                 management system, and at other times as indicated
                 by the value of the 'discontinuity-time' leaf
                 defined in the ietf-interfaces YANG module (RFC
                 7223).";
              reference "IEEE 802.3.1, dot3HCInPFCFrames";
            }
          }
        }
        
        leaf force-flow-control {
          type boolean;
          description
            "Explicitly force the local flow control settings
             regardless of what has been negotiated.

             Since the auto-negotiation of flow-control settings
             doesn't allow all sane combinations to be negotiated
             (e.g.  consider a device that is only capable of sending
             PAUSE frames connected to a peer device that is only
             capable of receiving and acting on PAUSE frames) and
             failing to agree on the flow-control settings doesn't
             cause the auto-negotation to fail completely, then it is
             sometimes useful to be able to explicitly enable
             particular flow control settings on the local device
             regardless of what is being advertised or negotiated";
          reference
            "IEEE 802.3 Table 28B-3-Pause resolution";
        }
      }

      leaf max-frame-length {
        type uint16;
        units octets;
        description
          "This indicates the MAC frame length (including FCS bytes)
           at which frames are dropped for being too long.";
        reference "IEEE 802.3, 30.3.1.1.25, aMaxFrameLength";
      }
      
      // TODO - Do we need this?  Can it be express in a better way?
      leaf macc-extension-control {
        type boolean;
        description
          "A value that identifies the current EXTENSION MAC Control
           function, as specified in IEEE Std 802.3, Annex 31C.";
        reference 
          "IEEE Std 802.3, 30.3.8.3 aEXTENSIONMACCtrlStatus
           IEEE Std 802.3.1, dot3ExtensionMacCtrlStatus ";
      }

      /*
       * TODO - Should this leaf also be configurable?  Is this a
       *        current leaf?
       */
      leaf frame-limit-slow-protocol {
        type uint32;
        units fps;
        default 10;
        description
          "The maximum number of Slow Protocol frames of a given
           subtype that can be transmitted in a one second interval.
           The default value is 10. ";
        reference 
          "IEEE Std 802.3, 30.3.1.1.38, aSlowProtocolFrameLimit";
      }

      /*
       * TODO - Figure out whether capabilities should just be
       *        reported as a state container, or whether they would
       *        be better represented as a grouping and accessible
       *        via an RPC.
       */
      container capabilities {
        description
          "Container all Ethernet interface specific capabilties.";

        leaf auto-negotiation {
          type boolean;
          default false;
          description
            "Indicates whether auto-negotiation may be configured on
             this interface.";
        }

        /*
         * TODO - Extend these with other capabilities:
         *   speed, duplex, fc, pfc, etc.
         */
      }

      /*
       * Ethernet statistics.
       */
      container frame-statistics {
        description
          "Contains statistics specific to Ethernet interfaces
 
           All octet frame lengths include the 4 byte FCS.

           Error counters are only reported once ... The count
           represented by an instance of this object is incremented
           when the frameCheckError status is returned by the MAC
           service to the LLC (or other MAC user). Received frames
           for which multiple error conditions pertain are, according
           to the conventions of IEEE 802.3 Layer Management, counted
           exclusively according to the error status presented to the
           LLC.

           A frame that is counted by an instance of this object is
           also counted by the corresponding instance of 'in-errors'
           leaf defined in the ietf-interfaces YANG module (RFC
           7223).

           Discontinuities in the values of this counters in this
           container can occur at re-initialization of the management
           system, and at other times as indicated by the value of
           the 'discontinuity-time' leaf defined in the
           ietf-interfaces YANG module (RFC 7223).";

        leaf in-total-pkts {
          type yang:counter64;
          units frames;
          description 
            "The total number of frames (including bad frames)
             received on the Ethernet interface.

             This counter is calculated by summing the following
             802.3 clause 30 counters:
                 aFramesReceivedOK +
                 aFrameCheckSequenceErrors + 
                 aAlignmentErrors + 
                 aFrameTooLongErrors + 
                 aFrameTooShortErrors +
                 aFramesLostDueToIntMACRcvError

             Also see the 'description' statement associated with the
             parent 'statistics' container for additional common
             semantics related to this counter.
             ";

          // REVIEW NOTE - aFrameTooShortErrors is not currently
          // defined.
          reference
            "IEEE 802.3, various clause 30 counters, as specified in
             the description above.";
        }

        leaf in-total-octets {
          type yang:counter64;
          units octets;
          description 
            "The total number of octets of data (including those in
             bad frames) received on the Ethernet interface.

             Includes the 4 byte FCS.

             Also see the 'description' statement associated with the
             parent 'statistics' container for additional common
             semantics related to this counter.";

          // REVIEW NOTE - There does not appear to be any clause 30
          // register defined for this counter.
          reference
            "(RMON MIB: etherStatsOctets) IEEE 802.3, TODO";
        }

        leaf in-pkts {
          type yang:counter64;
          units frames;
          description 
            "A count of frames (including unicast, multicast and
             broadcast) that have been successfully received on
             the Ethernet interface.

             This count does not include frames received with
             frame-too-long, FCS, length or alignment errors, or
             frames lost due to internal MAC sublayer error.

             Also see the 'description' statement associated with the
             parent 'statistics' container for additional common
             semantics related to this counter.";

          reference
            "IEEE 802.3, 30.3.1.1.5 aFramesReceivedOK";
        }

        leaf in-multicast-pkts {
          type yang:counter64;
          units frames;
          description 
            "A count of multicast frames that have been successfully
             received on the Ethernet interface.

             This counter represents a subset of the frames counted
             by in-pkts.

             This count does not include frames received with
             frame-too-long, FCS, length or alignment errors, or
             frames lost due to internal MAC sublayer error.

             Also see the 'description' statement associated with the
             parent 'statistics' container for additional common
             semantics related to this counter.";

          reference
            "IEEE 802.3, 30.3.1.1.21 aMulticastFramesReceivedOK";
        }

        leaf in-broadcast-pkts {
          type yang:counter64;
          units frames;
          description 
            "A count of broadcast frames that have been successfully
             received on the Ethernet interface.

             This counter represents a subset of the frames counted
             by in-pkts.

             This count does not include frames received with
             frame-too-long, FCS, length or alignment errors, or
             frames lost due to internal MAC sublayer error.

             Also see the 'description' statement associated with the
             parent 'statistics' container for additional common
             semantics related to this counter.";

          reference
            "IEEE 802.3, 30.3.1.1.22 aBroadcastFramesReceivedOK";
        }


        /*
         * REVIEW NOTE - DELETE FOR PUBLICATION
         *
         * It looks like the definition of the aAlignmentErrors,
         * means that the counter is not incremented by interfaces 
         * that are 1Gb/s or faster.  Hence, I used the definition
         * from the RMON MIB that combined FCS and Alignment into a
         * single counter.
         */        
        leaf in-error-fcs-pkts {
          type yang:counter64;
          units frames;
          description 
            "A count of receive frames that are of valid length, but
             do not pass the FCS check, regardless of whether or not
             the frames are an integral number of octets in length.

             This count effective comprises aFrameCheckSequenceErrors
             and aAlignmentErrors added together.

             Also see the 'description' statement associated with the
             parent 'statistics' container for additional common
             semantics related to this counter.";

          reference
            "IEEE 802.3, 30.3.1.1.6, aFrameCheckSequenceErrors;
             IEEE 802.3, 30.3.1.1.7, aAlignmentErrors";
        }

        /*
         * REVIEW NOTE - DELETE FOR PUBLICATION:
         * 
         * RMON MIB has two separate counters for packets less than 64 bytes:
         * (etherStatsUndersizePkts etherStatsFragments) depending on
         * whether the frame passes the FCS check.  Neither clause
         * 30, nor the Etherlike MIB supports this split, so I've
         * not included the split counters (it would require two new
         * counters in clause 30).
         *
         * Further, the reference is to clause 30.1.1.1.10, aRunts,
         * but it isn't clear to me that this reference is entirely
         * correct.
         */
        leaf in-error-undersize-pkts {
          type yang:counter64;
          units frames;
          description
            "A count of frames received on a particular Ethernet
             interface that are less than 64 bytes in length, and
             are discarded.

             This counter is incremented regardless of whether the
             frame passes the FCS check.

             Also see the 'description' statement associated with the
             parent 'statistics' container for additional common
             semantics related to this counter.";

          // REVIEW NOTE - This reference does not appear to be
          // correct, is a new clause 30 register
          // definition required?         
          reference "IEEE 802.3, ";
        }

        /*
         * REVIEW NOTE - DELETE FOR PUBLICATION:
         *
         * RMON MIB has two separate counters for oversized packets
         * (etherStatsOversizePkts and etherStatsJabbers) depending on
         * whether the frame passes the FCS check.  Neither clause
         * 30, nor the Etherlike MIB supports this split, so I've
         * not included the split counters (it would require two new
         * counters in clause 30).
         */
        leaf in-error-oversize-pkts {
          type yang:counter64;
          units frames;
          description
            "A count of frames received on a particular Ethernet
             interface that exceed the maximum permitted frame size,
             that is specified in max-frame-length, and are
             discarded.

             This counter is incremented regardless of whether the
             frame passes the FCS check.

             Also see the 'description' statement associated with the
             parent 'statistics' container for additional common
             semantics related to this counter.";

          reference "IEEE 802.3, 30.3.1.1.25, aFrameTooLongErrors";
        }

        leaf in-error-mac-internal-pkts {
          type yang:counter64;
          units frames;
          description 
            "A count of frames for which reception on a particular
             Ethernet interface fails due to an internal MAC sublayer
             receive error.

             A frame is only counted by an instance of this object if
             it is not counted by the corresponding instance of
             either the in-error-fcs-pkts, in-error-undersize-pkts,
             or in-error-oversize-pkts.  The precise meaning of the
             count represented by an instance of this object is
             implementation-specific.

             In particular, an instance of this object may represent
             a count of receive errors on a particular Ethernet
             interface that are not otherwise counted.

             Also see the 'description' statement associated with the
             parent 'statistics' container for additional common
             semantics related to this counter.";

          reference
            "IEEE 802.3, 30.3.1.1.15,
             aFramesLostDueToIntMACRcvError";
        }

        /*
         * Egress counters.
         */
        // REVIEW NOTE: No out-total-octets counter since the
        // definition would match the out-octets counter in the
        // ietf-interfaces YANG module.  

        leaf out-pkts {
          type yang:counter64;
          units frames;
          description 
            "A count of frames (including unicast, multicast and
             broadcast) that have been successfully transmitted on
             the Ethernet interface.

             Also see the 'description' statement associated with the
             parent 'statistics' container for additional common
             semantics related to this counter.";

          reference
            "IEEE 802.3, 30.3.1.1.2 aFramesTransmittedOK";
        }

        leaf out-multicast-pkts {
          type yang:counter64;
          units frames;
          description 
            "A count of multicast frames that have been successfully
             transmitted on the Ethernet interface.

             This counter represents a subset of the frames counted
             by out-pkts.

             Also see the 'description' statement associated with the
             parent 'statistics' container for additional common
             semantics related to this counter.";

          reference
            "IEEE 802.3, 30.3.1.1.18 aMulticastFramesXmittedOK";
        }

        leaf out-broadcast-pkts {
          type yang:counter64;
          units frames;
          description 
            "A count of broadcast frames that have been successfully
             transmitted on the Ethernet interface.

             This counter represents a subset of the frames counted
             by out-pkts.

             Also see the 'description' statement associated with the
             parent 'statistics' container for additional common
             semantics related to this counter.";

          reference
            "IEEE 802.3, 30.3.1.1.19 aBroadcastFramesXmittedOK";
        }

        leaf out-error-mac-internal-pkts {
          type yang:counter64;
          units frames;
          description 
            "A count of frames for which transmission on a particular
             Ethernet interface fails due to an internal MAC sublayer
             transmit error.

             The precise meaning of the count represented by an
             instance of this object is implementation-specific. In
             particular, an instance of this object may represent a
             count of transmission errors on a particular Ethernet
             interface that are not otherwise counted.

             Also see the 'description' statement associated with the
             parent 'statistics' container for additional common
             semantics related to this counter.";

          reference
            "IEEE Std 802.3, 30.3.1.1.12,
             aFramesLostDueToIntMACXmitError";
        }
      }

      container phy-statistics {
        description
          "Ethernet statistics related to the PHY layer.

           Discontinuities in the values of this counters in this
           container can occur at re-initialization of the management
           system, and at other times as indicated by the value of
           the 'discontinuity-time' leaf defined in the
           ietf-interfaces YANG module (RFC 7223).";

        leaf in-error-symbol {
          type yang:counter64;
          units errors;
          description 
            "A count of the number of symbol errors that have
             occurred.

             For the precise definition of when the symbol error
             counter is incremented, please see the description text
             associated with aSymbolErrorDuringCarrier, specified in
             IEEE 802.3, section 30.3.2.1.5.

             Also see the 'description' statement associated with the
             parent 'phy-statistics' container for additional
             common semantics related to this counter.";
          reference 
            "IEEE 802.3, 30.3.2.1.5, aSymbolErrorDuringCarrier";
        }

        container lpi {
          description
            "Physical Ethernet statistics for the energy efficiency
             related low power idle indications.";

          leaf in-lpi-transitions {
            type yang:counter64;
            units transitions;
            description 
              "A count of occurrences of the transition from DEASSERT
               to ASSERT of the LPI_INDICATE parameter. The
               indication reflects the state of the PHY according to
               the requirements of the RS (see IEEE 802.3 22.7, 35.4,
               and 46.4).

               Also see the 'description' statement associated with
               the parent 'phy-statistics' container for additional
               common semantics related to this counter.";

            reference
              "IEEE 802.3, 30.3.2.1.11 aReceiveLPITransitions";
          }

          leaf in-lpi-time {
            type decimal64 {
              fraction-digits 6;
            }
            units seconds;
            description 
              "A count reflecting the total amount of time (in
               seconds) that the LPI_REQUEST parameter has the value
               ASSERT.  The request is indicated to the PHY according
               to the requirements of the RS (see IEEE 802.3 22.7,
               35.4, and 46.4).

               Also see the 'description' statement associated with
               the parent 'phy-statistics' container for additional
               common semantics related to this counter.";

            reference
              "IEEE 802.3, 30.3.2.1.9 aReceiveLPIMicroseconds";
          }

          leaf out-lpi-transitions {
            type yang:counter64;
            units transitions;
            description 
              "A count of occurrences of the transition from state
               LPI_DEASSERTED to state LPI_ASSERTED of the LPI
               transmit state diagram is the RS. The state transition
               corresponds to the assertion of the LPI_REQUEST
               parameter. The request is indicated to the PHY
               according to the requirements of the RS (see IEEE
               802.3 22.7, 35.4, 46.4.)

               Also see the 'description' statement associated with
               the parent 'phy-statistics' container for additional
               common semantics related to this counter.";

            reference
              "IEEE 802.3, 30.3.2.1.10 aTransmitLPITransitions";
          }

          leaf out-lpi-time {
            type decimal64 {
              fraction-digits 6;
            }
            units seconds;
            description 
              "A count reflecting the total amount of time (in
               seconds) that the LPI_INDICATION parameter has the
               value ASSERT.  The request is indicated to the PHY
               according to the requirements of the RS (see IEEE
               802.3 22.7, 35.4, and 46.4).

               Also see the 'description' statement associated with
               the parent 'phy-statistics' container for additional
               common semantics related to this counter.";

            reference
              "IEEE 802.3, 30.3.2.1.8 aTransmitPIMicroseconds";
          }
        }
      }

      container mac-control-statistics {
        description
          "Group of statistics specific to MAC Control operation of
           selected Ethernet interfaces.

           Discontinuities in the values of this counters in this
           container can occur at re-initialization of the management
           system, and at other times as indicated by the value of
           the 'discontinuity-time' leaf defined in the
           ietf-interfaces YANG module (RFC 7223).";

        reference 
          "IEEE 802.3, IEEE 802.3.1, dot3ExtensionTable";

        leaf in-pkts-macc-unknown {
          type yang:counter64;
          units frames;
          description 
            "A count of MAC Control frames with an unsupported opcode
             received on this Ethernet interface.

             Frames counted against this counter are also counted
             against in-discards defined in the ietf-interfaces YANG
             module (RFC 7223).

             Also see the 'description' statement associated with the
             parent 'mac-control-statistics' container for additional
             semantics.";
          reference 
            "IEEE 802.3, 30.3.3.5 aUnsupportedOpcodesReceived";
        }

        leaf in-pkts-macc-extension {
          type yang:counter64;
          units frames;
          description 
            "The count of Extension MAC Control frames received on
             this Ethernet interface.

             Also see the 'description' statement associated with the
             parent 'mac-control-statistics' container for additional
             semantics.";
          reference 
            "IEEE 802.3, 30.3.8.2
               aEXTENSIONMACCtrlFramesReceived";
        }

        leaf out-pkts-macc-extension {
          type yang:counter64;
          units frames;
          description 
            "The count of Extension MAC Control frames transmitted on
             this Ethernet interface.

             Also see the 'description' statement associated with the
             parent 'mac-control-statistics' container for additional
             semantics.";
          reference 
            "IEEE 802.3, 30.3.8.1
             aEXTENSIONMACCtrlFramesTransmitted";
        }
      }
    }
  }
}

	 <CODE ENDS>
	
	<CODE BEGINS> file "ieee802-pse.yang"
	module ieee802-pse{
  namespace "urn:ieee:params:xml:ns:yang:ieee802-pse";
  prefix pse;
  
  /**imports**/
  import ietf-interfaces { 
    prefix if;
  }
  
  import ieee802-ethernet-interface { 
    prefix eth-if;
  }
   
  /**Meta information**/
  organization
  "Web URL: http://www.ieee802.org/3/ 
  
      Working Group Chair: 
        David Law 
        dlaw@hpe.com 
  
      Working Group Vice-chair: 
        Adam Healey 
        adam.healey@broadcom.com 
  
      YANG Data Model Definitions Task Force Chair: 
        Yan Zhuang 
        zhuangyan.zhuang@huawei.com 
  
      Editor: 
        Fei Li 
        lifei@huawei.com"; 
 
 
    contact 
     "Fei Li - lifei@huawei.com"; 

  
  description
  "This module contains YANG defintions for confirguring and 
  managing ports with Power Over Ethernet feature defined by
  IEEE 802.3. It provdes funcitonality roughly equivalent to
  that of the POWER-ETHERNET-MIB defined in RFC3621.";
   
   revision 2017-03-02{
	description
	"revision for IEEE 802.3 PSE.
	
	changes from previous version:
	- remove notification container.
	";
	reference 
      "IEEE P802.3.2 (IEEE 802.3cf) YANG Data Model Definitions Task
       Force";
  }
  
  revision 2017-01-25{
	description
	"revision for IEEE 802.3 PSE.
	
	changes from previous version:
	- remove power management into a separate module.
	- provide the pse module for both multi-pair PSE and single pair PSE (PoDL PSE).
	";
	reference 
      "IEEE P802.3.2 (IEEE 802.3cf) YANG Data Model Definitions Task
       Force";
  }
  
  revision 2016-12-26{
    description
    "Initial revision of YANG model for IEEE 802.3 multi-pair PSE.
	
	changes from previous version:
	- augement from ieee802-ethernet-interface and keep consist with it.
	- change the module name to multi-pair pse.";
	
	reference 
      "IEEE P802.3.2 (IEEE 802.3cf) YANG Data Model Definitions Task
       Force";
  }


  /*Identities and typedef*/   
  typedef pse-detection-state {       
    type enumeration {
      enum disabled {
        value 1;
        description "PSE disabled";
      }
      enum searching {
        value 2;
        description "PSE is searching";
      }
      enum deliveringPower {
        value 3;
        description "PSE is delivering power";
      }
      enum fault {
        value 4;
        description "PSE fault detected";
      }
      enum test {
        value 5;
        description "PSE test mode";
      }
      enum otherFault {
        value 6;
        description "PSE implementation specific fault detected";
      }
    }
	description
     "detection state of a multi-pair PSE";
    reference
     "IEEE Std 802.3, 30.9.1.1.5";
  }
  
  typedef podl-detection-state{	
	type enumeration {
      enum unkown {
        value 1;
        description "true state unknown";
      }
      enum disabled {
        value 2;
        description "PoDL PSE is disabled";
      }
	  enum searching {
		value 3;
		description "PoDL PSE searching";
	  }
      enum deliveringPower {
        value 4;
        description "PoDL PSE delivering power";
      }
	  enum sleep {
		value 5;
		description "PoDL PSE sleep";
	  }
      enum idle {
        value 6;
        description "PoDL PSE idle";
      }
      enum error {
        value 7;
        description "PoDL PSE error";
      }
    }
	
	description
	"detection state of a PoDL PSE";
	reference
	"IEEE Std 802.3, 30.15.1.3";
  }
  
  typedef power-class {       
    type enumeration {
      enum class0 {
        value 1;
        description "class 0";
      }
      enum class1 {
        value 2;
        description "class 1";
      }
      enum class2 {
        value 3;
        description "class 2";
      }
      enum class3 {
        value 4;
        description "class 3";
      }
      enum class4 {
        value 5;
        description "class 4";
      }
      enum class5 {
        value 6;
        description "class 5";
      }
      enum class6 {
        value 7;
        description "class 6";
      }
      enum class7 {
        value 8;
        description "class 7";
      }
      enum class8 {
        value 9;
        description "class 8";
      }
	  enum class9 {
		value 10;
		description "class 9. only for PoDL PSE";
	  }
    }
	 description
      "power class";
    reference
      "IEEE Std 802.3, 30.9.1.1.6 aPSEPowerClassification";
  }
  
  identity pse-pair-mode {
    description "Base type for wire pair mode for pse power to pd.";
  }
  
  identity multi-pair-mode {
    description "Pse using 2 or 4 pair wire to supply power to pd.";
  }

  identity podl-mode {
    description "Pse using only 1 pair wire to supply power to pd.";
  }
  
  /*
   * Configuration
   */
  /*poe port*/
  augment "/if:interfaces/if:interface/eth-if:ethernet" {
    description
    "Augements ethernet interface configuration model with 
     nodes specific to DTE Power via MDI devices and ports";
    
    container poe-pse {
      description
        "DTE Power via MDI port configuration";
      reference
        "802.3, 30.9.1 Multi-pair PSE and 802.3, 30.15.1 PoDL PSE";
        
      container multi-pair {
        presence "Pse port working in multi-pair mode.";

        description
         "Multi-pair PSE port configuration in std802.3 30.9.1.";
    
        leaf pse-enable {
          type boolean;
          default false;
          description
            "whether to enable the PSE function on the interface.";
          reference
            "802.3 30.9.1.1.2 aPSEAdminState";
        }
       
        leaf powering-pairs {    
          type enumeration {
            enum signal {
              value 1;
              description
               "the signal pair is in use";
            }
            enum spare {
              value 2;
              description
               "the spare pair is in use";
            }
            enum both {
              value 3;
              description
               "4-pair powering which is for .bt devices";
            }
          }
		 description
           "Describes or controls the pairs in use. If the value of pethPsePortPowerPairsControl is true, this object is writeable";
          
         reference
            "IEEE Std 802.3, 30.9.1.1.4 aPSEPowerPairs";
        }

      }

      container single-pair {
        presence "Pse port working in single-pair mode.";

        description
         "PoDL PSE configuration as defined in std802.3 30.15.1";
    
        leaf pse-enable {
          type boolean;
          default false;
          description
            "whether to enable the PSE function on the interface.";
          reference
            "IEEE 802.3, 30.15.1.1.2 aPoDLPSEAdminState";
        }
      }
    }
  }

  /*
  * Operational
  */
  /*poe port*/
  augment "/if:interfaces-state/if:interface/eth-if:ethernet" {
    description
      "Augments ethernet interface operational state model with nodes
       specific to DTE Power via MDI devices and ports";
    
    container poe-pse {
      description
        "Interface operational state for PoE port";

      leaf pse-pair-mode {
        type identityref {
          base pse:pse-pair-mode ;
        }
	   description 
	     "Pse may use multi-pair or single pair wire to power pd.";
      }
      
      container multi-pair {
        when "../pse-pair-mode = 'pse:multi-pair-mode' ";
        
        description "Multi-pair pse port state information.";

        leaf pairs-control-ability {
          type boolean;
          default true;
          description
            "Describes the capability of controlling the power pairs
             functionality to switch pins for sourcing power.";
          reference
            "IEEE Std 802.3, 30.9.1.1.3 aPSEPowerPairsControlAbility";
        }
        
        leaf detection-status {
          type pse-detection-state;
          description 
            "Describes the operational status of the port 
             PD detection.";
          reference
            "IEEE Std 802.3, 30.9.1.1.5 aPSEPowerDetectionStatus";
        }
        
        leaf classifications {  
          when "../detection-status = 'deliveringPower'" {
            description
              "This node only apply when the detection status is 
               delivering power.";
          }
          type power-class;
		   description "power class of the port";
          reference
            "IEEE Std 802.3, 30.9.1.1.6 aPSEPowerClassfication";
        }
        
        container poe-statistics {
          description "statistics information of the pse port";
       
          leaf power-denied {
            type uint32;
            description 
              "This counter is incremented when the PSE state diagram
               enters the state POWER_DENIED";
            reference
              "IEEE Std 802.3, 30.9.1.1.8 aPSEPowerDeniedCounter";
          }
           
          leaf invalid-signature {
            type uint32;
            description
              "This counter is incremented when the PSE state diagram
                  enters the state SIGNATURE_INVALID.";
            reference
              "IEEE Std 802.3, 30.9.1.1.7 aPSEInvalidSignatureCounter";
          }
           
          leaf mps-absent {
            type uint32;
            description
               "This counter is incremented when the PSE state diagram
               transitions directly from the state POWER_ON to the
               state IDLE due to tmpdo_timer_done being asserted";
            reference
              "IEEE Std 802.3, 30.9.1.1.11 aPSEMPSAbsentCounter";
          }
           
          leaf overload {
            type uint32;
            description
               "This counter is incremented when the PSE state diagram
               enters the state ERROR_DELAY_OVER.";
            reference
              "IEEE Std 802.3, 30.9.1.1.9 aPSEOverLoadCounter";
          }
          
          leaf short {
            type uint32;
            description
               "This counter is incremented when the PSE state diagram
               enters the state ERROR_DELAY_SHORT.";
            reference
              "IEEE Std 802.3, 30.9.1.1.10 aPSEShortCounter";
          }
		  
		  leaf cumulative-energy {
			type uint32;
			units 'millijoule';
			description 
				"The cumulative energy supplied by the PSE as measured at the MDI in millijoules";
			
          reference
				"IEEE Std 802.3, 30.9.1.1.14 aPSECumulativeEnergy";
        }		  
    
        }
         
        leaf actual-power {
          type decimal64 {
            fraction-digits 4 ;
          }
          
          units 'watt';
          description 
			"the actual power drawn by a PD over the port";
          reference 
			"IEEE Std 802.3, 30.9.1.1.12 aPSEActualPower.";
        }
        
        leaf power-accuracy {
          type uint32;
          units 'milliwatt';
          description 
            "An integer value indicating the accuracy 
             associated with aPSEActualPower in +/- milliwatts.";
          reference
             "IEEE Std 802.3, 30.9.1.1.13 aPSEPowerAccuracy";
        }
      }
      
      container single-pair {
        when "../pse-pair-mode = 'pse:podl-mode' ";
        
        description "Single-pair pse port state information.";
        
		
        leaf detection-status {
          type podl-detection-state;
          description 
            "Indicates the current status of the PoDL PSE.";
          reference
            "IEEE Std 802.3, 30.15.1.1.3 aPoDLPSEPowerDetectionStatus";
        }

		leaf pse-type {
          type enumeration {
			enum unknown {
				description "unknown pse type";
			}
            enum typeA {
				description "typeA";
			}
            enum typeB {
				description "typeB";
			}
            enum typeC {
				description "typeC";
			}
            enum typeD {
				description "typeD";
			}
          }
		   description "PSE type specified in 104.4.1.";
        }
		
        leaf detected-pd-type {		  
		when "../detection-status = 'deliveringPower'" {
            description
              "This node only apply when the detection status is 
               delivering power.";
          }

          type enumeration {
			enum unknown {
				description "unknown";
			}
            enum typeA {
				description "typeA";
			}
            enum typeB {
				description "typeB";
			}
            enum typeC {
				description "typeC";
			}
            enum typeD {
				description "typeD";
			}
          }
		 description 
			"indicates the Type of the detected PoDL PD as specified in 104.5.1.";
		  
		  reference
			"IEEE Std 802.3, 30.15.1.1.5 aPoDLPSEDetectedPDType";
        }
        
        leaf pd-power-class {
          
          when "../detection-status = 'deliveringPower'" {
            description
              "This node only apply when the detection status is 
               delivering power.";
          }
  
          type power-class;
		  description 
			"power class of the port";
          reference
            "IEEE Std 802.3, 30.9.1.1.6 aPSEPowerClassfication";
 
        }
        
        container poe-statistics {
          description "statistics information of the PoDL PSE";
       
          leaf power-denied {
            type uint32;
            description 
              "This counter is incremented when the PoDL PSE state diagram variable power_available  
			  transitions from true to false (see 104.4.3.3)";
            reference
              "IEEE Std 802.3, 30.15.1.1.9 aPoDLPSEPowerDeniedCounter";
          }
           
          leaf invalid-signature {
            type uint32;
            description
              "This counter is incremented when the PSE state diagram
                  enters the state SIGNATURE_INVALID.";
            reference
              "IEEE Std 802.3, 30.15.1.1.7 aPoDLPSEInvalidSignatureCounter";
          }
          
          leaf invalid-class {
            type uint32;
            description 
				"This counter is incremented when the PoDL PSE state diagram variable tclass_timer_done transitions from false to true or when the valid_class variable transitions from true to false (see 104.4.3.3)";
			
			reference
				"IEEE Std 802.3, 30.15.1.1.8 aPoDLPSEInvalidClassCounter";
          }
           
          leaf overload {
            type uint32;
            description
               "This counter is incremented when the PSE state diagram variable overload_held transitions from false to true (see 104.4.3.3)";
            reference
              "IEEE Std 802.3, 30.15.1.1.10 aPoDLPSEOverLoadCounter";
          }
          
          leaf fvs-absence {
            type uint32;
            description 
				"Maintain Full Voltage Signature absent counter.
				This counter is incremented when the PoDL PSE state diagram variable mfvs_timeout  transitions from false to true (see 104.4.3.3)";
			
			reference
				"IEEE Std 802.3, 30.15.1.1.11 aPoDLPSEMaintainFullVoltageSignatureAbsentCounter";
          }

          leaf cumulative-energy {
            type uint32;
            description 
				"A count of the cumulative energy supplied by the PoDL PSE, measured at the MDI, and  expressed in units of millijoules";
            reference
				"IEEE Std 802.3, 30.15.1.1.14 aPoDLPSECumulativeEnergy";
          }      
    
        }
         
        leaf actual-power {
          type decimal64 {
            fraction-digits 4 ;
          }
          
          units 'watt';
          description 
			"An integer value indicating present (actual) power being supplied by the PoDL PSE as measured at the MDI in milliwatts";
          reference 
			"IEEE Std 802.3, 30.15.1.1.12 aPoDLPSEActualPower.";
        }

        leaf power-accuracy {
          type uint32;
          units 'milliwatt';
          description 
            "A signed integer value indicating the accuracy associated with aPoDLPSEActualPower in  milliwatts..";
          reference
             "IEEE Std 802.3, 30.15.1.1.13 aPoDLPSEPowerAccuracy";
        }

        leaf cumulative-energy {
          type uint32;
          units 'millijoule';
          description "";
        }        
      }
    }
  }
}
	 <CODE ENDS>
	

Author's Address

Yan Zhuang Huawei 101 Software Avenue, Yuhua District Nanjing, Jiangsu 210012 China EMail: zhuangyan.zhuang@huawei.com