submodule openconfig-bgp-common-structure {

  belongs-to openconfig-bgp {
    prefix "oc-bgp";
  }

  import openconfig-extensions { prefix oc-ext; }

  include openconfig-bgp-common-multiprotocol;
  include openconfig-bgp-common;

  // meta
  organization
    "OpenConfig working group";

  contact
    "OpenConfig working group
    netopenconfig@googlegroups.com";

  description
    "This sub-module contains groupings that are common across multiple BGP
    contexts and provide structure around other primitive groupings.";

  oc-ext:openconfig-version "9.1.0";

  revision "2022-05-21" {
    description
      "Added extended-next-hop-encoding leaf.";
    reference "9.1.0";
  }

  revision "2022-04-26" {
    description
      "Transition decimal64 types to uint16 for various BGP timers";
    reference "9.0.0";
  }

  revision "2022-03-21" {
    description
      "Add BGP port";
    reference "8.1.0";
  }

  revision "2021-12-01" {
    description
      "Add prefix-limit-received, add prefix-limit
      state nodes, change/relocate restart-timer";
    reference "8.0.0";
  }

  revision "2021-10-21" {
    description
      "Removal of top-level /bgp container";
    reference "7.0.0";
  }

  revision "2021-06-16" {
    description
      "Remove trailing whitespace";
    reference "6.1.1";
  }

  revision "2021-03-17" {
    description
      "Add bfd support without augmentation.";
    reference "6.1.0";
  }

  revision "2019-07-10" {
    description
      "Normalise timestamp units to nanoseconds.";
    reference "6.0.0";
  }

  revision "2019-05-28" {
    description
      "Clarify prefix counter descriptions, add received-pre-policy
      counter.";
    reference "5.2.0";
  }

  revision "2019-04-16" {
    description
      "Add BGP RIB to the top-level BGP container";
    reference "5.1.0";
  }

  revision "2018-11-21" {
    description
      "Add OpenConfig module metadata extensions.";
    reference "5.0.2";
  }

  revision "2018-08-20" {
    description
      "Correct description of AFI-SAFI enabled leaf.";
    reference "5.0.1";
  }

  revision "2018-04-11" {
    description
      "Correct naming of BGP maximum prefix warning percentage leaf.";
    reference "5.0.0";
  }

  revision "2018-03-20" {
    description
      "Added SR-TE policy SAFI";
    reference "4.1.0";
  }

  revision "2017-07-30" {
    description
      "Clarification of add-paths send-max leaf";
    reference "4.0.1";
  }

  revision "2017-07-10" {
    description
      "Add error notifications; moved add-paths config; add AS
      prepend policy features; removed unneeded config leaves";
    reference "4.0.0";
  }

  revision "2017-02-02" {
    description
      "Bugfix to remove remaining global-level policy data";
    reference "3.0.1";
  }

  revision "2017-01-26" {
    description
      "Add dynamic neighbor support, migrate to OpenConfig types";
    reference "3.0.0";
  }

  revision "2016-06-21" {
    description
      "OpenConfig BGP refactor";
    reference "2.1.1";
  }

  grouping bgp-common-structure-neighbor-group-logging-options {
    description
      "Structural grouping used to include error handling configuration and
      state for both BGP neighbors and groups";

    container logging-options {
      description
        "Logging options for events related to the BGP neighbor or
        group";
      container config {
        description
          "Configuration parameters enabling or modifying logging
          for events relating to the BGPgroup";
        uses bgp-common-neighbor-group-logging-options-config;
      }
      container state {
        config false;
        description
          "State information relating to logging for the BGP neighbor
          or group";
        uses bgp-common-neighbor-group-logging-options-config;
      }
    }
  }

  grouping bgp-common-structure-neighbor-group-ebgp-multihop {
    description
      "Structural grouping used to include eBGP multihop configuration and
      state for both BGP neighbors and peer groups";

    container ebgp-multihop {
      description
        "eBGP multi-hop parameters for the BGPgroup";
      container config {
        description
          "Configuration parameters relating to eBGP multihop for the
          BGP group";
        uses bgp-common-neighbor-group-multihop-config;
      }
      container state {
        config false;
        description
          "State information for eBGP multihop, for the BGP neighbor
          or group";
        uses bgp-common-neighbor-group-multihop-config;
      }
    }
  }

  grouping bgp-common-structure-neighbor-group-route-reflector {
    description
      "Structural grouping used to include route reflector configuration and
      state for both BGP neighbors and peer groups";

    container route-reflector {
      description
        "Route reflector parameters for the BGPgroup";
      container config {
        description
          "Configuraton parameters relating to route reflection
          for the BGPgroup";
        uses bgp-common-neighbor-group-route-reflector-config;
      }
      container state {
        config false;
        description
          "State information relating to route reflection for the
          BGPgroup";
        uses bgp-common-neighbor-group-route-reflector-config;
      }
    }
  }

  grouping bgp-common-structure-neighbor-group-as-path-options {
    description
      "Structural grouping used to include AS_PATH manipulation configuration
      and state for both BGP neighbors and peer groups";

    container as-path-options {
      description
        "AS_PATH manipulation parameters for the BGP neighbor or
        group";
      container config {
        description
          "Configuration parameters relating to AS_PATH manipulation
          for the BGP peer or group";
        uses bgp-common-neighbor-group-as-path-options-config;
      }
      container state {
        config false;
        description
          "State information relating to the AS_PATH manipulation
          mechanisms for the BGP peer or group";
        uses bgp-common-neighbor-group-as-path-options-config;
      }
    }
  }

  grouping bgp-common-structure-neighbor-group-add-paths {
    description
      "Structural grouping used to include ADD-PATHs configuration and state
      for both BGP neighbors and peer groups";

    container add-paths {
      description
        "Parameters relating to the advertisement and receipt of
        multiple paths for a single NLRI (add-paths)";
      container config {
        description
          "Configuration parameters relating to ADD_PATHS";
        uses bgp-common-neighbor-group-add-paths-config;
      }
      container state {
        config false;
        description
          "State information associated with ADD_PATHS";
        uses bgp-common-neighbor-group-add-paths-config;
      }
    }
  }

}