Vrfs¶
Module for working with EOS VRF resources
The Vrfs resource provides configuration of VRF resources for an EOS node.
- param name
The name parameter maps to the VRF name in EOS. Valid values include any consecutive sequence of numbers, letters and underscore up to the maximum number of characters. This parameter is defaultable.
- type name
string
- param description
The vrf description set by the user
- type description
string
- param ipv4_routing
Tells whether IPv4 routing is enabled on the VRF
- type ipv4_routing
bool
- param ipv6_routing
Tells whether IPv6 unicast routing is enabled on the VRF
- type ipv6_routing
bool
- class pyeapi.api.vrfs.Vrfs(node)[source]¶
Bases:
pyeapi.api.abstract.EntityCollection
The Vrfs class provides a configuration resource for VRFs
The Vrfs class is derived from ResourceBase a standard set of methods for working with VRF configurations on an EOS node.
- configure_vrf(vrf_name, commands)[source]¶
Configures the specified VRF using commands
- Parameters
vrf_name (str) – The VRF name to configure
commands – The list of commands to configure
- Returns
True if the commands completed successfully
- create(vrf_name, rd=None)[source]¶
Creates a new VRF resource
- Note: A valid RD has the following format admin_ID:local_assignment.
The admin_ID can be an AS number or globally assigned IPv4 address. The local_assignment can be an integer between 0-65,535 if the admin_ID is an IPv4 address and can be between 0-4,294,967,295 if the admin_ID is an AS number. If the admin_ID is an AS number the local_assignment could also be in the form of an IPv4 address.
- Parameters
vrf_name (str) – The VRF name to create
rd (str) – The value to configure the vrf rd
- Returns
True if create was successful otherwise False
- default(vrf_name)[source]¶
Defaults the VRF configuration for given name
- Parameters
vrf_name (str) – The VRF name to default
- Returns
True if the operation was successful otherwise False
- delete(vrf_name)[source]¶
Deletes a VRF from the running configuration
- Parameters
vrf_name (str) – The VRF name to delete
- Returns
True if the operation was successful otherwise False
- get(value)[source]¶
Returns the VRF configuration as a resource dict.
- Parameters
value (string) – The vrf name to retrieve from the running configuration.
- Returns
- A Python dict object containing the VRF attributes as
key/value pairs.
- getall()[source]¶
Returns a dict object of all VRFs in the running-config
- Returns
A dict object of VRF attributes
- set_description(vrf_name, description=None, default=False, disable=False)[source]¶
Configures the VRF description
- Parameters
vrf_name (str) – The VRF name to configure
description (str) – The string to set the vrf description to
default (bool) – Configures the vrf description to its default value
disable (bool) – Negates the vrf description
- Returns
True if the operation was successful otherwise False
- set_interface(vrf_name, interface, default=False, disable=False)[source]¶
Adds a VRF to an interface
Notes
Requires interface to be in routed mode. Must apply ip address after VRF has been applied. This feature can also be accessed through the interfaces api.
- Parameters
vrf_name (str) – The VRF name to configure
interface (str) – The interface to add the VRF too
default (bool) – Set interface VRF forwarding to default
disable (bool) – Negate interface VRF forwarding
- Returns
True if the operation was successful otherwise False
- set_ipv4_routing(vrf_name, default=False, disable=False)[source]¶
Configures ipv4 routing for the vrf
- Parameters
vrf_name (str) – The VRF name to configure
default (bool) – Configures ipv4 routing for the vrf value to default if this value is true
disable (bool) – Negates the ipv4 routing for the vrf if set to true
- Returns
True if the operation was successful otherwise False
- set_ipv6_routing(vrf_name, default=False, disable=False)[source]¶
Configures ipv6 unicast routing for the vrf
- Parameters
vrf_name (str) – The VRF name to configure
default (bool) – Configures ipv6 unicast routing for the vrf value to default if this value is true
disable (bool) – Negates the ipv6 unicast routing for the vrf if set to true
- Returns
True if the operation was successful otherwise False
- set_rd(vrf_name, rd)[source]¶
Configures the VRF rd (route distinguisher)
- Note: A valid RD has the following format admin_ID:local_assignment.
The admin_ID can be an AS number or globally assigned IPv4 address. The local_assignment can be an integer between 0-65,535 if the admin_ID is an IPv4 address and can be between 0-4,294,967,295 if the admin_ID is an AS number. If the admin_ID is an AS number the local_assignment could also be in the form of an IPv4 address.
- Parameters
vrf_name (str) – The VRF name to set rd for
rd (str) – The value to configure the vrf rd
- Returns
True if the operation was successful otherwise False
- pyeapi.api.vrfs.instance(node)[source]¶
Returns an instance of Vrfs
This method will create and return an instance of the Vrfs object passing the value of API to the object. The instance method is required for the resource to be autoloaded by the Node object
- Parameters
node (Node) – The node argument passes an instance of Node to the resource