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";
+    }
+  }
+}
diff --git a/models/openconfig/src/main/yang/rib/openconfig-rib-bgp-ext.yang b/models/openconfig/src/main/yang/rib/openconfig-rib-bgp-ext.yang
new file mode 100644
index 0000000..3c7cf35
--- /dev/null
+++ b/models/openconfig/src/main/yang/rib/openconfig-rib-bgp-ext.yang
@@ -0,0 +1,166 @@
+module openconfig-rib-bgp-ext {
+
+  yang-version "1";
+
+  // namespace
+  namespace "http://openconfig.net/yang/rib/bgp-ext";
+
+  prefix "oc-bgprib-ext";
+
+  import openconfig-rib-bgp { prefix oc-bgprib; }
+  import openconfig-extensions { prefix oc-ext; }
+  import openconfig-rib-bgp-types { prefix oc-bgpribt; }
+
+  organization "OpenConfig working group";
+
+  contact
+    "OpenConfig working group
+    www.openconfig.net";
+
+  description
+    "Defines additional data nodes for the OpenConfig BGP RIB model.
+    These items reflect extensions that are desirable features but
+    are not currently supported in a majority of BGP
+    implementations.";
+
+  oc-ext:openconfig-version "0.3.0";
+
+  revision "2016-10-17" {
+    description
+      "OpenConfig BGP RIB refactor";
+    reference "0.3.0";
+  }
+
+  revision "2016-04-11" {
+    description
+      "OpenConfig public release";
+    reference "0.2.0";
+  }
+
+
+  grouping rib-ext-route-annotations {
+    description
+      "Extended annotations for routes in the routing tables";
+
+    leaf reject-reason {
+      type union {
+        type identityref {
+          base oc-bgpribt:BGP_NOT_SELECTED_BESTPATH;
+        }
+        type identityref {
+          base oc-bgpribt:BGP_NOT_SELECTED_POLICY;
+        }
+      }
+      description
+        "Indicates the reason the route is not used, either due to
+        policy filtering or bestpath selection";
+    }
+  }
+
+  augment "/oc-bgprib:bgp-rib/oc-bgprib:afi-safis/" +
+    "oc-bgprib:afi-safi/oc-bgprib:ipv4-unicast/oc-bgprib:loc-rib/" +
+    "oc-bgprib:routes/oc-bgprib:route/oc-bgprib:state" {
+      description
+        "Add extended annotations to the Loc-RIB for IPv4";
+
+      uses rib-ext-route-annotations;
+  }
+
+  augment "/oc-bgprib:bgp-rib/oc-bgprib:afi-safis/" +
+    "oc-bgprib:afi-safi/oc-bgprib:ipv6-unicast/oc-bgprib:loc-rib/" +
+    "oc-bgprib:routes/oc-bgprib:route/oc-bgprib:state" {
+      description
+        "Add extended annotations to the Loc-RIB for IPv6";
+
+      uses rib-ext-route-annotations;
+  }
+
+  augment "/oc-bgprib:bgp-rib/oc-bgprib:afi-safis/" +
+    "oc-bgprib:afi-safi/oc-bgprib:ipv4-unicast/" +
+    "oc-bgprib:neighbors/oc-bgprib:neighbor/" +
+    "oc-bgprib:adj-rib-in-pre/oc-bgprib:routes/oc-bgprib:route" +
+    "/oc-bgprib:state" {
+      description
+        "Add extended annotations to Adj-RIB for IPv4";
+
+      uses rib-ext-route-annotations;
+  }
+
+  augment "/oc-bgprib:bgp-rib/oc-bgprib:afi-safis/" +
+    "oc-bgprib:afi-safi/oc-bgprib:ipv4-unicast/" +
+    "oc-bgprib:neighbors/oc-bgprib:neighbor/" +
+    "oc-bgprib:adj-rib-in-post/oc-bgprib:routes/oc-bgprib:route" +
+    "/oc-bgprib:state"{
+      description
+        "Add extended annotations to Adj-RIB for IPv4";
+
+      uses rib-ext-route-annotations;
+  }
+
+  augment "/oc-bgprib:bgp-rib/oc-bgprib:afi-safis/" +
+    "oc-bgprib:afi-safi/oc-bgprib:ipv4-unicast/" +
+    "oc-bgprib:neighbors/oc-bgprib:neighbor/" +
+    "oc-bgprib:adj-rib-out-pre/oc-bgprib:routes/oc-bgprib:route" +
+    "/oc-bgprib:state"{
+      description
+        "Add extended annotations to Adj-RIB for IPv4";
+
+      uses rib-ext-route-annotations;
+  }
+
+  augment "/oc-bgprib:bgp-rib/oc-bgprib:afi-safis/" +
+    "oc-bgprib:afi-safi/oc-bgprib:ipv4-unicast/" +
+    "oc-bgprib:neighbors/oc-bgprib:neighbor/" +
+    "oc-bgprib:adj-rib-out-post/oc-bgprib:routes/oc-bgprib:route" +
+    "/oc-bgprib:state"{
+      description
+        "Add extended annotations to Adj-RIB for IPv4";
+
+      uses rib-ext-route-annotations;
+  }
+
+  augment "/oc-bgprib:bgp-rib/oc-bgprib:afi-safis/" +
+    "oc-bgprib:afi-safi/oc-bgprib:ipv6-unicast/" +
+    "oc-bgprib:neighbors/oc-bgprib:neighbor/" +
+    "oc-bgprib:adj-rib-in-pre/oc-bgprib:routes/oc-bgprib:route" +
+    "/oc-bgprib:state"{
+      description
+        "Add extended annotations to Adj-RIB for IPv6";
+
+      uses rib-ext-route-annotations;
+  }
+
+  augment "/oc-bgprib:bgp-rib/oc-bgprib:afi-safis/" +
+    "oc-bgprib:afi-safi/oc-bgprib:ipv6-unicast/" +
+    "oc-bgprib:neighbors/oc-bgprib:neighbor/" +
+    "oc-bgprib:adj-rib-in-post/oc-bgprib:routes/oc-bgprib:route" +
+    "/oc-bgprib:state"{
+      description
+        "Add extended annotations to Adj-RIB for IPv6";
+
+      uses rib-ext-route-annotations;
+  }
+
+  augment "/oc-bgprib:bgp-rib/oc-bgprib:afi-safis/" +
+    "oc-bgprib:afi-safi/oc-bgprib:ipv6-unicast/" +
+    "oc-bgprib:neighbors/oc-bgprib:neighbor/" +
+    "oc-bgprib:adj-rib-out-pre/oc-bgprib:routes/oc-bgprib:route" +
+    "/oc-bgprib:state"{
+      description
+        "Add extended annotations to Adj-RIB for IPv6";
+
+      uses rib-ext-route-annotations;
+  }
+
+  augment "/oc-bgprib:bgp-rib/oc-bgprib:afi-safis/" +
+    "oc-bgprib:afi-safi/oc-bgprib:ipv6-unicast/" +
+    "oc-bgprib:neighbors/oc-bgprib:neighbor/" +
+    "oc-bgprib:adj-rib-out-post/oc-bgprib:routes/oc-bgprib:route" +
+    "/oc-bgprib:state"{
+      description
+        "Add extended annotations to Adj-RIB for IPv6";
+
+      uses rib-ext-route-annotations;
+  }
+
+}
\ No newline at end of file
diff --git a/models/openconfig/src/main/yang/rib/openconfig-rib-bgp-shared-attributes.yang b/models/openconfig/src/main/yang/rib/openconfig-rib-bgp-shared-attributes.yang
new file mode 100644
index 0000000..3a03b40
--- /dev/null
+++ b/models/openconfig/src/main/yang/rib/openconfig-rib-bgp-shared-attributes.yang
@@ -0,0 +1,170 @@
+submodule openconfig-rib-bgp-shared-attributes {
+
+  belongs-to openconfig-rib-bgp {
+    prefix "oc-rib-bgp";
+  }
+
+
+  // import some basic types
+  import openconfig-extensions { prefix oc-ext; }
+
+  include openconfig-rib-bgp-attributes;
+
+  // meta
+  organization "OpenConfig working group";
+
+  contact
+    "OpenConfig working group
+    www.openconfig.net";
+
+  description
+    "This submodule contains structural data definitions for
+    attribute sets shared across routes.";
+
+
+  oc-ext:openconfig-version "0.3.0";
+
+  revision "2016-10-17" {
+    description
+      "OpenConfig BGP RIB refactor";
+    reference "0.3.0";
+  }
+
+
+  grouping attribute-sets-top {
+    description
+      "Top level grouping for list of common attribute sets";
+
+    container attr-sets {
+      description
+        "Enclosing container for the list of path attribute sets";
+
+      list attr-set {
+        key "index";
+
+        description
+          "List of path attributes that may be in use by multiple
+          routes in the table";
+
+        leaf index {
+          type leafref {
+            path "../state/index";
+          }
+          description
+            "Reference to list key";
+        }
+
+        container state {
+          config false;
+          description
+            "Operational state for common path attributes";
+
+          leaf index {
+            type uint64;
+            description
+              "System generated index for each attribute set.  The
+              index is used to reference an attribute set from a
+              specific path.  Multiple paths may reference the same
+              attribute set.";
+          }
+
+          uses bgp-shared-common-attr-state;
+        }
+        uses bgp-aggregator-attr-top;
+        uses bgp-as-path-attr-top;
+        uses bgp-as4-path-attr-top;
+      }
+    }
+  }
+
+  grouping community-sets-top {
+    description
+      "Top level grouping for list of shared community attribute
+      sets";
+
+    container communities {
+      description
+        "Enclosing container for the list of community attribute
+        sets";
+
+      list community {
+        key "index";
+
+        description
+          "List of path attributes that may be in use by multiple
+          routes in the table";
+
+        leaf index {
+          type leafref {
+            path "../state/index";
+          }
+          description
+            "Reference to the list key";
+        }
+
+        container state {
+          config false;
+          description
+            "Operational state for shared BGP community attribute";
+
+          leaf index {
+            type uint64;
+            description
+              "System generated index for each attribute set.  The
+              index is used to reference an attribute set from a
+              specific path.  Multiple paths may reference the same
+              attribute set.";
+          }
+
+          uses bgp-community-attr-state;
+        }
+      }
+    }
+  }
+
+  grouping ext-community-sets-top {
+    description
+      "Top level grouping for list of extended community attribute
+      sets";
+
+    container ext-communities {
+      description
+        "Enclosing container for the list of extended community
+        attribute sets";
+
+      list ext-community {
+        key "index";
+
+        description
+          "List of path attributes that may be in use by multiple
+          routes in the table";
+
+        leaf index {
+          type leafref {
+            path "../state/index";
+          }
+          description
+            "Reference to the list key";
+        }
+
+        container state {
+          config false;
+          description
+            "Operational state for shared BGP extended community
+            attribute";
+
+          leaf index {
+            type uint64;
+            description
+              "System generated index for each attribute set.  The
+              index is used to reference an attribute set from a
+              specific path.  Multiple paths may reference the same
+              attribute set.";
+          }
+
+          uses bgp-extended-community-attr-state;
+        }
+      }
+    }
+  }
+}
diff --git a/models/openconfig/src/main/yang/rib/openconfig-rib-bgp-table-attributes.yang b/models/openconfig/src/main/yang/rib/openconfig-rib-bgp-table-attributes.yang
new file mode 100644
index 0000000..285f0a9
--- /dev/null
+++ b/models/openconfig/src/main/yang/rib/openconfig-rib-bgp-table-attributes.yang
@@ -0,0 +1,113 @@
+submodule openconfig-rib-bgp-table-attributes {
+
+  belongs-to openconfig-rib-bgp {
+    prefix "oc-rib-bgp";
+  }
+
+
+  // import some basic types
+  import openconfig-extensions { prefix oc-ext; }
+  import openconfig-types { prefix oc-types; }
+  import openconfig-rib-bgp-types { prefix oc-bgpribt; }
+
+  // meta
+  organization "OpenConfig working group";
+
+  contact
+    "OpenConfig working group
+    www.openconfig.net";
+
+  description
+    "This submodule contains common data definitions for data
+    related to a RIB entry, or RIB table.";
+
+
+  oc-ext:openconfig-version "0.3.0";
+
+  revision "2016-10-17" {
+    description
+      "OpenConfig BGP RIB refactor";
+    reference "0.3.0";
+  }
+
+
+
+  grouping bgp-common-route-annotations-state {
+    description
+      "Data definitions for flags and other information attached
+      to routes in both LOC-RIB and Adj-RIB";
+
+    leaf last-modified {
+      type oc-types:timeticks64;
+      description
+        "Timestamp when this path was last modified.
+
+        The value is the timestamp in seconds relative to
+        the Unix Epoch (Jan 1, 1970 00:00:00 UTC).";
+    }
+
+    leaf valid-route {
+      type boolean;
+      description
+        "Indicates that the route is considered valid by the
+        local router";
+    }
+
+    leaf invalid-reason {
+      type identityref {
+        base oc-bgpribt:INVALID_ROUTE_REASON;
+      }
+      description
+        "If the route is rejected as invalid, this indicates the
+        reason.";
+    }
+
+  }
+
+  grouping bgp-loc-rib-route-annotations-state {
+    description
+      "Data definitions for information attached to routes in the
+      LOC-RIB";
+
+    // placeholder for route metadata specific to the LOC-RIB
+
+  }
+
+  grouping bgp-adj-rib-in-post-route-annotations-state {
+    description
+      "Data definitions for information attached to routes in the
+      Adj-RIB-in post-policy table";
+
+    leaf best-path {
+      type boolean;
+      description
+        "Current path was selected as the best path.";
+    }
+  }
+
+  grouping bgp-common-table-attrs-state {
+    description
+      "Common attributes attached to all routing tables";
+
+    // placeholder for metadata associated with all tables
+  }
+
+  grouping bgp-common-table-attrs-top {
+    description
+      "Operational state data for common attributes attached to
+      all routing tables";
+    // no enclosing container as this data will fit under an
+    // existing LOC-RIB container
+
+    container state {
+      config false;
+      description
+        "Operational state data for data related to the entire
+        LOC-RIB";
+
+      uses bgp-common-table-attrs-state;
+    }
+  }
+
+
+}
\ No newline at end of file
diff --git a/models/openconfig/src/main/yang/rib/openconfig-rib-bgp-tables.yang b/models/openconfig/src/main/yang/rib/openconfig-rib-bgp-tables.yang
new file mode 100644
index 0000000..6ca14b4
--- /dev/null
+++ b/models/openconfig/src/main/yang/rib/openconfig-rib-bgp-tables.yang
@@ -0,0 +1,646 @@
+submodule openconfig-rib-bgp-tables {
+
+  belongs-to openconfig-rib-bgp {
+    prefix "oc-rib-bgp";
+  }
+
+
+  // import some basic types
+  import ietf-inet-types { prefix inet; }
+  import openconfig-extensions { prefix oc-ext; }
+  import openconfig-policy-types { prefix oc-pol-types; }
+
+  include openconfig-rib-bgp-attributes;
+  include openconfig-rib-bgp-shared-attributes;
+  include openconfig-rib-bgp-table-attributes;
+
+  // meta
+  organization "OpenConfig working group";
+
+  contact
+    "OpenConfig working group
+    www.openconfig.net";
+
+  description
+    "This submodule contains structural data definitions for
+    BGP routing tables.";
+
+
+  oc-ext:openconfig-version "0.3.0";
+
+  revision "2016-10-17" {
+    description
+      "OpenConfig BGP RIB refactor";
+    reference "0.3.0";
+  }
+
+
+  grouping bgp-adj-rib-common-attr-refs {
+    description
+      "Definitions of common references to attribute sets for
+      multiple AFI-SAFIs for Adj-RIB tables";
+
+    leaf attr-index {
+      type leafref {
+        path "../../../../../../../../../../attr-sets/attr-set/" +
+          "state/index";
+      }
+      description
+        "Reference to the common attribute group for the
+        route";
+    }
+
+    leaf community-index {
+      type leafref {
+        path "../../../../../../../../../../communities/community/" +
+          "state/index";
+      }
+      description
+        "Reference to the community attribute for the route";
+    }
+
+    leaf ext-community-index {
+      type leafref {
+        path "../../../../../../../../../../ext-communities/" +
+          "ext-community/state/index";
+      }
+      description
+        "Reference to the extended community attribute for the
+        route";
+    }
+  }
+
+  grouping bgp-loc-rib-common-attr-refs {
+    description
+      "Definitions of common references to attribute sets for
+      multiple AFI-SAFIs for LOC-RIB tables";
+
+    leaf attr-index {
+      type leafref {
+        path "../../../../../../../../attr-sets/attr-set/" +
+          "state/index";
+      }
+      description
+        "Reference to the common attribute group for the
+        route";
+    }
+
+    leaf community-index {
+      type leafref {
+        path "../../../../../../../../communities/community/" +
+          "state/index";
+      }
+      description
+        "Reference to the community attribute for the route";
+    }
+
+    leaf ext-community-index {
+      type leafref {
+        path "../../../../../../../../ext-communities/" +
+          "ext-community/state/index";
+      }
+      description
+        "Reference to the extended community attribute for the
+        route";
+    }
+  }
+
+  grouping bgp-loc-rib-common-keys {
+    description
+      "Common references used in keys for IPv4 and IPv6
+      LOC-RIB entries";
+
+    leaf origin {
+      type union {
+        type inet:ip-address-no-zone;
+        type identityref {
+          base oc-pol-types:INSTALL_PROTOCOL_TYPE;
+        }
+      }
+      description
+        "Indicates the origin of the route.  If the route is learned
+        from a neighbor, this value is the neighbor address.  If
+        the route was injected or redistributed from another
+        protocol, the origin indicates the source protocol for the
+        route.";
+    }
+
+    leaf path-id {
+      type uint32;
+      default 0;
+      description
+        "If the route is learned from a neighbor, the path-id
+        corresponds to the path-id for the route in the
+        corresponding adj-rib-in-post table.  If the route is
+        injected from another protocol, or the neighbor does not
+        support BGP add-paths, the path-id should be set
+        to zero, also the default value.";
+    }
+  }
+
+  grouping bgp-loc-rib-key-refs {
+    description
+      "Key references to support operational state structure for
+      the BGP LOC-RIB table";
+
+    leaf prefix {
+      type leafref {
+        path "../state/prefix";
+      }
+      description
+        "Reference to the prefix list key";
+    }
+
+    leaf origin {
+      type leafref {
+        path "../state/origin";
+      }
+      description
+        "Reference to the origin list key";
+    }
+
+    leaf path-id {
+      type leafref {
+        path "../state/path-id";
+      }
+      description
+        "Reference to the path-id list key";
+    }
+  }
+
+  grouping ipv4-loc-rib-top {
+    description
+      "Top-level grouping for IPv4 routing tables";
+
+    container loc-rib {
+      config false;
+      description
+        "Container for the IPv4 BGP LOC-RIB data";
+
+      uses bgp-common-table-attrs-top;
+
+      container routes {
+        description
+          "Enclosing container for list of routes in the routing
+          table.";
+
+        list route {
+          key "prefix origin path-id";
+
+          description
+            "List of routes in the table, keyed by the route
+            prefix, the route origin, and path-id.  The route
+            origin can be either the neighbor address from which
+            the route was learned, or the source protocol that
+            injected the route.  The path-id distinguishes routes
+            for the same prefix received from a neighbor (e.g.,
+            if add-paths is eanbled).";
+
+          uses bgp-loc-rib-key-refs;
+
+          container state {
+            description
+              "Operational state data for route entries in the
+              BGP LOC-RIB";
+
+            leaf prefix {
+              type inet:ipv4-prefix;
+              description
+                "The IPv4 prefix corresponding to the route";
+            }
+
+            uses bgp-loc-rib-common-keys;
+
+            uses bgp-loc-rib-common-attr-refs;
+
+            uses bgp-loc-rib-attr-state;
+
+            uses bgp-common-route-annotations-state;
+            uses bgp-loc-rib-route-annotations-state;
+
+           }
+
+           uses bgp-unknown-attr-top;
+
+        }
+      }
+    }
+  }
+
+
+  grouping ipv6-loc-rib-top {
+    description
+      "Top-level grouping for IPv6 routing tables";
+
+    container loc-rib {
+      config false;
+      description
+        "Container for the IPv6 BGP LOC-RIB data";
+
+      uses bgp-common-table-attrs-top;
+
+
+      container routes {
+        description
+          "Enclosing container for list of routes in the routing
+          table.";
+
+        list route {
+          key "prefix origin path-id";
+
+          description
+            "List of routes in the table, keyed by the route
+            prefix, the route origin, and path-id.  The route
+            origin can be either the neighbor address from which
+            the route was learned, or the source protocol that
+            injected the route.  The path-id distinguishes routes
+            for the same prefix received from a neighbor (e.g.,
+            if add-paths is eanbled).";
+
+          uses bgp-loc-rib-key-refs;
+
+          container state {
+            description
+              "Operational state data for route entries in the
+              BGP LOC-RIB";
+
+            leaf prefix {
+              type inet:ipv6-prefix;
+              description
+                "The IPv6 prefix corresponding to the route";
+            }
+
+            uses bgp-loc-rib-common-keys;
+
+            uses bgp-loc-rib-common-attr-refs;
+
+            uses bgp-loc-rib-attr-state;
+
+            uses bgp-common-route-annotations-state;
+            uses bgp-loc-rib-route-annotations-state;
+
+          }
+
+          uses bgp-unknown-attr-top;
+        }
+      }
+    }
+  }
+
+  grouping bgp-adj-rib-key-refs {
+    description
+      "Key references to support operational state structure for
+      the BGP Adj-RIB tables";
+
+    leaf prefix {
+      type leafref {
+        path "../state/prefix";
+      }
+      description
+        "Reference to the prefix list key";
+    }
+
+    leaf path-id {
+      type leafref {
+        path "../state/path-id";
+      }
+      description
+        "Reference to the path-id list key";
+    }
+  }
+
+  grouping ipv4-adj-rib-common {
+    description
+      "Common structural grouping for each IPv4 adj-RIB table";
+
+    uses bgp-common-table-attrs-top;
+
+    container routes {
+      config false;
+      description
+        "Enclosing container for list of routes in the routing
+        table.";
+
+      list route {
+        key "prefix path-id";
+
+        description
+          "List of routes in the table, keyed by a combination of
+          the route prefix and path-id to distinguish multiple
+          routes received from a neighbor for the same prefix,
+          e.g., when BGP add-paths is enabled.";
+
+        uses bgp-adj-rib-key-refs;
+
+        container state {
+          description
+            "Operational state data for BGP Adj-RIB entries";
+
+          leaf prefix {
+            type inet:ipv4-prefix;
+            description
+              "Prefix for the route";
+          }
+
+          uses bgp-adj-rib-attr-state;
+
+          uses bgp-adj-rib-common-attr-refs;
+
+          uses bgp-common-route-annotations-state;
+        }
+
+        uses bgp-unknown-attr-top;
+
+      }
+    }
+  }
+
+  grouping ipv4-adj-rib-in-post {
+    description
+      "Common structural grouping for the IPv4 adj-rib-in
+      post-policy table";
+
+    uses bgp-common-table-attrs-top;
+
+    container routes {
+      config false;
+      description
+        "Enclosing container for list of routes in the routing
+        table.";
+
+      list route {
+        key "prefix path-id";
+
+        description
+          "List of routes in the table, keyed by a combination of
+          the route prefix and path-id to distinguish multiple
+          routes received from a neighbor for the same prefix,
+          e.g., when BGP add-paths is enabled.";
+
+        uses bgp-adj-rib-key-refs;
+
+        container state {
+          description
+            "Operational state data for BGP Adj-RIB entries";
+
+          leaf prefix {
+            type inet:ipv4-prefix;
+            description
+              "Prefix for the route";
+          }
+
+          uses bgp-adj-rib-attr-state;
+
+          uses bgp-adj-rib-common-attr-refs;
+
+          uses bgp-common-route-annotations-state;
+
+          uses bgp-adj-rib-in-post-route-annotations-state;
+        }
+
+        uses bgp-unknown-attr-top;
+      }
+    }
+  }
+
+
+  grouping ipv4-adj-rib-top {
+    description
+      "Top-level grouping for Adj-RIB table";
+
+    container neighbors {
+      config false;
+      description
+        "Enclosing container for neighbor list";
+
+      list neighbor {
+        key "neighbor-address";
+        description
+          "List of neighbors (peers) of the local BGP speaker";
+
+        leaf neighbor-address {
+          type leafref {
+            path "../state/neighbor-address";
+          }
+          description
+            "Reference to the list key";
+        }
+
+        container state {
+          description
+            "Operational state for each neighbor BGP Adj-RIB";
+
+          leaf neighbor-address {
+            type inet:ip-address-no-zone;
+            description
+              "IP address of the BGP neighbor or peer";
+          }
+        }
+
+        container adj-rib-in-pre {
+          description
+            "Per-neighbor table containing the NLRI updates
+            received from the neighbor before any local input
+            policy rules or filters have been applied.  This can
+            be considered the 'raw' updates from the neighbor.";
+
+          uses ipv4-adj-rib-common;
+
+        }
+
+        container adj-rib-in-post {
+          description
+            "Per-neighbor table containing the paths received from
+            the neighbor that are eligible for best-path selection
+            after local input policy rules have been applied.";
+
+          uses ipv4-adj-rib-in-post;
+        }
+
+        container adj-rib-out-pre {
+          description
+            "Per-neighbor table containing paths eligble for
+            sending (advertising) to the neighbor before output
+            policy rules have been applied";
+
+          uses ipv4-adj-rib-common;
+
+        }
+
+        container adj-rib-out-post {
+          description
+            "Per-neighbor table containing paths eligble for
+            sending (advertising) to the neighbor after output
+            policy rules have been applied";
+
+          uses ipv4-adj-rib-common;
+
+        }
+      }
+    }
+  }
+
+  grouping ipv6-adj-rib-common {
+    description
+      "Common structural grouping for each IPv6 adj-RIB table";
+
+    uses bgp-common-table-attrs-state;
+
+    container routes {
+      config false;
+      description
+        "Enclosing container for list of routes in the routing
+        table.";
+
+      list route {
+        key "prefix path-id";
+
+        description
+          "List of routes in the table";
+
+        uses bgp-adj-rib-key-refs;
+
+        container state {
+          description
+            "Operational state data for BGP Adj-RIB entries";
+
+          leaf prefix {
+            type inet:ipv6-prefix;
+            description
+              "Prefix for the route";
+          }
+
+          uses bgp-adj-rib-attr-state;
+
+          uses bgp-adj-rib-common-attr-refs;
+
+          uses bgp-common-route-annotations-state;
+        }
+
+        uses bgp-unknown-attr-top;
+      }
+    }
+  }
+
+  grouping ipv6-adj-rib-in-post {
+    description
+      "Common structural grouping for the IPv6 adj-rib-in
+      post-policy table";
+
+    uses bgp-common-table-attrs-state;
+
+    container routes {
+      config false;
+      description
+        "Enclosing container for list of routes in the routing
+        table.";
+
+      list route {
+        key "prefix path-id";
+
+        description
+          "List of routes in the table";
+
+        uses bgp-adj-rib-key-refs;
+
+        container state {
+          description
+            "Operational state data for BGP Adj-RIB entries";
+
+          leaf prefix {
+            type inet:ipv6-prefix;
+            description
+              "Prefix for the route";
+          }
+
+          uses bgp-adj-rib-attr-state;
+
+          uses bgp-adj-rib-common-attr-refs;
+
+          uses bgp-common-route-annotations-state;
+
+          uses bgp-adj-rib-in-post-route-annotations-state;
+        }
+
+        uses bgp-unknown-attr-top;
+      }
+    }
+  }
+
+  grouping ipv6-adj-rib-top {
+    description
+      "Top-level grouping for Adj-RIB table";
+
+    container neighbors {
+      config false;
+      description
+        "Enclosing container for neighbor list";
+
+      list neighbor {
+        key "neighbor-address";
+        description
+          "List of neighbors (peers) of the local BGP speaker";
+
+        leaf neighbor-address {
+          type leafref {
+            path "../state/neighbor-address";
+          }
+          description
+            "Reference to the list key";
+        }
+
+        container state {
+          description
+            "Operational state for each neighbor BGP Adj-RIB";
+
+          leaf neighbor-address {
+            type inet:ip-address-no-zone;
+            description
+              "IP address of the BGP neighbor or peer";
+          }
+        }
+
+        container adj-rib-in-pre {
+          description
+            "Per-neighbor table containing the NLRI updates
+            received from the neighbor before any local input
+            policy rules or filters have been applied.  This can
+            be considered the 'raw' updates from the neighbor.";
+
+          uses ipv6-adj-rib-common;
+
+        }
+
+        container adj-rib-in-post {
+          description
+            "Per-neighbor table containing the paths received from
+            the neighbor that are eligible for best-path selection
+            after local input policy rules have been applied.";
+
+          uses ipv6-adj-rib-in-post;
+        }
+
+        container adj-rib-out-pre {
+          description
+            "Per-neighbor table containing paths eligble for
+            sending (advertising) to the neighbor before output
+            policy rules have been applied";
+
+          uses ipv6-adj-rib-common;
+
+        }
+
+        container adj-rib-out-post {
+          description
+            "Per-neighbor table containing paths eligble for
+            sending (advertising) to the neighbor after output
+            policy rules have been applied";
+
+          uses ipv6-adj-rib-common;
+
+        }
+      }
+    }
+  }
+
+}
\ No newline at end of file
diff --git a/models/openconfig/src/main/yang/rib/openconfig-rib-bgp-types.yang b/models/openconfig/src/main/yang/rib/openconfig-rib-bgp-types.yang
new file mode 100644
index 0000000..8758cea
--- /dev/null
+++ b/models/openconfig/src/main/yang/rib/openconfig-rib-bgp-types.yang
@@ -0,0 +1,155 @@
+module openconfig-rib-bgp-types {
+
+  yang-version "1";
+
+  // namespace
+  namespace "http://openconfig.net/yang/rib/bgp-types";
+
+  prefix "oc-bgprib-types";
+
+  import openconfig-extensions { prefix oc-ext; }
+
+  organization "OpenConfig working group";
+
+  contact
+    "OpenConfig working group
+    www.openconfig.net";
+
+  description
+    "Defines identity and type defintions associated with
+    the OpenConfig BGP RIB modules";
+
+  oc-ext:openconfig-version "0.3.0";
+
+  revision "2016-10-17" {
+    description
+      "OpenConfig BGP RIB refactor";
+    reference "0.3.0";
+  }
+
+  revision "2016-04-11" {
+    description
+      "OpenConfig public release";
+    reference "0.2.0";
+  }
+
+  identity INVALID_ROUTE_REASON {
+    description
+      "Base identity for reason code for routes that are rejected as
+      invalid.  Some derived entities are based on BMP v3";
+    reference "BGP Monitoring Protocol (draft-ietf-grow-bmp-07)";
+  }
+
+  identity INVALID_CLUSTER_LOOP {
+    base INVALID_ROUTE_REASON;
+    description
+      "Route was invalid due to CLUSTER_LIST loop";
+  }
+
+  identity INVALID_AS_LOOP {
+    base INVALID_ROUTE_REASON;
+    description
+      "Route was invalid due to AS_PATH loop";
+  }
+
+  identity INVALID_ORIGINATOR {
+    base INVALID_ROUTE_REASON;
+    description
+      "Route was invalid due to ORIGINATOR_ID, e.g., update has
+      local router as originator";
+  }
+
+  identity INVALID_CONFED {
+    base INVALID_ROUTE_REASON;
+    description
+      "Route was invalid due to a loop in the AS_CONFED_SEQUENCE or
+      AS_CONFED_SET attributes";
+  }
+
+  identity BGP_NOT_SELECTED_BESTPATH {
+    description
+      "Base identity for indicating reason a route was was not
+      selected by BGP route selection algorithm";
+    reference
+      "RFC 4271 - Section 9.1";
+  }
+
+  identity LOCAL_PREF_LOWER {
+    base BGP_NOT_SELECTED_BESTPATH;
+    description
+      "Route has a lower localpref attribute than current best path";
+    reference
+      "RFC 4271 - Section 9.1.2";
+  }
+
+  identity AS_PATH_LONGER {
+    base BGP_NOT_SELECTED_BESTPATH;
+    description
+      "Route has a longer AS path attribute than current best path";
+    reference
+      "RFC 4271 - Section 9.1.2.2 (a)";
+  }
+
+  identity ORIGIN_TYPE_HIGHER {
+    base BGP_NOT_SELECTED_BESTPATH;
+    description
+      "Route has a higher origin type, i.e., IGP origin is preferred
+      over EGP or incomplete";
+    reference
+      "RFC 4271 - Section 9.1.2.2 (b)";
+  }
+
+  identity MED_HIGHER {
+    base BGP_NOT_SELECTED_BESTPATH;
+    description
+      "Route has a higher MED, or metric, attribute than the current
+      best path";
+    reference
+      "RFC 4271 - Section 9.1.2.2 (c)";
+  }
+
+  identity PREFER_EXTERNAL {
+    base BGP_NOT_SELECTED_BESTPATH;
+    description
+      "Route source is via IGP, rather than EGP.";
+    reference
+      "RFC 4271 - Section 9.1.2.2 (d)";
+  }
+
+  identity NEXTHOP_COST_HIGHER {
+    base BGP_NOT_SELECTED_BESTPATH;
+    description
+      "Route has a higher interior cost to the next hop.";
+    reference
+      "RFC 4271 - Section 9.1.2.2 (e)";
+  }
+
+  identity HIGHER_ROUTER_ID {
+    base BGP_NOT_SELECTED_BESTPATH;
+    description
+      "Route was sent by a peer with a higher BGP Identifier value,
+      or router id";
+    reference
+      "RFC 4271 - Section 9.1.2.2 (f)";
+  }
+
+  identity HIGHER_PEER_ADDRESS {
+    base BGP_NOT_SELECTED_BESTPATH;
+    description
+      "Route was sent by a peer with a higher IP address";
+    reference
+      "RFC 4271 - Section 9.1.2.2 (g)";
+  }
+
+  identity BGP_NOT_SELECTED_POLICY {
+    description
+      "Base identity for reason code for routes that are rejected
+      due to policy";
+  }
+
+  identity REJECTED_IMPORT_POLICY {
+    base BGP_NOT_SELECTED_POLICY;
+    description
+      "Route was rejected after apply import policies";
+  }
+}
\ No newline at end of file
diff --git a/models/openconfig/src/main/yang/rib/openconfig-rib-bgp.yang b/models/openconfig/src/main/yang/rib/openconfig-rib-bgp.yang
new file mode 100644
index 0000000..1af876b
--- /dev/null
+++ b/models/openconfig/src/main/yang/rib/openconfig-rib-bgp.yang
@@ -0,0 +1,183 @@
+module openconfig-rib-bgp {
+
+  yang-version "1";
+
+  // namespace
+  namespace "http://openconfig.net/yang/rib/bgp";
+
+  prefix "oc-rib-bgp";
+
+  // import some basic types
+  import openconfig-bgp-types { prefix oc-bgpt; }
+  import openconfig-extensions { prefix oc-ext; }
+
+  // include RIB submodules
+
+  // structure for LOC-RIB and Adj-RIB tables
+  include openconfig-rib-bgp-tables;
+
+  // structure of shared attribute groups
+  include openconfig-rib-bgp-shared-attributes;
+
+  // groupings of attributes in three categories:
+  //  - shared across multiple routes
+  //  - common to LOC-RIB and Adj-RIB, but not shared across routes
+  //  - specific to LOC-RIB or Adj-RIB
+  include openconfig-rib-bgp-attributes;
+
+  // groupings of annotations for each route or table
+  include openconfig-rib-bgp-table-attributes;
+
+  // meta
+  organization "OpenConfig working group";
+
+  contact
+    "OpenConfig working group
+    www.openconfig.net";
+
+  description
+    "Defines a data model for representing BGP routing table (RIB)
+    contents.  The model supports 5 logical RIBs per address family:
+
+    loc-rib: This is the main BGP routing table for the local routing
+    instance, containing best-path selections for each prefix. The
+    loc-rib table may contain multiple routes for a given prefix,
+    with an attribute to indicate which was selected as the best
+    path.  Note that multiple paths may be used or advertised even if
+    only one path is marked as best, e.g., when using BGP
+    add-paths.  An implementation may choose to mark multiple
+    paths in the RIB as best path by setting the flag to true for
+    multiple entries.
+
+    adj-rib-in-pre: This is a per-neighbor table containing the NLRI
+    updates received from the neighbor before any local input policy
+    rules or filters have been applied.  This can be considered the
+    'raw' updates from a given neighbor.
+
+    adj-rib-in-post: This is a per-neighbor table containing the
+    routes received from the neighbor that are eligible for
+    best-path selection after local input policy rules have been
+    applied.
+
+    adj-rib-out-pre: This is a per-neighbor table containing routes
+    eligible for sending (advertising) to the neighbor before output
+    policy rules have been applied.
+
+    adj-rib-out-post: This is a per-neighbor table containing routes
+    eligible for sending (advertising) to the neighbor after output
+    policy rules have been applied.";
+
+  oc-ext:openconfig-version "0.3.0";
+
+  revision "2016-10-17" {
+    description
+      "OpenConfig BGP RIB refactor";
+    reference "0.3.0";
+  }
+
+  revision "2016-04-11" {
+    description
+      "OpenConfig public release";
+    reference "0.2.0";
+  }
+
+
+
+  // grouping statements
+
+
+
+  grouping bgp-rib-state {
+    description
+      "Operational state data for the top level BGP RIB";
+
+    leaf afi-safi-name {
+      type identityref {
+        base oc-bgpt:AFI_SAFI_TYPE;
+      }
+      description "AFI,SAFI";
+    }
+  }
+
+  grouping bgp-rib-top {
+    description
+      "Top-level grouping for the BGP RIB";
+
+    container bgp-rib {
+      config false;
+      description
+        "Top level container for BGP RIBs";
+
+      uses attribute-sets-top;
+      uses community-sets-top;
+      uses ext-community-sets-top;
+
+      container afi-safis {
+        config false;
+        description
+          "Enclosing container for address family list";
+
+        list afi-safi {
+          key "afi-safi-name";
+          description
+            "list of afi-safi types";
+
+          leaf afi-safi-name {
+            type leafref {
+              path "../state/afi-safi-name";
+            }
+            description
+              "Reference to the list key";
+          }
+
+          container state {
+            config false;
+            description
+              "Operational state data for the BGP list";
+
+            uses bgp-rib-state;
+          }
+
+          container ipv4-unicast {
+            when "../afi-safi-name = 'oc-bgpt:IPV4_UNICAST'" {
+              description
+                "Include this container for IPv4 unicast RIB";
+            }
+            description
+              "Routing tables for IPv4 unicast -- active when the
+              afi-safi name is ipv4-unicast";
+
+            uses ipv4-loc-rib-top;
+            uses ipv4-adj-rib-top;
+          }
+
+          container ipv6-unicast {
+            when "../afi-safi-name = 'oc-bgpt:IPV6_UNICAST'" {
+              description
+                "Include this container for IPv6 unicast RIB";
+            }
+            description
+              "Routing tables for IPv6 unicast -- active when the
+              afi-safi name is ipv6-unicast";
+
+            uses ipv6-loc-rib-top;
+            uses ipv6-adj-rib-top;
+          }
+        }
+      }
+    }
+  }
+
+
+  // data definition statements
+
+  uses bgp-rib-top;
+
+  // augment statements
+
+
+  // rpc statements
+
+  // notification statements
+
+}