Lines Matching +full:host +full:- +full:port
1 # SPDX-License-Identifier: GPL-2.0
19 … def __init__(self, comm, shell=True, fail=True, ns=None, background=False, host=None, timeout=5): argument
28 if host:
29 self.proc = host.cmd(comm)
43 self.stdout = stdout.decode("utf-8")
44 self.stderr = stderr.decode("utf-8")
50 if len(stderr) > 0 and stderr[-1] == "\n":
51 stderr = stderr[:-1]
57 def __init__(self, comm, shell=True, fail=None, ns=None, host=None, argument
60 shell=shell, fail=fail, ns=ns, host=host)
79 …raise Exception("defer created with un-callable object, did you call the function instead of passi…
105 def tool(name, args, json=None, ns=None, host=None): argument
108 cmd_str += '--json '
110 cmd_obj = cmd(cmd_str, ns=ns, host=host)
116 def ip(args, json=None, ns=None, host=None): argument
118 args = f'-netns {ns} ' + args
119 return tool('ip', args, json=json, host=host)
122 def ethtool(args, json=None, ns=None, host=None): argument
123 return tool('ethtool', args, json=json, ns=ns, host=host)
128 Get a random unprivileged port, try to make sure it's not already used.
131 port = random.randint(10000, 65535)
134 s.bind(("", port))
135 return port
139 raise Exception("Can't find any free unprivileged port")
142 def wait_port_listen(port, proto="tcp", ns=None, host=None, sleep=0.005, deadline=5): argument
145 pattern = f":{port:04X} .* "
151 data = cmd(f'cat /proc/net/{proto}*', ns=ns, host=host, shell=True).stdout
156 raise Exception("Waiting for port listen timed out")