Skip to content

Commit

Permalink
Merge pull request #70 from dathelen/develop
Browse files Browse the repository at this point in the history
implement add ACE with seq nos
  • Loading branch information
devrobo committed Dec 14, 2015
2 parents deb2579 + 8a0c3b8 commit 363be28
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pyeapi/api/acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,11 @@ def update_entry(self, name, seqno, action, addr, prefixlen, log=False):
cmds.append('exit')
return self.configure(cmds)

def add_entry(self, name, action, addr, prefixlen, log=False):
def add_entry(self, name, action, addr, prefixlen, log=False, seqno=None):
cmds = ['ip access-list standard %s' % name]
entry = '%s %s/%s' % (action, addr, prefixlen)
if seqno is not None:
entry = '%s %s' % (seqno, entry)
if log:
entry += ' log'
cmds.append(entry)
Expand Down
5 changes: 5 additions & 0 deletions test/unit/test_api_acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ def test_add_entry(self):
func = function('add_entry', 'test', 'permit', '0.0.0.0',
'32', True)
self.eapi_positive_config_test(func, cmds)
def test_add_entry_with_seqno(self):
cmds = ['ip access-list standard test', '30 permit 0.0.0.0/32 log', 'exit']
func = function('add_entry', 'test', 'permit', '0.0.0.0',
'32', True, 30)
self.eapi_positive_config_test(func, cmds)


if __name__ == '__main__':
Expand Down

0 comments on commit 363be28

Please sign in to comment.