예제 #1
0
    def test_init_set(self):
        """Test set initialization"""
        # Disable protected-access: Test access protected members .
        # pylint: disable=protected-access
        iptables.init_set('foo')

        treadmill.iptables._ipset.assert_has_calls([
            mock.call('-exist', 'create', 'foo', 'hash:ip'),
            mock.call('flush', 'foo'),
        ])
예제 #2
0
def _init_rules():
    """Initialization of all chains and sets used by the fw service.
    """
    for chain in (iptables.PREROUTING_DNAT, iptables.POSTROUTING_SNAT,
                  iptables.PREROUTING_PASSTHROUGH,
                  iptables.VRING_DNAT, iptables.VRING_SNAT):
        iptables.create_chain('nat', chain)

    iptables.init_set(iptables.SET_PASSTHROUGHS,
                      family='inet', hashsize=1024, maxelem=65536)
예제 #3
0
    def test_init_set(self):
        """Test set initialization"""
        # Disable W0212: Test access protected members of admin module.
        # pylint: disable=W0212
        iptables.init_set('foo')

        treadmill.iptables._ipset.assert_has_calls([
            mock.call('create', 'foo', 'hash:ip'),
            mock.call('flush', 'foo'),
        ])