# Bgp

API module for Bgp

class pyeapi.api.bgp.Bgp(*args, **kwargs)

  Bases: `Entity`

  The Bgp class implements global BGP router configuration

  add_network(prefix, length, route_map=None)
  configure_bgp(cmd)
  create(bgp_as)
  default()
  delete()
  get()

    Returns the bgp routing configuration as a dict object

  property neighbors
  remove_network(prefix, masklen, route_map=None)
  set_maximum_paths(max_path=None, max_ecmp_path=None, default=False, disable=False)
  set_router_id(value=None, default=False, disable=False)
  set_shutdown(default=False, disable=True)

class pyeapi.api.bgp.BgpNeighbors(node)

  Bases: `EntityCollection`

  command_builder(name, cmd, value, default, disable)

    Builds a command with keywords

    Notes

    Negating a command string by overriding ‘value’ with None or an

      assigned value that evalutates to false has been deprecated. Please use ‘disable’ to negate a command.

    Parameters are evaluated in the order ‘default’, ‘disable’, ‘value’

    Parameters:

      - string (str) – The command string

      - value (str) – The configuration setting to subsititue into the command string. If value is a boolean and True, just the command string is used

      - default (bool) – Specifies the command should use the default keyword argument. Default preempts disable and value.

      - disable (bool) – Specifies the command should use the no keyword argument. Disable preempts value.

    Returns:

      A command string that can be used to configure the node

  configure(cmd)

    Sends the commands list to the node in config mode

    This method performs configuration the node using the array of commands specified. This method wraps the configuration commands in a try/except block and stores any exceptions in the error property.

    Note

    If the return from this method is False, use the error property to investigate the exception

    Parameters:

      commands (list) – A list of commands to be sent to the node in config mode

    Returns:

      True if the commands are executed without exception otherwise

        False is returned

  create(name)
  delete(name)
  get(k[, d]) → D[k] if k in D, else d. d defaults to None.
  getall()
  ispeergroup(name)
  set_description(name, value=None, default=False, disable=False)
  set_next_hop_self(name, value=None, default=False, disable=False)
  set_peer_group(name, value=None, default=False, disable=False)
  set_remote_as(name, value=None, default=False, disable=False)
  set_route_map_in(name, value=None, default=False, disable=False)
  set_route_map_out(name, value=None, default=False, disable=False)
  set_send_community(name, value=None, default=False, disable=False)
  set_shutdown(name, default=False, disable=True)

class pyeapi.api.bgp.Network(prefix, length, route_map)

  Bases: `tuple`

  length

    Alias for field number 1

  prefix

    Alias for field number 0

  route_map

    Alias for field number 2

pyeapi.api.bgp.instance(api)