Skip to content

Conversation

@jbemmel
Copy link
Collaborator

@jbemmel jbemmel commented Nov 18, 2025

Fixes #2820

Copy link
Owner

@ipspace ipspace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be made much simpler. Also, isn't stp.protocol already copied into node data?

Get the effective STP protocol for a node, following the hierarchy:
node-level override → topology-level → default 'stp'
"""
def get_effective_stp_protocol(node: Box, topology: Box) -> str:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have "modules.get_effective_module_attribute" function to get this job done (assuming you need it)

Admittedly, you'd have to add "or 'stp'" at the end as it can return None.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I remembered (I asked it for similar patterns and it found the vlan module with interface - link - node - topology hierarchy)

Obviously this was just a toy experiment - I highly recommend to look into Cursor, this project is well suited to AI supported coding

features = devices.get_device_features(node,topology.defaults)

protocol = topology.get("stp.protocol","stp")
protocol = get_effective_stp_protocol(node,topology)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be easier to make "stp.protocol" inheritable? Then it would be copied into the node automatically.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI found the missing copy:, will that do it?

I’ll look for the simpler way

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] STP Node-Level Protocol Override Not Validated

2 participants