Acl

Module for working with EOS access control list resources

This module provides an implementation for configuring and managing access 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:

  • Acls – The top-level class used to manage both standard and extended

    access control lists in EOS

  • StandardAcls – Class that manages the set of standard ACLs

  • ExtendedAcls – Class that manages the set of extended ACLs

class pyeapi.api.acl.Acls(node, *args, **kwargs)[source]

Bases: pyeapi.api.abstract.EntityCollection

create(name, type='standard')[source]
create_instance(name, acl_type)[source]
get(k[, d]) D[k] if k in D, else d.  d defaults to None.[source]
get_instance(name)[source]
getall()[source]

Returns all ACLs in a dict object.

Returns

A Python dictionary object containing all ACL configuration indexed by ACL name:

{
    "<ACL1 name>": {...},
    "<ACL2 name>": {...}
}

marshall(name, *args, **kwargs)[source]
class pyeapi.api.acl.ExtendedAcls(node)[source]

Bases: pyeapi.api.abstract.EntityCollection

add_entry(name, action, protocol, srcaddr, srcprefixlen, dstaddr, dstprefixlen, log=False, seqno=None)[source]
create(name)[source]
default(name)[source]
delete(name)[source]
entry_re = re.compile('(\\d+)(?: ([p|d]\\w+))(?: (\\w+|\\d+))(?: ([a|h]\\w+))?(?: ([0-9]+(?:\\.[0-9]+){3}))?(?:/([0-9]{1,2}))?(?: ((?:eq|gt|lt|neq|range) [\\w-]+))?(?: ([a|h]\\w+))?(?: ([0-9]+(?:\\.[0-9]+){3}))?(?:/([0-9]{)
get(k[, d]) D[k] if k in D, else d.  d defaults to None.[source]
remove_entry(name, seqno)[source]
update_entry(name, seqno, action, protocol, srcaddr, srcprefixlen, dstaddr, dstprefixlen, log=False)[source]
class pyeapi.api.acl.StandardAcls(node)[source]

Bases: pyeapi.api.abstract.EntityCollection

add_entry(name, action, addr, prefixlen, log=False, seqno=None)[source]
create(name)[source]
default(name)[source]
delete(name)[source]
entry_re = re.compile('(\\d+)(?: ([p|d]\\w+))(?: (any))?(?: (host))?(?: ([0-9]+(?:\\.[0-9]+){3}))?(?:/([0-9]{1,2}))?(?: ([0-9]+(?:\\.[0-9]+){3}))?(?: (log))?')
get(k[, d]) D[k] if k in D, else d.  d defaults to None.[source]
remove_entry(name, seqno)[source]
update_entry(name, seqno, action, addr, prefixlen, log=False)[source]
pyeapi.api.acl.instance(node)[source]
pyeapi.api.acl.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

pyeapi.api.acl.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