From ab832df4b459c7f7786d20ceffa2c8ac012d51c6 Mon Sep 17 00:00:00 2001 From: Antonin Bas Date: Thu, 27 Apr 2017 10:21:04 -0700 Subject: [PATCH] Fix mc_dump CLI command for SimplePre type (#343) The command implementation was correct for SimplePreLAG but not for SimplePre, as it assumed the existence of LAG entries in the JSON returned by the switch. This addresses issue #342. --- tools/runtime_CLI.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/runtime_CLI.py b/tools/runtime_CLI.py index 414b49ad0..0b94f740d 100755 --- a/tools/runtime_CLI.py +++ b/tools/runtime_CLI.py @@ -1616,9 +1616,12 @@ def do_mc_dump(self, line): print "==========" print "LAGS" - for lag in mc_json["lags"]: - print "lag({})".format(lag["id"]), - print "-> ports=[{}]".format(", ".join([str(p) for p in ports])) + if "lags" in mc_json: + for lag in mc_json["lags"]: + print "lag({})".format(lag["id"]), + print "-> ports=[{}]".format(", ".join([str(p) for p in ports])) + else: + print "None for this PRE type" print "==========" @handle_bad_input