def _test_add_mangle_rule_helper(self, use_ipv6):
        self.iptables = iptables_manager.IptablesManager(
            use_ipv6=use_ipv6)
        self.execute = mock.patch.object(self.iptables, "execute").start()

        mangle_dump_mod = (
            '# Generated by iptables_manager\n'
            '*mangle\n'
            ':FORWARD - [0:0]\n'
            ':INPUT - [0:0]\n'
            ':OUTPUT - [0:0]\n'
            ':POSTROUTING - [0:0]\n'
            ':PREROUTING - [0:0]\n'
            ':%(bn)s-FORWARD - [0:0]\n'
            ':%(bn)s-INPUT - [0:0]\n'
            ':%(bn)s-OUTPUT - [0:0]\n'
            ':%(bn)s-POSTROUTING - [0:0]\n'
            ':%(bn)s-PREROUTING - [0:0]\n'
            ':%(bn)s-float-snat - [0:0]\n'
            ':%(bn)s-floatingip - [0:0]\n'
            ':%(bn)s-mangle - [0:0]\n'
            ':%(bn)s-mark - [0:0]\n'
            ':%(bn)s-scope - [0:0]\n'
            '-I FORWARD 1 -j %(bn)s-FORWARD\n'
            '-I INPUT 1 -j %(bn)s-INPUT\n'
            '-I OUTPUT 1 -j %(bn)s-OUTPUT\n'
            '-I POSTROUTING 1 -j %(bn)s-POSTROUTING\n'
            '-I PREROUTING 1 -j %(bn)s-PREROUTING\n'
            '-I %(bn)s-PREROUTING 1 -j %(bn)s-mark\n'
            '-I %(bn)s-PREROUTING 2 -j %(bn)s-scope\n'
            '-I %(bn)s-PREROUTING 3 -m connmark ! --mark 0x0/0xffff0000 '
            '-j CONNMARK --restore-mark '
            '--nfmask 0xffff0000 --ctmask 0xffff0000\n'
            '-I %(bn)s-PREROUTING 4 -j %(bn)s-floatingip\n'
            '-I %(bn)s-PREROUTING 5 -j MARK --set-xmark 0x1/%(mark)s\n'
            '-I %(bn)s-float-snat 1 -m connmark --mark 0x0/0xffff0000 '
            '-j CONNMARK --save-mark '
            '--nfmask 0xffff0000 --ctmask 0xffff0000\n'
            'COMMIT\n'
            '# Completed by iptables_manager\n' % IPTABLES_ARG)

        expected_calls_and_values = [
            (mock.call(['iptables-save'],
                       run_as_root=True),
             ''),
            (mock.call(['iptables-restore', '-n'],
                       process_input=(FILTER_DUMP + mangle_dump_mod +
                                      NAT_DUMP + RAW_DUMP),
                       run_as_root=True),
             None),
            (mock.call(['iptables-save'],
                       run_as_root=True),
             ''),
            (mock.call(['iptables-restore', '-n'],
                       process_input=(FILTER_DUMP + MANGLE_DUMP +
                                      NAT_DUMP + RAW_DUMP),
                       run_as_root=True),
             None),
        ]
        if use_ipv6:
            self._extend_with_ip6tables_filter(
                expected_calls_and_values,
                FILTER_DUMP + MANGLE_DUMP_V6 + RAW_DUMP)

        tools.setup_mock_calls(self.execute, expected_calls_and_values)

        self.iptables.ipv4['mangle'].add_chain('mangle')
        self.iptables.ipv4['mangle'].add_rule(
            'PREROUTING',
            '-j MARK --set-xmark 0x1/%s' % constants.ROUTER_MARK_MASK)

        self.iptables.apply()

        self.iptables.ipv4['mangle'].remove_rule(
            'PREROUTING',
            constants.ROUTER_MARK_MASK % '-j MARK --set-xmark 0x1/%s')
        self.iptables.ipv4['mangle'].remove_chain('mangle')

        self.iptables.apply()

        tools.verify_mock_calls(self.execute, expected_calls_and_values)
dataset/ETHPy150Open openstack/neutron/neutron/tests/unit/agent/linux/test_iptables_manager.py/IptablesManagerStateFulTestCase._test_add_mangle_rule_helper/swapped operands of `%`