Adding OpenConfig YANG models.

Change-Id: I0a2fdd5826e80933cf4b9ae939ff3051acec02aa
diff --git a/models/openconfig/src/main/yang/rib/openconfig-rib-bgp-attributes.yang b/models/openconfig/src/main/yang/rib/openconfig-rib-bgp-attributes.yang
new file mode 100644
index 0000000..75eb155
--- /dev/null
+++ b/models/openconfig/src/main/yang/rib/openconfig-rib-bgp-attributes.yang
@@ -0,0 +1,430 @@
+submodule openconfig-rib-bgp-attributes {
+
+  belongs-to openconfig-rib-bgp {
+    prefix "oc-rib-bgp";
+  }
+
+
+  // import some basic types
+  import ietf-inet-types { prefix inet; }
+  import openconfig-bgp-types { prefix oc-bgpt; }
+  import openconfig-extensions { prefix oc-ext; }
+
+  // meta
+  organization "OpenConfig working group";
+
+  contact
+    "OpenConfig working group
+    www.openconfig.net";
+
+  description
+    "This submodule contains common data definitions for BGP
+    attributes for use in BGP RIB tables.";
+
+
+  oc-ext:openconfig-version "0.3.0";
+
+  revision "2016-10-17" {
+    description
+      "OpenConfig BGP RIB refactor";
+    reference "0.3.0";
+  }
+
+
+  grouping bgp-as-path-attr-state {
+    description
+      "Data for representing BGP AS-PATH attribute";
+
+    leaf type {
+      type oc-bgpt:as-path-segment-type;
+      description
+        "The type of AS-PATH segment";
+    }
+
+    leaf-list member {
+      type inet:as-number;
+      description
+        "List of the AS numbers in the AS-PATH segment";
+    }
+  }
+
+  grouping bgp-as-path-attr-top {
+    description
+      "Top-level grouping for AS-PATH attribute data";
+
+    container as-path {
+      description
+        "Enclosing container for the list of AS path segments.
+
+        In the Adj-RIB-In or Adj-RIB-Out, this list should show
+        the received or sent AS_PATH, respectively.  For
+        example, if the local router is not 4-byte capable, this
+        value should consist of 2-octet ASNs or the AS_TRANS
+        (AS 23456) values received or sent in route updates.
+
+        In the Loc-RIB, this list should reflect the effective
+        AS path for the route, e.g., a 4-octet value if the
+        local router is 4-octet capable.";
+      reference
+        "RFC 4271 - A Border Gateway Protocol 4 (BGP-4)
+        RFC 6793 - BGP Support for Four-octet AS Number Space
+        RFC 5065 - Autonomous System Confederations for BGP";
+
+      list segment {
+        description
+          "Unkeyed list of AS PATH segments";
+
+        container state {
+          config false;
+          description
+            "Opstate data for AS-PATH segments";
+
+          uses bgp-as-path-attr-state;
+        }
+      }
+    }
+  }
+
+  grouping bgp-as4-path-attr-top {
+    description
+      "Top-level grouping for AS4-PATH attribute data";
+
+    container as4-path {
+      description
+        "This is the path encoded with 4-octet
+        AS numbers in the optional transitive AS4_PATH attribute.
+        This value is populated with the received or sent attribute
+        in Adj-RIB-In or Adj-RIB-Out, respectively.  It should not
+        be populated in Loc-RIB since the Loc-RIB is expected to
+        store the effective AS-Path in the as-path leaf regardless
+        of being 4-octet or 2-octet.";
+      reference
+          "RFC 6793 - BGP Support for Four-octet AS Number Space";
+
+      list segment {
+        description
+          "Unkeyed list of AS PATH segments";
+
+        container state {
+          config false;
+          description
+            "Opstate data for AS-PATH segments";
+
+          uses bgp-as-path-attr-state;
+        }
+      }
+    }
+  }
+
+  grouping bgp-community-attr-state {
+    description
+      "Common definition of BGP community attributes";
+
+    leaf-list community {
+      type union {
+        type oc-bgpt:bgp-well-known-community-type;
+        type oc-bgpt:bgp-std-community-type;
+      }
+      description
+        "List of standard or well-known BGP community
+        attributes.";
+    }
+  }
+
+  grouping bgp-extended-community-attr-state {
+    description
+      "Common definition of BGP extended community attribute";
+
+    leaf-list ext-community {
+      type oc-bgpt:bgp-ext-community-recv-type;
+      description
+        "List of BGP extended community attributes.  The received
+        extended community may be an explicitly modeled
+        type or unknown, represented by an 8-octet value
+        formatted according to RFC 4360.";
+      reference
+        "RFC 4360 - BGP Extended Communities Attribute";
+    }
+
+  }
+
+  grouping bgp-aggregator-attr-state {
+    description
+      "Operational state data for the BGP aggregator
+      attribute";
+
+    leaf as {
+      type inet:as-number;
+      description
+          "AS number of the autnonomous system that performed the
+          aggregation.";
+    }
+
+    leaf as4 {
+      type inet:as-number;
+      description
+        "AS number of the autnonomous system that performed the
+        aggregation (4-octet representation).  This value is
+        populated if an upstream router is not 4-octet capable.
+        Its semantics are similar to the AS4_PATH optional
+        transitive attribute";
+      reference
+        "RFC 6793 - BGP Support for Four-octet AS Number Space";
+    }
+
+    leaf address {
+      type inet:ipv4-address;
+      description
+        "IP address of the router that performed the
+        aggregation.";
+    }
+  }
+
+
+  grouping bgp-aggregator-attr-top {
+    description
+      "Common definition of the BGP aggregator attribute";
+
+    container aggregator {
+      description
+        "BGP attribute indicating the prefix has been aggregated by
+        the specified AS and router.";
+
+      container state {
+        config false;
+        description
+          "Operational state data for BGP aggregator attribute";
+
+        uses bgp-aggregator-attr-state;
+      }
+    }
+  }
+
+  grouping bgp-shared-common-attr-state {
+    description
+      "Route attributes shared across route table entries,
+      common to both LOC-Rib and Adj-RIB";
+
+
+    leaf origin {
+      type oc-bgpt:bgp-origin-attr-type;
+      description
+        "BGP attribute defining the origin of the path information.";
+    }
+
+    leaf atomic-aggregate {
+      type boolean;
+      description
+        "BGP attribute indicating that the prefix is an atomic
+        aggregate, i.e., the peer selected a less specific
+        route without selecting a more specific route that is
+        included in it.";
+    }
+
+    leaf next-hop {
+      type inet:ip-address;
+      description
+        "BGP next hop attribute defining the IP address of the router
+        that should be used as the next hop to the destination";
+    }
+
+    leaf med {
+      type uint32;
+      description
+        "BGP multi-exit discriminator attribute used in BGP route
+        selection process";
+    }
+
+    leaf local-pref {
+      type uint32;
+      description
+        "BGP local preference attribute sent to internal peers to
+        indicate the degree of preference for externally learned
+        routes.  The route with the highest local preference value
+        is preferred.";
+    }
+
+    leaf originator-id {
+      type inet:ipv4-address;
+      description
+        "BGP attribute that provides the id as an IPv4 address
+        of the originator of the announcement.";
+      reference
+        "RFC 4456 - BGP Route Reflection: An Alternative to Full
+        Mesh Internal BGP (IBGP)";
+    }
+
+    leaf-list cluster-list {
+      type inet:ipv4-address;
+      description
+        "Represents the reflection path that the route has passed.";
+      reference
+        "RFC 4456 - BGP Route Reflection: An Alternative to Full
+        Mesh Internal BGP (IBGP)";
+    }
+
+    leaf aigp {
+      type uint64;
+      description
+        "BGP path attribute representing the accumulated IGP metric
+        for the path";
+      reference
+        "RFC 7311 - The Accumulated IGP Metric Attribute for BGP";
+    }
+  }
+
+  grouping bgp-unknown-attr-flags-state {
+    description
+      "Operational state data for path attribute flags";
+
+    leaf optional {
+      type boolean;
+      description
+        "Defines whether the attribute is optional (if
+         set to true) or well-known (if set to false).
+         Set in the high-order bit of the BGP attribute
+         flags octet.";
+      reference
+        "RFC 4271 - A Border Gateway Protocol 4 (BGP-4)";
+    }
+
+    leaf transitive {
+      type boolean;
+      description
+        "Defines whether an optional attribute is transitive
+        (if set to true) or non-transitive (if set to false).  For
+        well-known attributes, the transitive flag MUST be set to
+        true.  Set in the second high-order bit of the BGP attribute
+        flags octet.";
+      reference
+        "RFC 4271 - A Border Gateway Protocol 4 (BGP-4)";
+    }
+
+    leaf partial {
+      type boolean;
+      description
+        "Defines whether the information contained in the optional
+        transitive attribute is partial (if set to true) or complete
+        (if set to false).  For well-known attributes and for
+        optional non-transitive attributes, the partial flag
+        must be set to false.  Set in the third high-order bit of
+        the BGP attribute flags octet.";
+      reference
+        "RFC 4271 - A Border Gateway Protocol 4 (BGP-4)";
+    }
+
+    leaf extended {
+      type boolean;
+      description
+        "Defines whether the attribute length is one octet
+        (if set to false) or two octets (if set to true).  Set in
+        the fourth high-order bit of the BGP attribute flags
+        octet.";
+      reference
+        "RFC 4271 - A Border Gateway Protocol 4 (BGP-4)";
+    }
+  }
+
+  grouping bgp-unknown-attr-state {
+    description
+      "Operational state data for path attributes not shared
+      across route entries, common to LOC-RIB and Adj-RIB";
+
+    leaf attr-type {
+      type uint8;
+      description
+        "1-octet value encoding the attribute type code";
+      reference
+        "RFC 4271 - A Border Gateway Protocol 4 (BGP-4)";
+    }
+
+    leaf attr-len {
+      type uint16;
+      description
+        "One or two octet attribute length field indicating the
+        length of the attribute data in octets.  If the Extended
+        Length attribute flag is set, the length field is 2 octets,
+        otherwise it is 1 octet";
+      reference
+        "RFC 4271 - A Border Gateway Protocol 4 (BGP-4)";
+    }
+
+    leaf attr-value {
+      type binary {
+        length 1..65535;
+      }
+      description
+        "Raw attribute value, not including the attribute
+        flags, type, or length.  The maximum length
+        of the attribute value data is 2^16-1 per the max value
+        of the attr-len field (2 octets).";
+      reference
+        "RFC 4271 - A Border Gateway Protocol 4 (BGP-4)";
+    }
+  }
+
+  grouping bgp-unknown-attr-top {
+    description
+      "Unknown path attributes that are not expected to be shared
+      across route entries, common to LOC-RIB and Adj-RIB";
+
+    container unknown-attributes {
+      description
+        "Unknown path attributes that were received in the UPDATE
+        message which contained the prefix.";
+
+      list unknown-attribute {
+        key "attr-type";
+        description
+          "This list contains received attributes that are unrecognized
+          or unsupported by the local router.  The list may be empty.";
+
+        leaf attr-type {
+          type leafref {
+            path "../state/attr-type";
+          }
+          description
+            "Reference to the list key";
+        }
+
+        container state {
+          description
+            "Operational state for unknown route attributes";
+
+          uses bgp-unknown-attr-flags-state;
+          uses bgp-unknown-attr-state;
+        }
+      }
+    }
+  }
+
+  grouping bgp-loc-rib-attr-state {
+    description
+      "Path attributes that are not expected to be shared across
+      route entries, specific to LOC-RIB";
+
+  }
+
+  grouping bgp-adj-rib-attr-state {
+    description
+      "Path attributes that are not expected to be shared across
+      route entries, specific to Adj-RIB";
+
+    leaf path-id {
+      type uint32;
+      description
+        "When the BGP speaker supports advertisement of multiple
+        paths for a prefix, the path identifier is used to
+        uniquely identify a route based on the combination of the
+        prefix and path id.  In the Adj-RIB-In, the path-id value is
+        the value received in the update message.   In the Loc-RIB,
+        if used, it should represent a locally generated path-id
+        value for the corresponding route.  In Adj-RIB-Out, it
+        should be the value sent to a neighbor when add-paths is
+        used, i.e., the capability has been negotiated.";
+      reference
+        "draft-ietf-idr-add-paths - Advertisement of Multiple Paths
+        in BGP";
+    }
+  }
+}