Esempio n. 1
0
 def test_iptables_raw(self, mock):
     table = 'filter'
     expected = ['/usr/bin/sudo', '-n', 'iptables', '--line-numbers',
                 '-L', '-nv', '-t',
                 '%s' % table]
     commands.iptables_raw(table)
     mock.assert_called_once_with(expected, **self.subprocess_args)
Esempio n. 2
0
 def test_iptables_raw(self, mock):
     table = 'filter'
     expected = [
         '/usr/bin/sudo', '-n', 'iptables', '-v', '-S', '-t',
         '%s' % table
     ]
     commands.iptables_raw(table)
     mock.assert_called_once_with(expected, **self.subprocess_args)
Esempio n. 3
0
def log_ip_ns():
    if not CONF.debug.enable:
        return
    LOG.info("Host Addr:\n" + commands.ip_addr_raw())
    LOG.info("Host Route:\n" + commands.ip_route_raw())
    for table in TABLES:
        LOG.info('Host %s table:\n%s', table, commands.iptables_raw(table))
    ns_list = commands.ip_ns_list()
    LOG.info("Host ns list" + str(ns_list))
    for ns in ns_list:
        LOG.info("ns(%s) Addr:\n%s", ns, commands.ip_ns_addr(ns))
        LOG.info("ns(%s) Route:\n%s", ns, commands.ip_ns_route(ns))
        for table in TABLES:
            LOG.info('ns(%s) table(%s):\n%s', ns, table,
                     commands.iptables_ns(ns, table))
Esempio n. 4
0
def log_ip_ns():
    if not config.TempestConfig().debug.enable:
        return
    LOG.info("Host Addr:\n" + commands.ip_addr_raw())
    LOG.info("Host Route:\n" + commands.ip_route_raw())
    for table in ['filter', 'nat', 'mangle']:
        LOG.info('Host %s table:\n%s', table, commands.iptables_raw(table))
    ns_list = commands.ip_ns_list()
    LOG.info("Host ns list" + str(ns_list))
    for ns in ns_list:
        LOG.info("ns(%s) Addr:\n%s", ns, commands.ip_ns_addr(ns))
        LOG.info("ns(%s) Route:\n%s", ns, commands.ip_ns_route(ns))
        for table in ['filter', 'nat', 'mangle']:
            LOG.info('ns(%s) table(%s):\n%s', ns, table,
                     commands.iptables_ns(ns, table))