Skip to content

Commit

Permalink
Add support for destination port
Browse files Browse the repository at this point in the history
  • Loading branch information
sc68cal committed Sep 14, 2023
1 parent 1a04550 commit 624f1c5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pyeapi/api/acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,22 +267,26 @@ def default(self, name):
return self.configure('default ip access-list %s' % name)

def update_entry(self, name, seqno, action, protocol, srcaddr,
srcprefixlen, dstaddr, dstprefixlen, log=False):
srcprefixlen, dstaddr, dstprefixlen, log=False, dstport=None):
cmds = ['ip access-list %s' % name]
cmds.append('no %s' % seqno)
entry = '%s %s %s %s/%s %s/%s' % (seqno, action, protocol, srcaddr,
srcprefixlen, dstaddr, dstprefixlen)
if dstport is not None:
entry += ' eq %d' % dstport
if log:
entry += ' log'
cmds.append(entry)
cmds.append('exit')
return self.configure(cmds)

def add_entry(self, name, action, protocol, srcaddr, srcprefixlen,
dstaddr, dstprefixlen, log=False, seqno=None):
dstaddr, dstprefixlen, log=False, seqno=None, dstport=None):
cmds = ['ip access-list %s' % name]
entry = '%s %s %s/%s %s/%s' % (action, protocol, srcaddr,
srcprefixlen, dstaddr, dstprefixlen)
if dstport is not None:
entry += ' eq %d' % dstport
if seqno is not None:
entry = '%s %s' % (seqno, entry)
if log:
Expand Down

0 comments on commit 624f1c5

Please sign in to comment.