Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

internal [DEBUG][202205] Add debug logs to the dualtor_neighbor_check.py script #24

Closed
Closed
Changes from all commits
Commits
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
20 changes: 10 additions & 10 deletions scripts/dualtor_neighbor_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,14 +278,14 @@ def config_logging(args):

def run_command(cmd):
"""Runs a command and returns its output."""
WRITE_LOG_DEBUG("Running command: %s", cmd)
WRITE_LOG_WARN("Running command: %s", cmd)
try:
p = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
(output, _) = p.communicate()
except Exception as details:
raise RuntimeError("Failed to run command: %s", details)
WRITE_LOG_DEBUG("Command output: %s", output)
WRITE_LOG_DEBUG("Command return code: %s", p.returncode)
WRITE_LOG_WARN("Command output: %s", output)
WRITE_LOG_WARN("Command return code: %s", p.returncode)
if p.returncode != 0:
raise RuntimeError("Command failed with return code %s: %s" % (p.returncode, output))
return output.decode()
Expand Down Expand Up @@ -321,12 +321,12 @@ def read_tables_from_db(appl_db):
asic_fdb = {k: v.lstrip("oid:0x") for k, v in tables["asic_fdb"].items()}
asic_route_table = tables["asic_route_table"]
asic_neigh_table = tables["asic_neigh_table"]
WRITE_LOG_DEBUG("neighbors: %s", json.dumps(neighbors, indent=4))
WRITE_LOG_DEBUG("mux states: %s", json.dumps(mux_states, indent=4))
WRITE_LOG_DEBUG("hw mux states: %s", json.dumps(hw_mux_states, indent=4))
WRITE_LOG_DEBUG("ASIC FDB: %s", json.dumps(asic_fdb, indent=4))
WRITE_LOG_DEBUG("ASIC route table: %s", json.dumps(asic_route_table, indent=4))
WRITE_LOG_DEBUG("ASIC neigh table: %s", json.dumps(asic_neigh_table, indent=4))
WRITE_LOG_WARN("neighbors: %s", json.dumps(neighbors, indent=4))
WRITE_LOG_WARN("mux states: %s", json.dumps(mux_states, indent=4))
WRITE_LOG_WARN("hw mux states: %s", json.dumps(hw_mux_states, indent=4))
WRITE_LOG_WARN("ASIC FDB: %s", json.dumps(asic_fdb, indent=4))
WRITE_LOG_WARN("ASIC route table: %s", json.dumps(asic_route_table, indent=4))
WRITE_LOG_WARN("ASIC neigh table: %s", json.dumps(asic_neigh_table, indent=4))
return neighbors, mux_states, hw_mux_states, asic_fdb, asic_route_table, asic_neigh_table


Expand Down Expand Up @@ -482,7 +482,7 @@ def parse_check_results(check_results):
mux_cables = get_mux_cable_config(config_db)

if not is_dualtor(config_db) or not mux_cables:
WRITE_LOG_DEBUG("Not a valid dualtor setup, skip the check.")
WRITE_LOG_WARN("Not a valid dualtor setup, skip the check.")
sys.exit(0)

mux_server_to_port_map = get_mux_server_to_port_map(mux_cables)
Expand Down
Loading