Lines Matching +full:host +full:- +full:port
1 # SPDX-License-Identifier: GPL-2.0
17 … def __init__(self, comm, shell=True, fail=True, ns=None, background=False, host=None, timeout=5): argument
26 if host:
27 self.proc = host.cmd(comm)
41 self.stdout = stdout.decode("utf-8")
42 self.stderr = stderr.decode("utf-8")
48 if len(stderr) > 0 and stderr[-1] == "\n":
49 stderr = stderr[:-1]
55 def __init__(self, comm, shell=True, fail=None, ns=None, host=None, argument
58 shell=shell, fail=fail, ns=ns, host=host)
77 …raise Exception("defer created with un-callable object, did you call the function instead of passi…
103 def tool(name, args, json=None, ns=None, host=None): argument
106 cmd_str += '--json '
108 cmd_obj = cmd(cmd_str, ns=ns, host=host)
114 def ip(args, json=None, ns=None, host=None): argument
116 args = f'-netns {ns} ' + args
117 return tool('ip', args, json=json, host=host)
120 def ethtool(args, json=None, ns=None, host=None): argument
121 return tool('ethtool', args, json=json, ns=ns, host=host)
126 Get a random unprivileged port, try to make sure it's not already used.
129 port = random.randint(10000, 65535)
132 s.bind(("", port))
133 return port
137 raise Exception("Can't find any free unprivileged port")
140 def wait_port_listen(port, proto="tcp", ns=None, host=None, sleep=0.005, deadline=5): argument
143 pattern = f":{port:04X} .* "
149 data = cmd(f'cat /proc/net/{proto}*', ns=ns, host=host, shell=True).stdout
154 raise Exception("Waiting for port listen timed out")