예제 #1
0
 def test_smartCompare_t9_t10(self):
     policy1 = linkdef.FWPolicy('', self.filet9, False)
     link_juniper.jcl_parser(self.filet9, policy1, False)
     policy2 = linkdef.FWPolicy('', self.filet10, False)
     link_juniper.jcl_parser(self.filet10, policy2, False)
     policy1.split_ips()
     policy2.split_ips()
     smartacl_result = smartACL.smartCompare2(policy1,
                                              policy2,
                                              verbose=False,
                                              only_different=False,
                                              outprint=False,
                                              ignore_lines='',
                                              ignoredeny=False,
                                              ignoreshadowed=False,
                                              DEBUG=False)
     self.assertEqual(smartacl_result, self.results_t9_t10, 'Normal Test')
     smartacl_result = smartACL.smartCompare2(policy1,
                                              policy2,
                                              verbose=False,
                                              only_different=False,
                                              outprint=False,
                                              ignore_lines='',
                                              ignoredeny=False,
                                              ignoreshadowed=True,
                                              DEBUG=False)
     self.assertEqual(smartacl_result, self.results_t9_t10,
                      'Ignoring Shadowed Rules')
예제 #2
0
 def test_smartCompare_t17_t16(self):
     policy1 = linkdef.FWPolicy('', self.filet17, False)
     link_cisco.acl_parser(self.filet17, policy1, False)
     policy2 = linkdef.FWPolicy('', self.filet16, False)
     link_cisco.acl_parser(self.filet16, policy2, False)
     smartacl_result = smartACL.smartCompare2(policy1,
                                              policy2,
                                              verbose=False,
                                              only_different=False,
                                              outprint=False,
                                              ignore_lines='',
                                              ignoredeny=False,
                                              ignoreshadowed=False,
                                              DEBUG=False)
     self.assertEqual(smartacl_result, self.results_t17_t16, 'Normal Test')
     smartacl_result = smartACL.smartCompare2(policy1,
                                              policy2,
                                              verbose=False,
                                              only_different=False,
                                              outprint=False,
                                              ignore_lines='',
                                              ignoredeny=False,
                                              ignoreshadowed=True,
                                              DEBUG=False)
     self.assertEqual(smartacl_result, self.results_t17_t16,
                      'Ignoring Shadowed Rules')
예제 #3
0
 def test_smartCompare_t9_t9(self):
     policy1 = linkdef.FWPolicy('', self.filet9, False)
     link_juniper.jcl_parser(self.filet9, policy1, False)
     policy2 = linkdef.FWPolicy('', self.filet9, False)
     link_juniper.jcl_parser(self.filet9, policy2, False)
     policy1.split_ips()
     policy2.split_ips()
     smartacl_result = smartACL.smartCompare2(policy1,
                                              policy2,
                                              verbose=False,
                                              only_different=False,
                                              outprint=False,
                                              ignore_lines='',
                                              ignoredeny=False,
                                              ignoreshadowed=False,
                                              DEBUG=False)
     self.assertEqual(smartacl_result, self.results_t9_t9, 'Normal Test')
     smartacl_result = smartACL.smartCompare2(policy1,
                                              policy2,
                                              verbose=False,
                                              only_different=False,
                                              outprint=False,
                                              ignore_lines='',
                                              ignoredeny=False,
                                              ignoreshadowed=True,
                                              DEBUG=False)
     # Because the shadowed rule is removed, both list need to be sorted first.
     self.assertEqual(smartacl_result.sort(), self.results_t9_t9.sort(),
                      'Ignoring Shadowed Rules')
예제 #4
0
 def test_smartShadow11(self):
     policy = linkdef.FWPolicy('', self.file11)
     link_cisco.acl_parser(self.file11, policy)
     self.assertEqual(smartACL.smartShadow2(policy), self.results_f11)
예제 #5
0
 def test_smartShadow10(self):
     policy = linkdef.FWPolicy('', self.file10)
     link_juniper.jcl_parser(self.file10, policy)
     policy.split_ips()
     self.assertEqual(smartACL.smartShadow2(policy), self.results_f10)