Skip to content
Merged
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
16 changes: 13 additions & 3 deletions config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1177,6 +1177,10 @@ def validate_mirror_session_config(config_db, session_name, dst_port, src_port,
mirror_table = config_db.get_table('MIRROR_SESSION')
portchannel_member_table = config_db.get_table('PORTCHANNEL_MEMBER')

# Determine namespaces to validate: always include None (single-ASIC/back-compat),
# and for multi-ASIC include namespaces for dst/src ports if present.
namespace_set = set()

if dst_port:
if not interface_name_is_valid(config_db, dst_port):
ctx.fail("Error: Destination Interface {} is invalid".format(dst_port))
Expand All @@ -1193,13 +1197,17 @@ def validate_mirror_session_config(config_db, session_name, dst_port, src_port,
if clicommon.is_port_router_interface(config_db, dst_port):
ctx.fail("Error: Destination Interface {} is a L3 interface".format(dst_port))

namespace_set.add(get_port_namespace(dst_port))

if src_port:
for port in src_port.split(","):
if not interface_name_is_valid(config_db, port):
ctx.fail("Error: Source Interface {} is invalid".format(port))
if dst_port and dst_port == port:
ctx.fail("Error: Destination Interface cant be same as Source Interface")

namespace_set.add(get_port_namespace(port))

if interface_has_mirror_config(ctx, mirror_table, dst_port, src_port, direction):
return False

Expand All @@ -1209,9 +1217,11 @@ def validate_mirror_session_config(config_db, session_name, dst_port, src_port,

# Check port mirror capability before allowing configuration
# If direction is provided, check the specific direction
if not is_port_mirror_capability_supported(direction):
ctx.fail("Error: Port mirror direction '{}' is not supported by the ASIC".format(
direction if direction else 'both'))

for ns in namespace_set:
if not is_port_mirror_capability_supported(direction, namespace=ns):
ctx.fail("Error: Port mirror direction '{}' is not supported by the ASIC".format(
direction if direction else 'both'))

return True

Expand Down
Loading