Exemplo n.º 1
0
def test_rules_from_to_intersection():
    rules = [
        Rule(src=ipset('0.0.0.0/7'), dst=ipset('2.0.1.0/24'), app='app', name='r'),
    ]
    eq_(process.rules_from_to(rules, ipset('1.0.0.0/8'), ipset('2.0.0.0/8')), [
        Rule(src=ipset('1.0.0.0/8'), dst=ipset('2.0.1.0/24'), app='app', name='r'),
    ])
def test_rules_from_to_no_match_dst():
    rules = [
        Rule(src=ipset('1.0.0.0/8'),
             dst=ipset('3.0.0.0/24'),
             app='app',
             name='r'),
    ]
    eq_(process.rules_from_to(rules, ipset('1.0.0.0/8'), ipset('2.0.0.0/8')),
        [])
def test_rules_from_to_intersection():
    rules = [
        Rule(src=ipset('0.0.0.0/7'),
             dst=ipset('2.0.1.0/24'),
             app='app',
             name='r'),
    ]
    eq_(process.rules_from_to(rules, ipset('1.0.0.0/8'), ipset('2.0.0.0/8')), [
        Rule(src=ipset('1.0.0.0/8'),
             dst=ipset('2.0.1.0/24'),
             app='app',
             name='r'),
    ])
def test_rules_from_to_empty():
    eq_(process.rules_from_to([], ipset('1.0.0.0/8'), ipset('2.0.0.0/8')), [])
Exemplo n.º 5
0
def test_rules_from_to_no_match_dst():
    rules = [
        Rule(src=ipset('1.0.0.0/8'), dst=ipset('3.0.0.0/24'), app='app', name='r'),
    ]
    eq_(process.rules_from_to(rules, ipset('1.0.0.0/8'), ipset('2.0.0.0/8')),
        [])
Exemplo n.º 6
0
def test_rules_from_to_empty():
    eq_(process.rules_from_to([], ipset('1.0.0.0/8'), ipset('2.0.0.0/8')),
        [])