Bgp

API module for Bgp

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

Bases: pyeapi.api.abstract.Entity

The Bgp class implements global BGP router configuration

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

Returns the bgp routing configuration as a dict object

property neighbors
remove_network(prefix, masklen, route_map=None)[source]
set_maximum_paths(max_path=None, max_ecmp_path=None, default=False, disable=False)[source]
set_router_id(value=None, default=False, disable=False)[source]
set_shutdown(default=False, disable=True)[source]
class pyeapi.api.bgp.BgpNeighbors(node)[source]

Bases: pyeapi.api.abstract.EntityCollection

command_builder(name, cmd, value, default, disable)[source]

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)[source]

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)[source]
delete(name)[source]
get(k[, d]) D[k] if k in D, else d.  d defaults to None.[source]
getall()[source]
ispeergroup(name)[source]
set_description(name, value=None, default=False, disable=False)[source]
set_next_hop_self(name, value=None, default=False, disable=False)[source]
set_peer_group(name, value=None, default=False, disable=False)[source]
set_remote_as(name, value=None, default=False, disable=False)[source]
set_route_map_in(name, value=None, default=False, disable=False)[source]
set_route_map_out(name, value=None, default=False, disable=False)[source]
set_send_community(name, value=None, default=False, disable=False)[source]
set_shutdown(name, default=False, disable=True)[source]
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)[source]