Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import re


class Rule:
id = "310"
description = "Verify if interfaces with sub-levels are part of the defined interface breakouts"
severity = "HIGH"

# regex pattern: Ethernet[101-199]/1/[1-99]
IGNORE_FEX = re.compile(r'^(?:Ethernet)(?:(?:10[1-9]|1[1-9]\d)\/1\/([1-9]|[1-5][0-9])$)', re.IGNORECASE)

@classmethod
def match(cls, data_model):
# Reset results at the start of each call to avoid retaining previous results
Expand Down Expand Up @@ -33,6 +39,10 @@ def match(cls, data_model):
interface_name = interface.get("name", "")
normalized_interface = interface_name.lower().replace("ethernet", "e").replace("eth", "e")

# Check if it's a FEX interface - skip validation
if cls.IGNORE_FEX.match(interface_name):
continue

# Skip interfaces without sub-levels (e.g., E1/x)
if cls.has_sub_level(normalized_interface):
if not cls.is_interface_in_breakouts(normalized_interface, interface_breakouts):
Expand Down