Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
8647356
[show][config][plugin] add processing of ModuleNotFoundError with log…
maksym-kovalchuk Jul 21, 2025
3db35d5
`vnet_route_check.py` should not report VNET routes in APP DB but not…
mramezani95 Jul 22, 2025
809646a
Revert "Addition of prober_type in config and show commands for muxca…
wangxin Jul 22, 2025
e18640e
Switchport mode update for 'show interfaces status' (#3788)
cshivashgit Jul 22, 2025
036e4e6
[MSTP] CLI Support (#3848)
wajahatrazi Jul 24, 2025
3e3daf3
Exclude Smart Switch from modular chassis operations/checks (#3988)
tirupatihemanth Jul 31, 2025
252a643
[SPM] Rename the variable tag to docker-image-reference (#3998)
DavidZagury Jul 31, 2025
d86b2b6
g[sfputil debug] Fix issue: do not check output status when CMIS vers…
Junchao-Mellanox Aug 1, 2025
6f1a794
Add queuestat changes for aggregate VOQ counters (#3617)
vivekverma-arista Aug 1, 2025
3282ab3
DOM for flat memory transceiver modules (#3950)
az-pz Aug 1, 2025
d3bc688
CLI addition for PFC counters --history (#3778)
peterbailey-arista Aug 4, 2025
a3101ea
Fix for #23205 [Smartswitch] Issues caused due to introduction of the…
rameshraghupathy Aug 4, 2025
d623c25
[Mellanox][Smartswitch]Added dpu status output to dump (#3959)
gpunathilell Aug 4, 2025
c0838d7
CLI for Configuring PFC Historical Statistics (#3779)
peterbailey-arista Aug 5, 2025
ec01962
sfputil and sfpshow eeprom and DOM CLI enhancement to display data fo…
mihirpat1 Aug 5, 2025
1418f21
Added json support intfutil (#3906)
vikumarks Aug 6, 2025
5347757
Revert "[SPM] Rename the variable tag to docker-image-reference (#399…
yejianquan Aug 8, 2025
868189c
Pr json support queue and priority-group watermark and persistent-wat…
vikumarks Aug 8, 2025
50df9ea
Adapt 'show muxcable tunnel-route' for prefix route based mux neighbo…
manamand2020 Aug 8, 2025
01876d4
[trim]: Add Packet Trimming Drop Counters CLI
nazariig Jul 2, 2025
e9f23d8
[trim]: Handle review comments
nazariig Aug 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions clear/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,13 @@ def srv6counters():
command = ["srv6stat", "-c"]
run_command(command)


@cli.command()
def switchcounters():
"""Clear switch counters"""
command = ["switchstat", "-c"]
run_command(command)

#
# 'clear watermarks
#
Expand Down
21 changes: 20 additions & 1 deletion config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3125,10 +3125,11 @@ def pfcwd():
@pfcwd.command()
@click.option('--action', '-a', type=click.Choice(['drop', 'forward', 'alert']))
@click.option('--restoration-time', '-r', type=click.IntRange(100, 60000))
@click.option('--pfc-stat-history', is_flag=True, help="Enable historical statistics tracking")
@click.option('--verbose', is_flag=True, help="Enable verbose output")
@click.argument('ports', nargs=-1)
@click.argument('detection-time', type=click.IntRange(100, 5000))
def start(action, restoration_time, ports, detection_time, verbose):
def start(action, restoration_time, pfc_stat_history, ports, detection_time, verbose):
"""
Start PFC watchdog on port(s). To config all ports, use all as input.

Expand All @@ -3150,6 +3151,9 @@ def start(action, restoration_time, ports, detection_time, verbose):
if restoration_time:
cmd += ['--restoration-time', str(restoration_time)]

if pfc_stat_history:
cmd += ['--pfc-stat-history']

clicommon.run_command(cmd, display_cmd=verbose)

@pfcwd.command()
Expand Down Expand Up @@ -3191,6 +3195,21 @@ def big_red_switch(big_red_switch, verbose):

clicommon.run_command(cmd, display_cmd=verbose)


@pfcwd.command('pfc_stat_history')
@click.option('--verbose', is_flag=True, help="Enable verbose output")
@click.argument('pfc_stat_history', type=click.Choice(['enable', 'disable']))
@click.argument('ports', nargs=-1)
def pfc_stat_history(ports, pfc_stat_history, verbose):
""" Enable/disable PFC Historical Statistics mode on ports"""

cmd = ['pfcwd', 'pfc_stat_history', pfc_stat_history]
ports = set(ports) - set(['ports'])
cmd += list(ports)

clicommon.run_command(cmd, display_cmd=verbose)


@pfcwd.command('start_default')
@click.option('--verbose', is_flag=True, help="Enable verbose output")
def start_default(verbose):
Expand Down
114 changes: 5 additions & 109 deletions config/muxcable.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,52 +277,14 @@ def lookup_statedb_and_update_configdb(db, per_npu_statedb, config_db, port, sta
port_status_dict[port_name] = 'OK'

def update_configdb_pck_loss_data(config_db, port, val):
fvs = {}
configdb_state = get_value_for_key_in_config_tbl(config_db, port, "state", "MUX_CABLE")
fvs["state"] = configdb_state
ipv4_value = get_value_for_key_in_config_tbl(config_db, port, "server_ipv4", "MUX_CABLE")
fvs["server_ipv4"] = ipv4_value
ipv6_value = get_value_for_key_in_config_tbl(config_db, port, "server_ipv6", "MUX_CABLE")
fvs["server_ipv6"] = ipv6_value
soc_ipv4_value = get_optional_value_for_key_in_config_tbl(config_db, port, "soc_ipv4", "MUX_CABLE")
if soc_ipv4_value is not None:
fvs["soc_ipv4"] = soc_ipv4_value
cable_type = get_optional_value_for_key_in_config_tbl(config_db, port, "cable_type", "MUX_CABLE")
if cable_type is not None:
fvs["cable_type"] = cable_type
prober_type_val = get_optional_value_for_key_in_config_tbl(config_db, port, "prober_type", "MUX_CABLE")
if prober_type_val is not None:
fvs["prober_type"] = prober_type_val

fvs["pck_loss_data_reset"] = val
try:
config_db.set_entry("MUX_CABLE", port, fvs)
except ValueError as e:
ctx = click.get_current_context()
ctx.fail("Invalid ConfigDB. Error: {}".format(e))


def update_configdb_prober_type(config_db, port, val):
fvs = {}
configdb_state = get_value_for_key_in_config_tbl(config_db, port, "state", "MUX_CABLE")
fvs["state"] = configdb_state
ipv4_value = get_value_for_key_in_config_tbl(config_db, port, "server_ipv4", "MUX_CABLE")
fvs["server_ipv4"] = ipv4_value
ipv6_value = get_value_for_key_in_config_tbl(config_db, port, "server_ipv6", "MUX_CABLE")
fvs["server_ipv6"] = ipv6_value
soc_ipv4_value = get_optional_value_for_key_in_config_tbl(config_db, port, "soc_ipv4", "MUX_CABLE")
if soc_ipv4_value is not None:
fvs["soc_ipv4"] = soc_ipv4_value
cable_type = get_optional_value_for_key_in_config_tbl(config_db, port, "cable_type", "MUX_CABLE")
if cable_type is not None:
fvs["cable_type"] = cable_type
pck_loss_data = get_optional_value_for_key_in_config_tbl(config_db, port, "pck_loss_data_reset", "MUX_CABLE")
if pck_loss_data is not None:
fvs["pck_loss_data_reset"] = pck_loss_data

fvs["prober_type"] = val
try:
config_db.set_entry("MUX_CABLE", port, fvs)
config_db.set_entry("MUX_CABLE", port, {"state": configdb_state,
"server_ipv4": ipv4_value, "server_ipv6": ipv6_value,
"pck_loss_data_reset": val})
except ValueError as e:
ctx = click.get_current_context()
ctx.fail("Invalid ConfigDB. Error: {}".format(e))
Expand Down Expand Up @@ -419,73 +381,6 @@ def mode(db, state, port, json_output):
sys.exit(CONFIG_SUCCESSFUL)


# 'muxcable' command ("config muxcable probertype hardware/software <port|all>")
@muxcable.command()
@click.argument('probertype', metavar='<operation_status>', required=True, type=click.Choice(["hardware", "software"]))
@click.argument('port', metavar='<port_name>', required=True, default=None)
@clicommon.pass_db
def probertype(db, probertype, port):
"""Config muxcable probertype"""

port = platform_sfputil_helper.get_interface_name(port, db)

port_table_keys = {}
y_cable_asic_table_keys = {}
per_npu_configdb = {}
per_npu_statedb = {}

# Getting all front asic namespace and correspding config and state DB connector

namespaces = multi_asic.get_front_end_namespaces()
for namespace in namespaces:
asic_id = multi_asic.get_asic_index_from_namespace(namespace)
# replace these with correct macros
per_npu_configdb[asic_id] = ConfigDBConnector(use_unix_socket_path=True, namespace=namespace)
per_npu_configdb[asic_id].connect()
per_npu_statedb[asic_id] = SonicV2Connector(use_unix_socket_path=True, namespace=namespace)
per_npu_statedb[asic_id].connect(per_npu_statedb[asic_id].STATE_DB)

port_table_keys[asic_id] = per_npu_statedb[asic_id].keys(
per_npu_statedb[asic_id].STATE_DB, 'MUX_CABLE_TABLE|*')

if port is not None and port != "all":

asic_index = None
if platform_sfputil is not None:
asic_index = platform_sfputil.get_asic_id_for_logical_port(port)
if asic_index is None:
# TODO this import is only for unit test purposes, and should be removed once sonic_platform_base
# is fully mocked
import sonic_platform_base.sonic_sfp.sfputilhelper
asic_index = sonic_platform_base.sonic_sfp.sfputilhelper.SfpUtilHelper().get_asic_id_for_logical_port(port)
if asic_index is None:
click.echo("Got invalid asic index for port {}, cant retreive mux status".format(port))
sys.exit(CONFIG_FAIL)

if per_npu_statedb[asic_index] is not None:
y_cable_asic_table_keys = port_table_keys[asic_index]
logical_key = "MUX_CABLE_TABLE|{}".format(port)
if logical_key in y_cable_asic_table_keys:
update_configdb_prober_type(per_npu_configdb[asic_index], port, probertype)
sys.exit(CONFIG_SUCCESSFUL)
else:
click.echo("this is not a valid port {} present on mux_cable".format(port))
sys.exit(CONFIG_FAIL)
else:
click.echo("there is not a valid asic asic-{} table for this asic_index".format(asic_index))
sys.exit(CONFIG_FAIL)

elif port == "all" and port is not None:

for namespace in namespaces:
asic_id = multi_asic.get_asic_index_from_namespace(namespace)
for key in port_table_keys[asic_id]:
logical_port = key.split("|")[1]
update_configdb_prober_type(per_npu_configdb[asic_id], logical_port, probertype)

sys.exit(CONFIG_SUCCESSFUL)


# 'muxcable' command ("config muxcable kill-radv <enable|disable> ")
@muxcable.command(short_help="Kill radv service when it is meant to be stopped, so no good-bye packet is sent for ceasing To Be an Advertising Interface")
@click.argument('knob', metavar='<feature_knob>', required=True, type=click.Choice(["enable", "disable"]))
Expand All @@ -501,7 +396,8 @@ def kill_radv(db, knob):
mux_lmgrd_cfg_tbl = config_db.get_table("MUX_LINKMGR")
config_db.mod_entry("MUX_LINKMGR", "SERVICE_MGMT", {"kill_radv": "True" if knob == "enable" else "False"})

# 'muxcable' command ("config muxcable packetloss reset <port|all>")

#'muxcable' command ("config muxcable packetloss reset <port|all>")
@muxcable.command()
@click.argument('action', metavar='<action_name>', required=True, type=click.Choice(["reset"]))
@click.argument('port', metavar='<port_name>', required=True, default=None)
Expand Down
Loading
Loading