Beispiel #1
0
 def test_ip_ns_route(self, mock):
     ns_list = commands.ip_ns_list()
     for ns in ns_list:
         expected = ['/usr/bin/sudo', '-n', 'ip', 'netns', 'exec', ns,
                     'ip', 'r']
         commands.ip_ns_route(ns)
         mock.assert_called_once_with(expected, **self.subprocess_args)
Beispiel #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)
Beispiel #3
0
 def test_ip_ns_route(self, mock):
     ns_list = commands.ip_ns_list()
     for ns in ns_list:
         expected = [
             '/usr/bin/sudo', '-n', 'ip', 'netns', 'exec', ns, 'ip', 'r'
         ]
         commands.ip_ns_route(ns)
         mock.assert_called_once_with(expected, **self.subprocess_args)
Beispiel #4
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)
Beispiel #5
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))
Beispiel #6
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))
Beispiel #7
0
 def test_ip_ns_list(self, mock):
     expected = ['/usr/bin/sudo', '-n', 'ip', 'netns', 'list']
     commands.ip_ns_list()
     mock.assert_called_once_with(expected, **self.subprocess_args)
Beispiel #8
0
 def test_ip_ns_list(self, mock):
     expected = ['/usr/bin/sudo', '-n', 'ip', 'netns', 'list']
     commands.ip_ns_list()
     mock.assert_called_once_with(expected, **self.subprocess_args)