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";
  }
}