pyeapiasync.api.aclasync
Module for working with EOS access control list resources asynchronously
This module provides an asynchronous implementation for configuring and managing access control lists on Arista EOS nodes. Access control lists can be specified as either ‘standard’ or ‘extended’ ACLs. This module provides the following class implementations:
- AclsAsync – The top-level class used to manage both standard and
extended access control lists in EOS asynchronously
- StandardAclsAsync – Class that manages the set of standard ACLs
asynchronously
- ExtendedAclsAsync – Class that manages the set of extended ACLs
asynchronously
Attributes
Classes
Functions
|
Converts a subnet mask from dotted decimal to bit length |
|
Converts a prefix length to a dotted decimal subnet mask |
|
Returns an instance of AclsAsync |
Module Contents
- pyeapiasync.api.aclasync.mask_to_prefixlen(mask)[source]
Converts a subnet mask from dotted decimal to bit length
- Parameters:
mask (str) – The dotted decimal subnet mask to convert
- Returns:
The subnet mask as a valid prefix length
- Return type:
str
- pyeapiasync.api.aclasync.prefixlen_to_mask(prefixlen)[source]
Converts a prefix length to a dotted decimal subnet mask
- Parameters:
prefixlen (str) – The prefix length value to convert
- Returns:
The subt mask as a dotted decimal string
- Return type:
str
- class pyeapiasync.api.aclasync.AclsAsync(node, *args, **kwargs)[source]
Bases:
pyeapiasync.api.EntityCollectionAsync
- async get(name)[source]
Returns an ACL resource object asynchronously
- Parameters:
name (str) – The ACL name to retrieve from the running-config
- Returns:
A Python dictionary object containing the ACL configuration or None if the ACL does not exist
- async getall()[source]
Returns all ACLs in a dict object asynchronously.
- Returns:
A Python dictionary object containing all ACL configuration indexed by ACL name:
{ "<ACL1 name>": {...}, "<ACL2 name>": {...} }
- async marshall(name, *args, **kwargs)[source]
Marshalls calls to instance methods asynchronously
- Parameters:
name (str) – The method name to call on the ACL instance
*args – The arguments to pass to the method
**kwargs – The keyword arguments to pass to the method
- Returns:
The result of the method call
- Raises:
AttributeError – If the method does not exist on the instance
- async get_instance(name)[source]
Returns an instance of the appropriate ACL class asynchronously
This method will determine the ACL type and return the appropriate instance.
- Parameters:
name (str) – The name of the ACL to retrieve
- Returns:
A dictionary containing the ACL instance indexed by name
- class pyeapiasync.api.aclasync.StandardAclsAsync[source]
Bases:
pyeapiasync.api.EntityCollectionAsync
- async get(name)[source]
Returns a standard ACL resource object asynchronously
- Parameters:
name (str) – The ACL name to retrieve from the running-config
- Returns:
A Python dictionary object containing the ACL configuration or None if the ACL does not exist
- async create(name)[source]
Creates a new standard ACL in the running configuration asynchronously
- Parameters:
name (str) – The name of the ACL to create
- Returns:
True if the operation was successful otherwise False
- async delete(name)[source]
Deletes a standard ACL from the running configuration asynchronously
- Parameters:
name (str) – The name of the ACL to delete
- Returns:
True if the operation was successful otherwise False
- async default(name)[source]
Defaults a standard ACL in the running configuration asynchronously
- Parameters:
name (str) – The name of the ACL to default
- Returns:
True if the operation was successful otherwise False
- async update_entry(name, seqno, action, addr, prefixlen, log=False)[source]
Updates an entry in the standard ACL asynchronously
- Parameters:
name (str) – The name of the ACL
seqno (str) – The sequence number of the entry
action (str) – The action to take, either ‘permit’ or ‘deny’
addr (str) – The source IP address
prefixlen (str) – The prefix length or subnet mask
log (bool) – Whether to enable logging for this entry
- Returns:
True if the operation was successful otherwise False
- async add_entry(name, action, addr, prefixlen, log=False, seqno=None)[source]
Adds an entry to a standard ACL asynchronously
- Parameters:
name (str) – The name of the ACL
action (str) – The action to take, either ‘permit’ or ‘deny’
addr (str) – The source IP address
prefixlen (str) – The prefix length or subnet mask
log (bool) – Whether to enable logging for this entry
seqno (str) – Optional sequence number for the entry
- Returns:
True if the operation was successful otherwise False
- class pyeapiasync.api.aclasync.ExtendedAclsAsync[source]
Bases:
pyeapiasync.api.EntityCollectionAsync
- async get(name)[source]
Returns an extended ACL resource object asynchronously
- Parameters:
name (str) – The ACL name to retrieve from the running-config
- Returns:
A Python dictionary object containing the ACL configuration or None if the ACL does not exist
- async create(name)[source]
Creates a new extended ACL in the running configuration asynchronously
- Parameters:
name (str) – The name of the ACL to create
- Returns:
True if the operation was successful otherwise False
- async delete(name)[source]
Deletes an extended ACL from the running configuration asynchronously
- Parameters:
name (str) – The name of the ACL to delete
- Returns:
True if the operation was successful otherwise False
- async default(name)[source]
Defaults an extended ACL in the running configuration asynchronously
- Parameters:
name (str) – The name of the ACL to default
- Returns:
True if the operation was successful otherwise False
- async update_entry(name, seqno, action, protocol, srcaddr, srcprefixlen, dstaddr, dstprefixlen, log=False)[source]
Updates an entry in the extended ACL asynchronously
- Parameters:
name (str) – The name of the ACL
seqno (str) – The sequence number of the entry
action (str) – The action to take, either ‘permit’ or ‘deny’
protocol (str) – The protocol name or number
srcaddr (str) – The source IP address
srcprefixlen (str) – The source prefix length
dstaddr (str) – The destination IP address
dstprefixlen (str) – The destination prefix length
log (bool) – Whether to enable logging for this entry
- Returns:
True if the operation was successful otherwise False
- async add_entry(name, action, protocol, srcaddr, srcprefixlen, dstaddr, dstprefixlen, log=False, seqno=None)[source]
Adds an entry to an extended ACL asynchronously
- Parameters:
name (str) – The name of the ACL
action (str) – The action to take, either ‘permit’ or ‘deny’
protocol (str) – The protocol name or number
srcaddr (str) – The source IP address
srcprefixlen (str) – The source prefix length
dstaddr (str) – The destination IP address
dstprefixlen (str) – The destination prefix length
log (bool) – Whether to enable logging for this entry
seqno (str) – Optional sequence number for the entry
- Returns:
True if the operation was successful otherwise False
- pyeapiasync.api.aclasync.instance(node)[source]
Returns an instance of AclsAsync
This method will create and return an instance of the AclsAsync object passing the value of node to the object. The instance method is required for the resource to be autoloaded by the AsyncNode object
- Parameters:
node (AsyncNode) – The node argument passes an instance of AsyncNode to the resource
- Returns:
An instance of AclsAsync