Adding OpenConfig YANG models.

Change-Id: I0a2fdd5826e80933cf4b9ae939ff3051acec02aa
diff --git a/models/openconfig/src/main/yang/lacp/openconfig-lacp.yang b/models/openconfig/src/main/yang/lacp/openconfig-lacp.yang
new file mode 100644
index 0000000..e49dcb6
--- /dev/null
+++ b/models/openconfig/src/main/yang/lacp/openconfig-lacp.yang
@@ -0,0 +1,461 @@
+module openconfig-lacp {
+
+  yang-version "1";
+
+  // namespace
+  namespace "http://openconfig.net/yang/lacp";
+
+  prefix "oc-lacp";
+
+  // import some basic types
+  import openconfig-interfaces { prefix oc-if; }
+  import openconfig-yang-types { prefix oc-yang; }
+  import openconfig-extensions { prefix oc-ext; }
+
+
+
+  // meta
+  organization "OpenConfig working group";
+
+  contact
+    "OpenConfig working group
+    www.openconfig.net";
+
+  description
+    "This module describes configuration and operational state
+    data for Link Aggregation Control Protocol (LACP) for
+    managing aggregate interfaces.   It works in conjunction with
+    the OpenConfig interfaces and aggregate interfaces models.";
+
+  oc-ext:openconfig-version "1.1.0";
+
+  revision "2017-05-05" {
+    description
+      "Add member local and remote port num";
+    reference "1.1.0";
+  }
+
+  revision "2016-05-26" {
+    description
+      "OpenConfig public release";
+    reference "1.0.2";
+  }
+
+
+  // typedef statements
+
+  typedef lacp-activity-type {
+    type enumeration {
+      enum ACTIVE {
+        description
+          "Interface is an active member, i.e., will detect and
+          maintain aggregates";
+      }
+      enum PASSIVE {
+        description
+          "Interface is a passive member, i.e., it participates
+          with an active partner";
+      }
+    }
+    description
+      "Describes the LACP membership type, active or passive, of the
+      interface in the aggregate";
+    reference "IEEE 802.1AX-2008";
+  }
+
+  typedef lacp-timeout-type {
+    type enumeration {
+      enum LONG {
+        description
+          "Participant wishes to use long timeouts to detect
+          status of the aggregate, i.e., will expect less frequent
+          transmissions. Long timeout is 90 seconds.";
+      }
+      enum SHORT {
+        description
+          "Participant wishes to use short timeouts, i.e., expects
+          frequent transmissions to aggressively detect status
+          changes. Short timeout is 3 seconds.";
+      }
+    }
+    description
+      "Type of timeout used, short or long, by LACP participants";
+    reference "IEEE 802.1AX-2008";
+  }
+
+  typedef lacp-synchronization-type {
+    type enumeration {
+      enum IN_SYNC {
+        description
+          "Participant is in sync with the system id and key
+          transmitted";
+      }
+      enum OUT_SYNC {
+        description
+          "Participant is not in sync with the system id and key
+          transmitted";
+      }
+    }
+    description
+      "Indicates LACP synchronization state of participant";
+    reference "IEEE 802.1AX-2008";
+  }
+
+  typedef lacp-period-type {
+    type enumeration {
+      enum FAST {
+        description "Send LACP packets every second";
+      }
+      enum SLOW {
+        description "Send LACP packets every 30 seconds";
+      }
+    }
+    description
+      "Defines the period options for the time between sending
+      LACP messages";
+    reference "IEEE 802.3ad";
+  }
+
+  // grouping statements
+
+
+  grouping aggregation-lacp-members-config {
+    description
+      "Configuration data for lacp member interfaces";
+
+    //currently a placeholder -- the list of member interfaces
+    //and their status is considered opstate only
+  }
+
+  grouping aggregation-lacp-members-state {
+    description
+      "Operational status data for the member interfaces";
+
+    leaf interface {
+      type oc-if:base-interface-ref;
+      description
+        "Reference to interface member of the LACP aggregate";
+    }
+
+    leaf activity {
+      type lacp-activity-type;
+      description "Indicates participant is active or passive";
+    }
+
+    leaf timeout {
+      type lacp-timeout-type;
+      description
+        "The timeout type (short or long) used by the
+        participant";
+    }
+
+    leaf synchronization {
+      type lacp-synchronization-type;
+      description
+        "Indicates whether the participant is in-sync or
+        out-of-sync";
+    }
+
+    leaf aggregatable {
+      type boolean;
+      description
+        "A true value indicates that the participant will allow
+        the link to be used as part of the aggregate. A false
+        value indicates the link should be used as an individual
+        link";
+    }
+
+    leaf collecting {
+      type boolean;
+      description
+        "If true, the participant is collecting incoming frames
+        on the link, otherwise false";
+    }
+
+    leaf distributing {
+      type boolean;
+      description
+        "When true, the participant is distributing outgoing
+        frames; when false, distribution is disabled";
+    }
+
+    leaf system-id {
+      type oc-yang:mac-address;
+      description
+        "MAC address that defines the local system ID for the
+        aggregate interface";
+    }
+
+    leaf oper-key {
+      type uint16;
+      description
+        "Current operational value of the key for the aggregate
+        interface";
+    }
+
+    leaf partner-id {
+      type oc-yang:mac-address;
+      description
+        "MAC address representing the protocol partner's interface
+        system ID";
+    }
+
+    leaf partner-key {
+      type uint16;
+      description
+        "Operational value of the protocol partner's key";
+    }
+
+    leaf port-num {
+      type uint16;
+      description
+        "Port number of the local (actor) aggregation member";
+    }
+
+    leaf partner-port-num {
+      type uint16;
+      description
+        "Port number of the partner (remote) port for this member
+        port";
+    }
+  }
+
+grouping aggregation-lacp-members-statistics {
+    description
+      "LACP packet statistics for the member interfaces";
+
+    container counters {
+      description
+        "LACP protocol counters";
+
+      leaf lacp-in-pkts {
+        type oc-yang:counter64;
+        description
+          "Number of LACPDUs received";
+      }
+
+      leaf lacp-out-pkts {
+        type oc-yang:counter64;
+        description
+          "Number of LACPDUs transmitted";
+      }
+
+      leaf lacp-rx-errors {
+        type oc-yang:counter64;
+        description
+          "Number of LACPDU receive packet errors";
+      }
+
+      leaf lacp-tx-errors {
+        type oc-yang:counter64;
+        description
+          "Number of LACPDU transmit packet errors";
+      }
+
+      leaf lacp-unknown-errors {
+        type oc-yang:counter64;
+        description
+          "Number of LACPDU unknown packet errors";
+      }
+
+      leaf lacp-errors {
+        type oc-yang:counter64;
+        description
+          "Number of LACPDU illegal packet errors";
+      }
+    }
+  }
+
+  grouping aggregation-lacp-members-top {
+    description
+      "Top-level grouping for aggregate members list";
+
+    container members {
+      config false;
+      description
+        "Enclosing container for the list of members interfaces of
+        the aggregate. This list is considered operational state
+        only so is labeled config false and has no config container";
+
+      list member {
+        key "interface";
+        description
+          "List of member interfaces and their associated status for
+          a LACP-controlled aggregate interface.  Member list is not
+          configurable here -- each interface indicates items
+          its participation in the LAG.";
+
+        leaf interface {
+          type leafref {
+            path "../state/interface";
+          }
+          description
+            "Reference to aggregate member interface";
+        }
+
+
+        container state {
+
+          config false;
+
+          description
+            "Operational state data for aggregate members";
+
+          uses aggregation-lacp-members-state;
+          uses aggregation-lacp-members-statistics;
+        }
+      }
+    }
+  }
+
+  grouping lacp-interfaces-config {
+    description
+      "Configuration data for each LACP-enabled interface";
+
+    leaf name {
+      type oc-if:base-interface-ref;
+      description
+        "Reference to the interface on which LACP should be
+        configured.   The type of the target interface must be
+        ieee8023adLag";
+    }
+
+    leaf interval {
+      type lacp-period-type;
+      default SLOW;
+      description
+        "Set the period between LACP messages -- uses
+        the lacp-period-type enumeration.";
+    }
+
+    leaf lacp-mode {
+      type lacp-activity-type;
+      default ACTIVE;
+      description
+        "ACTIVE is to initiate the transmission of LACP packets.
+         PASSIVE is to wait for peer to initiate the transmission of
+         LACP packets.";
+        //TODO:some implementations configure the LACP mode on each
+        //member interface rather than on the LAG interface.  There
+        //may be use cases for this identified at a later time.
+    }
+
+    leaf system-id-mac {
+      type oc-yang:mac-address;
+      description
+        "The MAC address portion of the node's System ID. This is
+        combined with the system priority to construct the 8-octet
+        system-id";
+    }
+
+    uses aggregation-lacp-global-config;
+  }
+
+  grouping lacp-interfaces-state {
+    description
+      "Operational state data for each LACP-enabled interface";
+  }
+
+  grouping lacp-interfaces-top {
+    description
+      "Top-level grouping for LACP-enabled interfaces";
+
+    container interfaces {
+      description
+        "Enclosing container for the list of LACP-enabled
+        interfaces";
+
+      list interface {
+        key "name";
+        description
+          "List of aggregate interfaces managed by LACP";
+
+        leaf name {
+          type leafref {
+            path "../config/name";
+          }
+          description
+            "Reference to the list key";
+        }
+
+        container config {
+          description
+            "Configuration data for each LACP aggregate interface";
+
+          uses lacp-interfaces-config;
+        }
+
+        container state {
+
+          config false;
+
+          description
+            "Operational state data for each LACP aggregate
+            interface";
+
+          uses lacp-interfaces-config;
+          uses lacp-interfaces-state;
+        }
+
+        uses aggregation-lacp-members-top;
+      }
+    }
+  }
+
+  grouping aggregation-lacp-global-config {
+    description
+      "Configuration data for LACP aggregate interfaces";
+
+
+    leaf system-priority {
+      type uint16;
+      description
+        "Sytem priority used by the node on this LAG interface.
+        Lower value is higher priority for determining which node
+        is the controlling system.";
+    }
+  }
+
+  grouping aggregation-lacp-global-state {
+    description
+      "Operational data for LACP aggregate interfaces";
+
+  }
+
+  grouping aggregation-lacp-top {
+    description
+      "Top level configuration and state variable containers for
+      LACP data";
+
+    container lacp {
+      description
+        "Configuration and operational state data for LACP protocol
+        operation on the aggregate interface";
+
+      container config {
+        description
+          "Configuration data for LACP";
+
+        uses aggregation-lacp-global-config;
+      }
+
+      container state {
+
+        config false;
+        description
+          "Operational state data for LACP";
+
+        uses aggregation-lacp-global-config;
+        uses aggregation-lacp-global-state;
+      }
+      uses lacp-interfaces-top;
+    }
+  }
+
+  // data definition statements
+  uses aggregation-lacp-top;
+
+  // augment statements
+
+
+}
\ No newline at end of file