pyeapiasync.api.vrrpasync

Module for working with EOS VRRP resources asynchronously

The VrrpAsync resource provides configuration management of interface specific vrrp resources on and EOS node. It provides the following class implementations:

  • VrrpAsync - Configure vrrps in EOS asynchronously

Attributes

PROPERTIES

Classes

VrrpAsync

The VrrpAsync class provides management of the VRRP configuration

Functions

instance(node)

Returns an instance of VrrpAsync

Module Contents

pyeapiasync.api.vrrpasync.PROPERTIES = ['primary_ip', 'priority', 'description', 'secondary_ip', 'ip_version', 'enable',...[source]
class pyeapiasync.api.vrrpasync.VrrpAsync[source]

Bases: pyeapiasync.api.EntityCollectionAsync

The VrrpAsync class provides management of the VRRP configuration

asynchronously

The VrrpAsync class is derived from EntityCollectionAsync and provides an

API for working with the node’s vrrp configurations asynchronously.

async get(name)[source]
Get the vrrp configurations for a single node interface

asynchronously

Parameters:

name (string) – The name of the interface for which vrrp configurations will be retrieved.

Returns:

A dictionary containing the vrrp configurations on the interface. Returns None if no vrrp configurations are defined or if the interface is not configured.

async getall()[source]
Get the vrrp configurations for all interfaces on a node

asynchronously

Returns:

A dictionary containing the vrrp configurations on the node, keyed by interface.

async create(interface, vrid, **kwargs)[source]

Creates a vrrp instance from an interface asynchronously

Note

This method will attempt to create a vrrp in the node’s operational config. If the vrrp already exists on the interface, then this method will set the properties of the existing vrrp to those that have been passed in, if possible.

Parameters:
  • interface (string) – The interface to configure.

  • vrid (integer) – The vrid number for the vrrp to be created.

  • kwargs (dict) – A dictionary specifying the properties to be applied to the new vrrp instance. See library documentation for available keys and values.

Returns:

True if the vrrp could be created otherwise False (see Node)

async delete(interface, vrid)[source]

Deletes a vrrp instance from an interface asynchronously

Note

This method will attempt to delete the vrrp from the node’s operational config. If the vrrp does not exist on the interface then this method will not perform any changes but still return True

Parameters:
  • interface (string) – The interface to configure.

  • vrid (integer) – The vrid number for the vrrp to be deleted.

Returns:

True if the vrrp could be deleted otherwise False (see Node)

async default(interface, vrid)[source]

Defaults a vrrp instance from an interface asynchronously

Note

This method will attempt to default the vrrp on the node’s operational config. Default results in the deletion of the specified vrrp . If the vrrp does not exist on the interface then this method will not perform any changes but still return True

Parameters:
  • interface (string) – The interface to configure.

  • vrid (integer) – The vrid number for the vrrp to be defaulted.

Returns:

True if the vrrp could be defaulted otherwise False (see Node)

async set_enable(name, vrid, value=False, run=True)[source]

Set the enable property of the vrrp asynchronously

Parameters:
  • name (string) – The interface to configure.

  • vrid (integer) – The vrid number for the vrrp to be managed.

  • value (boolean) – True to enable the vrrp, False to disable.

  • run (boolean) – True to execute the command, False to return a string with the formatted command.

Returns:

If run is True, returns True if the command executed successfully, error if failure

If run is False, returns the formatted command string which can be passed to the node

async set_ip_version(name, vrid, value=None, disable=False, default=False, run=True)[source]

Set the ip_version property of the vrrp asynchronously

Parameters:
  • name (string) – The interface to configure.

  • vrid (integer) – The vrid number for the vrrp to be managed.

  • value (integer) – IP version to assign to the vrrp.

  • disable (boolean) – Unset ip_version if True.

  • default (boolean) – Set ip_version to default if True.

  • run (boolean) – Set to True to execute the command, False to return a string with the formatted command.

Returns:

If run is True, returns True if the command executed successfully, error if failure.

If run is False, returns the formatted command string which can be passed to the node

async set_secondary_ips(name, vrid, secondary_ips, run=True)[source]

Configure the secondary_ip property of the vrrp asynchronously

Notes

set_secondary_ips takes a list of secondary ip addresses which are to be set on the virtal router. An empty list will remove any existing secondary ip addresses from the vrrp. A list containing addresses will configure the virtual router with only the addresses specified in the list - any existing addresses not included in the list will be removed.

Parameters:
  • name (string) – The interface to configure.

  • vrid (integer) – The vrid number for the vrrp to be managed.

  • secondary_ips (list) – A list of secondary ip addresses to be assigned to the virtual router.

  • run (boolean) – Set to True to execute the command, False to return a string with the formatted command.

Returns:

If run is True, returns True if the command executed successfully, error if failure.

If run is False, returns the formatted command string which can be passed to the node

async set_timers_advertise(name, vrid, value=None, disable=False, default=False, run=True)[source]

Set the timers_advertise property of the vrrp asynchronously

Parameters:
  • name (string) – The interface to configure.

  • vrid (integer) – The vrid number for the vrrp to be managed.

  • value (integer) – Timers advertise value to assign to the vrrp.

  • disable (boolean) – Unset timers advertise if True.

  • default (boolean) – Set timers advertise to default if True.

  • run (boolean) – Set to True to execute the command, False to return a string with the formatted command.

Returns:

If run is True, returns True if the command executed successfully, error if failure.

If run is False, returns the formatted command string which can be passed to the node

async set_mac_addr_adv_interval(name, vrid, value=None, disable=False, default=False, run=True)[source]

Set the mac_addr_adv_interval property of the vrrp asynchronously

Parameters:
  • name (string) – The interface to configure.

  • vrid (integer) – The vrid number for the vrrp to be managed.

  • value (integer) – mac-address advertisement-interval value to assign to the vrrp.

  • disable (boolean) – Unset mac-address advertisement-interval if True.

  • default (boolean) – Set mac-address advertisement-interval to default if True.

  • run (boolean) – Set to True to execute the command, False to return a string with the formatted command.

Returns:

If run is True, returns True if the command executed successfully, error if failure.

If run is False, returns the formatted command string which can be passed to the node

async set_preempt(name, vrid, value=None, disable=False, default=False, run=True)[source]

Set the preempt property of the vrrp asynchronously

Parameters:
  • name (string) – The interface to configure.

  • vrid (integer) – The vrid number for the vrrp to be managed.

  • value (boolean) – True to enable preempt, False to disable preempt on the vrrp.

  • disable (boolean) – Unset preempt if True.

  • default (boolean) – Set preempt to default if True.

  • run (boolean) – Set to True to execute the command, False to return a string with the formatted command.

Returns:

If run is True, returns True if the command executed successfully, error if failure.

If run is False, returns the formatted command string which can be passed to the node

async set_preempt_delay_min(name, vrid, value=None, disable=False, default=False, run=True)[source]

Set the preempt_delay_min property of the vrrp asynchronously

Parameters:
  • name (string) – The interface to configure.

  • vrid (integer) – The vrid number for the vrrp to be managed.

  • value (integer) – Preempt delay minimum value to set on the vrrp.

  • disable (boolean) – Unset preempt delay minimum if True.

  • default (boolean) – Set preempt delay minimum to default if True.

  • run (boolean) – Set to True to execute the command, False to return a string with the formatted command.

Returns:

If run is True, returns True if the command executed successfully, error if failure.

If run is False, returns the formatted command string which can be passed to the node

async set_preempt_delay_reload(name, vrid, value=None, disable=False, default=False, run=True)[source]

Set the preempt_delay_reload property of the vrrp asynchronously

Parameters:
  • name (string) – The interface to configure.

  • vrid (integer) – The vrid number for the vrrp to be managed.

  • value (integer) – Preempt delay reload value to set on the vrrp.

  • disable (boolean) – Unset preempt delay reload if True.

  • default (boolean) – Set preempt delay reload to default if True.

  • run (boolean) – Set to True to execute the command, False to return a string with the formatted command.

Returns:

If run is True, returns True if the command executed successfully, error if failure.

If run is False, returns the formatted command string which can be passed to the node

async set_delay_reload(name, vrid, value=None, disable=False, default=False, run=True)[source]

Set the delay_reload property of the vrrp asynchronously

Parameters:
  • name (string) – The interface to configure.

  • vrid (integer) – The vrid number for the vrrp to be managed.

  • value (integer) – Delay reload value to set on the vrrp.

  • disable (boolean) – Unset delay reload if True.

  • default (boolean) – Set delay reload to default if True.

  • run (boolean) – Set to True to execute the command, False to return a string with the formatted command.

Returns:

If run is True, returns True if the command executed successfully, error if failure.

If run is False, returns the formatted command string which can be passed to the node

async set_tracks(name, vrid, tracks, run=True)[source]

Configure the track property of the vrrp asynchronously

Notes

set_tracks takes a list of tracked objects which are to be set on the virtual router. An empty list will remove any existing tracked objects from the vrrp. A list containing track entries configures the virtual router to track only the objects specified in the list - any existing tracked objects on the vrrp not included in the list will be removed.

Parameters:
  • name (string) – The interface to configure.

  • vrid (integer) – The vrid number for the vrrp to be managed.

  • tracks (list) –

    A list of track definition dictionaries. Each dictionary is a definition of a tracked object in one of the two formats:

    {'name': tracked_object_name,
     'action': 'shutdown'}
    {'name': tracked_object_name,
     'action': 'decrement',
     'amount': amount_of_decrement}
    

  • run (boolean) – Set to True to execute the command, False to return a string with the formatted command.

Returns:

If run is True, returns True if the command executed successfully, error if failure.

If run is False, returns the formatted command string which can be passed to the node

async set_bfd_ip(name, vrid, value=None, disable=False, default=False, run=True)[source]

Set the bfd_ip property of the vrrp asynchronously

Parameters:
  • name (string) – The interface to configure.

  • vrid (integer) – The vrid number for the vrrp to be managed.

  • value (string) – The bfd ip address to be set.

  • disable (boolean) – Unset bfd ip if True.

  • default (boolean) – Set bfd ip to default if True.

  • run (boolean) – Set to True to execute the command, False to return a string with the formatted command.

Returns:

If run is True, returns True if the command executed successfully, error if failure.

If run is False, returns the formatted command string which can be passed to the node

vrconf_format(vrconfig)[source]

Formats a vrrp configuration dictionary to match the information as presented from the get and getall methods. vrrp configuration dictionaries passed to the create method may contain data for setting properties which results in a default value on the node. In these instances, the data for setting or changing the property is replaced with the value that would be returned from the get and getall methods.

Intended for validating updated vrrp configurations.

pyeapiasync.api.vrrpasync.instance(node)[source]

Returns an instance of VrrpAsync

Parameters:

node (Node) – The node argument passes an instance of Node to the resource

Returns:

An instance of VrrpAsync

Return type:

object