Skip to content

Commit

Permalink
Better ciscoasa dsmo test (aerleon#284)
Browse files Browse the repository at this point in the history
* Updating CiscoASA DSMO tests to actually provide for a discontiguous subnet mask.
  • Loading branch information
ankenyr committed May 11, 2023
1 parent 0ac4739 commit 2493816
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
clear configure access-list foo
access-list foo remark $Id:$
access-list foo remark $Date:$
access-list foo remark $Revision:$


access-list foo remark good-dst-term-3
access-list foo extended permit ip any 128.168.0.0 191.255.255.128
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
clear configure access-list foo
access-list foo remark $Id:$
access-list foo remark $Date:$
access-list foo remark $Revision:$


access-list foo remark good-src-term-3
access-list foo extended permit ip 128.168.0.0 191.255.255.128 any
10 changes: 6 additions & 4 deletions tests/regression/ciscoasa/ciscoasa_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,17 @@ def testVerbatim(self):
self.assertIn(expect, str(pol))

@parameterized.named_parameters(
('source', GOOD_TERM_3, 'permit ip 10.0.0.0 255.255.254.0 any'),
('destination', GOOD_TERM_4, 'permit ip any 10.0.0.0 255.255.254.0'),
('source', GOOD_TERM_3, 'permit ip 128.168.0.0 191.255.255.128 any'),
('destination', GOOD_TERM_4, 'permit ip any 128.168.0.0 191.255.255.128'),
)
@capture.stdout
def testDSMO(self, term, expected):
self.naming.GetNetAddr.return_value = [
nacaddr.IP('10.0.0.0/24'),
nacaddr.IPv4('10.0.1.0/24'),
nacaddr.IPv4('192.168.0.0/25'),
nacaddr.IPv4('128.168.0.0/25'),
]
pol = ciscoasa.CiscoASA(policy.ParsePolicy(DSMO_HEADER + term, self.naming), EXP_INFO)
print(pol)
self.assertIn(expected, str(pol))

@capture.stdout
Expand Down

0 comments on commit 2493816

Please sign in to comment.