示例#1
0
 def test_set_dst(self, generic_rule: RuleGeneric):
     generic_rule.dst = Address("10.4.5.6")
     assert generic_rule.dst == Address("10.4.5.6")
     generic_rule.dst = IPNetwork("10.1.2.0/24")
     assert generic_rule.dst == Address("10.1.2.0/24")
     with pytest.raises(ValueError):
         generic_rule.dst = "something strange"
     with pytest.raises(TypeError):
         generic_rule.dst = None
示例#2
0
 def test_contains_other(self, generic_rule: RuleTCPUDP):
     rule = RuleGeneric()
     rule.src = "192.168.23.31"
     rule.dst = "192.168.24.1"
     rule.permit = True
     rule.active = False
     assert rule not in generic_rule
     rule = RuleICMP()
     rule.src = "192.168.23.31"
     rule.dst = "192.168.24.1"
     rule.permit = True
     rule.active = False
     assert rule not in generic_rule
示例#3
0
 def generic_rule(self):
     rule = RuleGeneric()
     rule.src = "192.168.23.0/24"
     rule.dst = "192.168.24.0/24"
     rule.permit = True
     rule.active = False
     rule.objectid = 1234567
     rule.is_access_rule = True
     rule.logging.interval = 60
     rule.logging.level = "Debugging"
     rule.protocol = 88
     rule.remark = "EIGRP Test Rule"
     rule.position = 17
     return rule