Lines Matching +full:port +full:- +full:def

1 # SPDX-License-Identifier: GPL-2.0
13 def __init__(self, msg, cmd_obj):
18 def fd_read_timeout(fd, timeout):
34 def __init__(self, comm, shell=None, fail=True, ns=None, background=False,
77 def process(self, terminate=True, fail=None, timeout=5):
86 self.stdout = stdout.decode("utf-8")
87 self.stderr = stderr.decode("utf-8")
93 if len(stderr) > 0 and stderr[-1] == "\n":
94 stderr = stderr[:-1]
118 def __init__(self, comm, shell=None, fail=None, ns=None, host=None,
131 def __enter__(self):
134 def __exit__(self, ex_type, ex_value, ex_tb):
144 def __init__(self, func, *args, **kwargs):
146 raise Exception("defer created with un-callable object, did you call the function instead of passing its name?")
155 def __enter__(self):
158 def __exit__(self, ex_type, ex_value, ex_tb):
161 def exec_only(self):
164 def cancel(self):
167 def exec(self):
172 def tool(name, args, json=None, ns=None, host=None):
175 cmd_str += '--json '
183 def bpftool(args, json=None, ns=None, host=None):
187 def ip(args, json=None, ns=None, host=None):
189 args = f'-netns {ns} ' + args
193 def ethtool(args, json=None, ns=None, host=None):
197 def bpftrace(expr, json=None, ns=None, host=None, timeout=None):
208 # Throw in --quiet if json, otherwise the output has two objects
210 cmd_arr += ['-f', 'json', '-q']
213 cmd_arr += ['-e', expr]
232 def rand_port(stype=socket.SOCK_STREAM):
234 Get a random unprivileged port.
241 def wait_port_listen(port, proto="tcp", ns=None, host=None, sleep=0.005, deadline=5):
244 pattern = f":{port:04X} .* "
255 raise Exception("Waiting for port listen timed out")
259 def wait_file(fname, test_fn, sleep=0.005, deadline=5, encoding='utf-8'):