Routemaps¶
Module for working with EOS routemap resources
The Routemap resource provides configuration management of global route-map resources on an EOS node. It provides the following class implementations:
Routemaps - Configures routemaps in EOS
Notes
The set and match attributes produce a list of strings with The corresponding configuration. These strings will omit the preceeding set or match words, respectively.
- class pyeapi.api.routemaps.Routemaps(node)[source]¶
Bases:
pyeapi.api.abstract.EntityCollection
The Routemaps class provides management of the routemaps configuration
The Routemaps class is derived from Entity and provides an API for working with the nodes routemaps configuraiton.
- create(name, action, seqno)[source]¶
Creates a new routemap on the node
Note
This method will attempt to create the routemap regardless if the routemap exists or not. If the routemap already exists then this method will still return True.
- Parameters
name (string) – The full name of the routemap.
action (string) – The action to take for this routemap clause.
seqno (integer) – The sequence number for the routemap clause.
- Returns
True if the routemap could be created otherwise False (see Note)
- default(name, action, seqno)[source]¶
Defaults the routemap on the node
Note
This method will attempt to default the routemap from the nodes operational config. Since routemaps do not exist by default, the default action is essentially a negation and the result will be the removal of the routemap clause. If the routemap does not exist then this method will not perform any changes but still return True
- Parameters
name (string) – The full name of the routemap.
action (string) – The action to take for this routemap clause.
seqno (integer) – The sequence number for the routemap clause.
- Returns
True if the routemap could be deleted otherwise False (see Node)
- delete(name, action, seqno)[source]¶
Deletes the routemap from the node
Note
This method will attempt to delete the routemap from the nodes operational config. If the routemap does not exist then this method will not perform any changes but still return True
- Parameters
name (string) – The full name of the routemap.
action (string) – The action to take for this routemap clause.
seqno (integer) – The sequence number for the routemap clause.
- Returns
True if the routemap could be deleted otherwise False (see Node)
- get(name)[source]¶
Provides a method to retrieve all routemap configuration related to the name attribute.
- Parameters
name (string) – The name of the routemap.
- Returns
None if the specified routemap does not exists. If the routermap exists a dictionary will be provided as follows:
{ 'deny': { 30: { 'continue': 200, 'description': None, 'match': ['as 2000', 'source-protocol ospf', 'interface Ethernet2'], 'set': [] } }, 'permit': { 10: { 'continue': 100, 'description': None, 'match': ['interface Ethernet1'], 'set': ['tag 50']}, 20: { 'continue': 200, 'description': None, 'match': ['as 2000', 'source-protocol ospf', 'interface Ethernet2'], 'set': [] } } }
- set_continue(name, action, seqno, value=None, default=False, disable=False)[source]¶
Configures the routemap continue value
- Parameters
name (string) – The full name of the routemap.
action (string) – The action to take for this routemap clause.
seqno (integer) – The sequence number for the routemap clause.
value (integer) – The value to configure for the routemap continue
default (bool) – Specifies to default the routemap continue value
disable (bool) – Specifies to negate the routemap continue value
- Returns
True if the operation succeeds otherwise False is returned
- set_description(name, action, seqno, value=None, default=False, disable=False)[source]¶
Configures the routemap description
- Parameters
name (string) – The full name of the routemap.
action (string) – The action to take for this routemap clause.
seqno (integer) – The sequence number for the routemap clause.
value (string) – The value to configure for the routemap description
default (bool) – Specifies to default the routemap description value
disable (bool) – Specifies to negate the routemap description
- Returns
True if the operation succeeds otherwise False is returned
- set_match_statements(name, action, seqno, statements)[source]¶
Configures the match statements within the routemap clause. The final configuration of match statements will reflect the list of statements passed into the statements attribute. This implies match statements found in the routemap that are not specified in the statements attribute will be removed.
- Parameters
name (string) – The full name of the routemap.
action (string) – The action to take for this routemap clause.
seqno (integer) – The sequence number for the routemap clause.
statements (list) – A list of the match-related statements. Note that the statements should omit the leading match.
- Returns
True if the operation succeeds otherwise False
- set_set_statements(name, action, seqno, statements)[source]¶
Configures the set statements within the routemap clause. The final configuration of set statements will reflect the list of statements passed into the statements attribute. This implies set statements found in the routemap that are not specified in the statements attribute will be removed.
- Parameters
name (string) – The full name of the routemap.
action (string) – The action to take for this routemap clause.
seqno (integer) – The sequence number for the routemap clause.
statements (list) – A list of the set-related statements. Note that the statements should omit the leading set.
- Returns
True if the operation succeeds otherwise False