@@ -842,11 +842,14 @@ def watermark():
842842 show_default = True ,
843843 help = 'Namespace name or all' ,
844844 callback = multi_asic_util .multi_asic_namespace_validation_callback )
845- def wm_q_uni (namespace ):
845+ @click .option ('--json' , '-j' , 'json_output' , is_flag = True , default = False , show_default = True , help = "Display JSON output" )
846+ def wm_q_uni (namespace , json_output ):
846847 """Show user WM for unicast queues"""
847848 command = ['watermarkstat' , '-t' , 'q_shared_uni' ]
848849 if namespace is not None :
849850 command += ['-n' , str (namespace )]
851+ if json_output :
852+ command += ["-j" ]
850853 run_command (command )
851854
852855# 'multicast' subcommand ("show queue watermarks multicast")
@@ -859,11 +862,14 @@ def wm_q_uni(namespace):
859862 show_default = True ,
860863 help = 'Namespace name or all' ,
861864 callback = multi_asic_util .multi_asic_namespace_validation_callback )
862- def wm_q_multi (namespace ):
865+ @click .option ('--json' , '-j' , 'json_output' , is_flag = True , default = False , show_default = True , help = "Display JSON output" )
866+ def wm_q_multi (namespace , json_output ):
863867 """Show user WM for multicast queues"""
864868 command = ['watermarkstat' , '-t' , 'q_shared_multi' ]
865869 if namespace is not None :
866870 command += ['-n' , str (namespace )]
871+ if json_output :
872+ command += ["-j" ]
867873 run_command (command )
868874
869875# 'all' subcommand ("show queue watermarks all")
@@ -876,11 +882,14 @@ def wm_q_multi(namespace):
876882 show_default = True ,
877883 help = 'Namespace name or all' ,
878884 callback = multi_asic_util .multi_asic_namespace_validation_callback )
879- def wm_q_all (namespace ):
885+ @click .option ('--json' , '-j' , 'json_output' , is_flag = True , default = False , show_default = True , help = "Display JSON output" )
886+ def wm_q_all (namespace , json_output ):
880887 """Show user WM for all queues"""
881888 command = ['watermarkstat' , '-t' , 'q_shared_all' ]
882889 if namespace is not None :
883890 command += ['-n' , str (namespace )]
891+ if json_output :
892+ command += ["-j" ]
884893 run_command (command )
885894
886895#
@@ -902,11 +911,14 @@ def persistent_watermark():
902911 show_default = True ,
903912 help = 'Namespace name or all' ,
904913 callback = multi_asic_util .multi_asic_namespace_validation_callback )
905- def pwm_q_uni (namespace ):
914+ @click .option ('--json' , '-j' , 'json_output' , is_flag = True , default = False , show_default = True , help = "Display JSON output" )
915+ def pwm_q_uni (namespace , json_output ):
906916 """Show persistent WM for unicast queues"""
907917 command = ['watermarkstat' , '-p' , '-t' , 'q_shared_uni' ]
908918 if namespace is not None :
909919 command += ['-n' , str (namespace )]
920+ if json_output :
921+ command += ["-j" ]
910922 run_command (command )
911923
912924# 'multicast' subcommand ("show queue persistent-watermarks multicast")
@@ -919,11 +931,14 @@ def pwm_q_uni(namespace):
919931 show_default = True ,
920932 help = 'Namespace name or all' ,
921933 callback = multi_asic_util .multi_asic_namespace_validation_callback )
922- def pwm_q_multi (namespace ):
934+ @click .option ('--json' , '-j' , 'json_output' , is_flag = True , default = False , show_default = True , help = "Display JSON output" )
935+ def pwm_q_multi (namespace , json_output ):
923936 """Show persistent WM for multicast queues"""
924937 command = ['watermarkstat' , '-p' , '-t' , 'q_shared_multi' ]
925938 if namespace is not None :
926939 command += ['-n' , str (namespace )]
940+ if json_output :
941+ command += ["-j" ]
927942 run_command (command )
928943
929944# 'all' subcommand ("show queue persistent-watermarks all")
@@ -936,11 +951,14 @@ def pwm_q_multi(namespace):
936951 show_default = True ,
937952 help = 'Namespace name or all' ,
938953 callback = multi_asic_util .multi_asic_namespace_validation_callback )
939- def pwm_q_all (namespace ):
954+ @click .option ('--json' , '-j' , 'json_output' , is_flag = True , default = False , show_default = True , help = "Display JSON output" )
955+ def pwm_q_all (namespace , json_output ):
940956 """Show persistent WM for all queues"""
941957 command = ['watermarkstat' , '-p' , '-t' , 'q_shared_all' ]
942958 if namespace is not None :
943959 command += ['-n' , str (namespace )]
960+ if json_output :
961+ command += ["-j" ]
944962 run_command (command )
945963
946964#
@@ -965,11 +983,14 @@ def watermark():
965983 show_default = True ,
966984 help = 'Namespace name or all' ,
967985 callback = multi_asic_util .multi_asic_namespace_validation_callback )
968- def wm_pg_headroom (namespace ):
986+ @click .option ('--json' , '-j' , 'json_output' , is_flag = True , default = False , show_default = True , help = "Display JSON output" )
987+ def wm_pg_headroom (namespace , json_output ):
969988 """Show user headroom WM for pg"""
970989 command = ['watermarkstat' , '-t' , 'pg_headroom' ]
971990 if namespace is not None :
972991 command += ['-n' , str (namespace )]
992+ if json_output :
993+ command += ["-j" ]
973994 run_command (command )
974995
975996@watermark .command ('shared' )
@@ -981,11 +1002,14 @@ def wm_pg_headroom(namespace):
9811002 show_default = True ,
9821003 help = 'Namespace name or all' ,
9831004 callback = multi_asic_util .multi_asic_namespace_validation_callback )
984- def wm_pg_shared (namespace ):
1005+ @click .option ('--json' , '-j' , 'json_output' , is_flag = True , default = False , show_default = True , help = "Display JSON output" )
1006+ def wm_pg_shared (namespace , json_output ):
9851007 """Show user shared WM for pg"""
9861008 command = ['watermarkstat' , '-t' , 'pg_shared' ]
9871009 if namespace is not None :
9881010 command += ['-n' , str (namespace )]
1011+ if json_output :
1012+ command += ["-j" ]
9891013 run_command (command )
9901014
9911015@priority_group .group ()
@@ -1016,11 +1040,14 @@ def persistent_watermark():
10161040 show_default = True ,
10171041 help = 'Namespace name or all' ,
10181042 callback = multi_asic_util .multi_asic_namespace_validation_callback )
1019- def pwm_pg_headroom (namespace ):
1043+ @click .option ('--json' , '-j' , 'json_output' , is_flag = True , default = False , show_default = True , help = "Display JSON output" )
1044+ def pwm_pg_headroom (namespace , json_output ):
10201045 """Show persistent headroom WM for pg"""
10211046 command = ['watermarkstat' , '-p' , '-t' , 'pg_headroom' ]
10221047 if namespace is not None :
10231048 command += ['-n' , str (namespace )]
1049+ if json_output :
1050+ command += ["-j" ]
10241051 run_command (command )
10251052
10261053
@@ -1033,11 +1060,14 @@ def pwm_pg_headroom(namespace):
10331060 show_default = True ,
10341061 help = 'Namespace name or all' ,
10351062 callback = multi_asic_util .multi_asic_namespace_validation_callback )
1036- def pwm_pg_shared (namespace ):
1063+ @click .option ('--json' , '-j' , 'json_output' , is_flag = True , default = False , show_default = True , help = "Display JSON output" )
1064+ def pwm_pg_shared (namespace , json_output ):
10371065 """Show persistent shared WM for pg"""
10381066 command = ['watermarkstat' , '-p' , '-t' , 'pg_shared' ]
10391067 if namespace is not None :
10401068 command += ['-n' , str (namespace )]
1069+ if json_output :
1070+ command += ["-j" ]
10411071 run_command (command )
10421072
10431073
0 commit comments