]>
Commit | Line | Data |
---|---|---|
976218cb CR |
1 | # Test for the hmp command "info usernet" |
2 | # | |
3 | # Copyright (c) 2021 Red Hat, Inc. | |
4 | # | |
5 | # Author: | |
6 | # Cleber Rosa <crosa@redhat.com> | |
7 | # | |
8 | # This work is licensed under the terms of the GNU GPL, version 2 or | |
9 | # later. See the COPYING file in the top-level directory. | |
10 | ||
2283b627 | 11 | from avocado_qemu import QemuSystemTest |
976218cb CR |
12 | |
13 | from qemu.utils import get_info_usernet_hostfwd_port | |
14 | ||
15 | ||
2283b627 | 16 | class InfoUsernet(QemuSystemTest): |
5104b738 AB |
17 | """ |
18 | :avocado: tags=machine:none | |
19 | """ | |
976218cb CR |
20 | |
21 | def test_hostfwd(self): | |
0fc389fe | 22 | self.require_netdev('user') |
976218cb CR |
23 | self.vm.add_args('-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0-:22') |
24 | self.vm.launch() | |
684750ab VSO |
25 | res = self.vm.cmd('human-monitor-command', |
26 | command_line='info usernet') | |
976218cb CR |
27 | port = get_info_usernet_hostfwd_port(res) |
28 | self.assertIsNotNone(port, | |
29 | ('"info usernet" output content does not seem to ' | |
30 | 'contain the redirected port')) | |
31 | self.assertGreater(port, 0, | |
32 | ('Found a redirected port that is not greater than' | |
33 | ' zero')) |