diff options
Diffstat (limited to 'tools/net')
-rwxr-xr-x | tools/net/ynl/cli.py | 9 | ||||
-rw-r--r-- | tools/net/ynl/lib/ynl.py | 6 |
2 files changed, 11 insertions, 4 deletions
diff --git a/tools/net/ynl/cli.py b/tools/net/ynl/cli.py index 5c4eb5a68514..05d1f4069ce1 100755 --- a/tools/net/ynl/cli.py +++ b/tools/net/ynl/cli.py @@ -32,10 +32,11 @@ def main(): if args.sleep: time.sleep(args.sleep) - if args.do or args.dump: - method = getattr(ynl, args.do if args.do else args.dump) - - reply = method(attrs, dump=bool(args.dump)) + if args.do: + reply = ynl.do(args.do, attrs) + pprint.PrettyPrinter().pprint(reply) + if args.dump: + reply = ynl.dump(args.dump, attrs) pprint.PrettyPrinter().pprint(reply) if args.ntf: diff --git a/tools/net/ynl/lib/ynl.py b/tools/net/ynl/lib/ynl.py index 2ff3e6dbdbf6..1c7411ee04dc 100644 --- a/tools/net/ynl/lib/ynl.py +++ b/tools/net/ynl/lib/ynl.py @@ -520,3 +520,9 @@ class YnlFamily(SpecFamily): if not dump and len(rsp) == 1: return rsp[0] return rsp + + def do(self, method, vals): + return self._op(method, vals) + + def dump(self, method, vals): + return self._op(method, vals, dump=True) |