Ejemplo n.º 1
0
 def test_iptables_ns(self, mock):
     table = 'filter'
     ns_list = commands.ip_ns_list()
     for ns in ns_list:
         expected = ['/usr/bin/sudo', '-n', 'ip', 'netns', 'exec', ns,
                     'iptables', '-v', '-S', '-t', table]
         commands.iptables_ns(ns, table)
         mock.assert_called_once_with(expected, **self.subprocess_args)
Ejemplo n.º 2
0
 def test_iptables_ns(self, mock):
     table = 'filter'
     ns_list = commands.ip_ns_list()
     for ns in ns_list:
         expected = [
             '/usr/bin/sudo', '-n', 'ip', 'netns', 'exec', ns, 'iptables',
             '-v', '-S', '-t', table
         ]
         commands.iptables_ns(ns, table)
         mock.assert_called_once_with(expected, **self.subprocess_args)
Ejemplo 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))
Ejemplo 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))