|
26 | 26 | VENDOR_NAME = "Credo"
|
27 | 27 | VENDOR_MODEL_REGEX = re.compile(r"CAC\w{3}321P2P\w{2}MS")
|
28 | 28 |
|
29 |
| - |
30 |
| -# |
31 | 29 | # 'muxcable' command ("show muxcable")
|
32 | 30 | #
|
33 | 31 |
|
@@ -129,9 +127,12 @@ def create_json_dump_per_port_config(port_status_dict, per_npu_configdb, asic_id
|
129 | 127 | @muxcable.command()
|
130 | 128 | @click.argument('port', required=False, default=None)
|
131 | 129 | @click.option('--json', 'json_output', required=False, is_flag=True, type=click.BOOL, help="display the output in json format")
|
132 |
| -def status(port, json_output): |
| 130 | +@clicommon.pass_db |
| 131 | +def status(db, port, json_output): |
133 | 132 | """Show muxcable status information"""
|
134 | 133 |
|
| 134 | + port = platform_sfputil_helper.get_interface_alias(port, db) |
| 135 | + |
135 | 136 | port_table_keys = {}
|
136 | 137 | port_health_table_keys = {}
|
137 | 138 | per_npu_statedb = {}
|
@@ -239,9 +240,12 @@ def status(port, json_output):
|
239 | 240 | @muxcable.command()
|
240 | 241 | @click.argument('port', required=False, default=None)
|
241 | 242 | @click.option('--json', 'json_output', required=False, is_flag=True, type=click.BOOL, help="display the output in json format")
|
242 |
| -def config(port, json_output): |
| 243 | +@clicommon.pass_db |
| 244 | +def config(db, port, json_output): |
243 | 245 | """Show muxcable config information"""
|
244 | 246 |
|
| 247 | + port = platform_sfputil_helper.get_interface_alias(port, db) |
| 248 | + |
245 | 249 | port_mux_tbl_keys = {}
|
246 | 250 | asic_start_idx = None
|
247 | 251 | per_npu_configdb = {}
|
@@ -407,9 +411,12 @@ def eyeinfo(port, target):
|
407 | 411 |
|
408 | 412 | @muxcable.command()
|
409 | 413 | @click.argument('port', required=True, default=None)
|
410 |
| -def cableinfo(port): |
| 414 | +@clicommon.pass_db |
| 415 | +def cableinfo(db, port): |
411 | 416 | """Show muxcable cable information"""
|
412 | 417 |
|
| 418 | + port = platform_sfputil_helper.get_interface_alias(port, db) |
| 419 | + |
413 | 420 | if platform_sfputil is not None:
|
414 | 421 | physical_port_list = platform_sfputil_helper.logical_port_name_to_physical_port_list(port)
|
415 | 422 |
|
@@ -444,9 +451,12 @@ def hwmode():
|
444 | 451 |
|
445 | 452 | @hwmode.command()
|
446 | 453 | @click.argument('port', metavar='<port_name>', required=False, default=None)
|
447 |
| -def muxdirection(port): |
| 454 | +@clicommon.pass_db |
| 455 | +def muxdirection(db, port): |
448 | 456 | """Shows the current direction of the muxcable {active/standy}"""
|
449 | 457 |
|
| 458 | + port = platform_sfputil_helper.get_interface_alias(port, db) |
| 459 | + |
450 | 460 | per_npu_statedb = {}
|
451 | 461 | transceiver_table_keys = {}
|
452 | 462 | transceiver_dict = {}
|
@@ -649,9 +659,11 @@ def muxdirection(port):
|
649 | 659 |
|
650 | 660 | @hwmode.command()
|
651 | 661 | @click.argument('port', metavar='<port_name>', required=False, default=None)
|
652 |
| -def switchmode(port): |
| 662 | +def switchmode(db, port): |
653 | 663 | """Shows the current switching mode of the muxcable {auto/manual}"""
|
654 | 664 |
|
| 665 | + port = platform_sfputil_helper.get_interface_alias(port, db) |
| 666 | + |
655 | 667 | per_npu_statedb = {}
|
656 | 668 | transceiver_dict = {}
|
657 | 669 |
|
@@ -848,9 +860,12 @@ def firmware():
|
848 | 860 | @firmware.command()
|
849 | 861 | @click.argument('port', metavar='<port_name>', required=True, default=None)
|
850 | 862 | @click.option('--active', 'active', required=False, is_flag=True, type=click.BOOL, help="display the firmware version of only active bank within MCU's")
|
851 |
| -def version(port, active): |
| 863 | +@clicommon.pass_db |
| 864 | +def version(db, port, active): |
852 | 865 | """Show muxcable firmware version"""
|
853 | 866 |
|
| 867 | + port = platform_sfputil_helper.get_interface_alias(port, db) |
| 868 | + |
854 | 869 | port_table_keys = {}
|
855 | 870 | y_cable_asic_table_keys = {}
|
856 | 871 | per_npu_statedb = {}
|
@@ -940,12 +955,16 @@ def version(port, active):
|
940 | 955 | else:
|
941 | 956 | click.echo("there is not a valid asic table for this asic_index".format(asic_index))
|
942 | 957 |
|
| 958 | + |
943 | 959 | @muxcable.command()
|
944 | 960 | @click.argument('port', metavar='<port_name>', required=True, default=None)
|
945 | 961 | @click.option('--json', 'json_output', required=False, is_flag=True, type=click.BOOL, help="display the output in json format")
|
946 |
| -def metrics(port, json_output): |
| 962 | +@clicommon.pass_db |
| 963 | +def metrics(db, port, json_output): |
947 | 964 | """Show muxcable metrics <port>"""
|
948 | 965 |
|
| 966 | + port = platform_sfputil_helper.get_interface_alias(port, db) |
| 967 | + |
949 | 968 | metrics_table_keys = {}
|
950 | 969 | per_npu_statedb = {}
|
951 | 970 | metrics_dict = {}
|
@@ -981,7 +1000,6 @@ def metrics(port, json_output):
|
981 | 1000 | if asic_index is None:
|
982 | 1001 | click.echo("Got invalid asic index for port {}, cant retreive mux status".format(port))
|
983 | 1002 |
|
984 |
| - |
985 | 1003 | metrics_dict[asic_index] = per_npu_statedb[asic_index].get_all(
|
986 | 1004 | per_npu_statedb[asic_index].STATE_DB, 'MUX_METRICS_TABLE|{}'.format(port))
|
987 | 1005 |
|
|
0 commit comments