Lines Matching +full:json +full:- +full:schema
7 # June 1991 as shown in the file COPYING in the top-level directory of this
20 import json
50 log_level -= sub
113 stdout = stdout.decode("utf-8")
114 stderr = stderr.decode("utf-8")
119 if stderr[-1] == "\n":
120 stderr = stderr[:-1]
129 if len(stderr) > 0 and stderr[-1] == "\n":
130 stderr = stderr[:-1]
139 cmd("rm -f %s" % (f))
143 def tool(name, args, flags, JSON=True, ns="", fail=True, include_stderr=False): argument
145 if JSON:
146 params += "%s " % (flags["json"])
158 if JSON and len(stdout.strip()) != 0:
159 out = json.loads(stdout)
168 def bpftool(args, JSON=True, ns="", fail=True, include_stderr=False): argument
169 return tool("bpftool", args, {"json":"-p"}, JSON=JSON, ns=ns,
173 _, progs = bpftool("prog show", JSON=True, ns=ns, fail=True)
185 _, maps = bpftool("map show", JSON=True, ns=ns, fail=True)
225 def ip(args, force=False, JSON=True, ns="", fail=True, include_stderr=False): argument
227 args = "-force " + args
228 return tool("ip", args, {"json":"-j"}, JSON=JSON, ns=ns,
231 def tc(args, JSON=True, ns="", fail=True, include_stderr=False): argument
232 return tool("tc", args, {"json":"-p"}, JSON=JSON, ns=ns,
346 log("WRITE %s: %r" % (fullpath, val), -e.errno)
430 # In case udev renamed the netdev to according to new schema,
477 def set_xdp(self, bpf, mode, force=False, JSON=True, verbose=False, argument
482 force=force, JSON=JSON,
485 def unset_xdp(self, mode, force=False, JSON=True, argument
488 force=force, JSON=JSON,
514 # No JSON support, oh well...
518 args = "-s filter show dev %s ingress" % (self['ifname'])
519 _, out = tc(args, JSON=False)
581 args = "hw-tc-offload %s" % ("on" if enable else "off")
582 return ethtool(self, "-K", args, fail=fail)
591 cmd("rm -f %s" % (f))
617 fail(err["error"].find("No such device") == -1,
624 fail(err["error"].find("No such device") == -1,
692 start_test("Test multi-attachment XDP - %s + offload..." %
712 start_test("Test multi-attachment XDP - replace...")
714 fail(ret == 0, "Replaced one of programs without -force")
717 start_test("Test multi-attachment XDP - remove without mode...")
736 start_test("Test multi-attachment XDP - reattach...")
744 start_test("Test multi-attachment XDP - device remove...")
754 parser.add_argument("--log", help="output verbose log to given file")
758 logfile.write("# -*-Org-*-")
783 if out.find("/sys/kernel/debug type debugfs") == -1:
784 cmd("mount -t debugfs none /sys/kernel/debug")
796 if err.find("Error: Failed to find qdisc with specified handle.") == -1:
822 start_test("Test TC non-offloaded...")
826 start_test("Test TC non-offloaded isn't getting bound...")
872 start_test("Test non-0 chain offload...")
942 start_test("Test TC offload is device-bound...")
992 fail(ret == 0, "Replaced XDP program without -force")
997 fail(ret != 0, "Could not replace XDP program with -force")
1004 "Device parameters reported for non-offloaded program")
1027 start_test("Test non-offload XDP attaching to HW...")
1032 fail(ret == 0, "attached non-offloaded XDP program to HW")
1033 check_extack_nsim(err, "xdpoffload of non-bound program.", args)
1160 time_diff = end - start
1176 sim.set_xdp(map_obj, "offload", JSON=False) # map fixup msg breaks JSON
1208 sim.set_xdp(map_obj, "offload", JSON=False) # map fixup msg breaks JSON
1233 fail(ret == 0, "updated non-existing key")
1234 fail(err["error"].find("No such file or directory") == -1,
1244 fail(err["error"].find("File exists") == -1,
1268 fail(err["error"].find("No such file or directory") == -1,
1280 fail(err["error"].find("No such file or directory") == -1,
1290 sim.set_xdp(map_obj, "offload", JSON=False) # map fixup msg breaks JSON
1298 ret, _ = sim.set_xdp(map_obj, "offload", JSON=False, fail=False)
1304 start_test("Test multi-dev ASIC program reuse...")
1319 simA.set_xdp(progA, "offload", JSON=False)
1321 d.set_xdp(progB, "offload", JSON=False)
1323 start_test("Test multi-dev ASIC cross-dev replace...")
1324 ret, _ = simA.set_xdp(progB, "offload", force=True, JSON=False, fail=False)
1325 fail(ret == 0, "cross-ASIC program allowed")
1327 ret, _ = d.set_xdp(progA, "offload", force=True, JSON=False, fail=False)
1328 fail(ret == 0, "cross-ASIC program allowed")
1330 start_test("Test multi-dev ASIC cross-dev install...")
1334 ret, _, err = simA.set_xdp(progB, "offload", force=True, JSON=False,
1336 fail(ret == 0, "cross-ASIC program allowed")
1339 ret, _, err = d.set_xdp(progA, "offload", force=True, JSON=False,
1341 fail(ret == 0, "cross-ASIC program allowed")
1344 start_test("Test multi-dev ASIC cross-dev map reuse...")
1362 "error message missing for cross-ASIC map")
1370 "error message missing for cross-ASIC map")
1372 start_test("Test multi-dev ASIC cross-dev destruction...")
1383 start_test("Test multi-dev ASIC cross-dev destruction - move...")
1396 start_test("Test multi-dev ASIC cross-dev destruction - orphaned...")