Skip to content

Conversation

@divyachandralekha
Copy link
Contributor

@divyachandralekha divyachandralekha commented Nov 19, 2025

What I did
Added support to display MSTP output for "show spanning-tree" command
Fixed the issue on MSTP global enable command issue
Added testcases to cover mstp display command changes

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@divyachandralekha
Copy link
Contributor Author

@skulambi-cisco
Please review

@vganesan-nokia
Copy link
Contributor

@divyachandralekha, currently all the commands starting with "config spanning-tree mst instance" expects an entry for given instance already exists in STP_MST_INST table in config db. If an entry for the given instance does not already exist in config db, there is failure.
We would like to suggest to have a command to newly create an entry in "STP_MST_INST" table. We can use the command "config spanning-tree mst instance priority " to create an entry in STP_MST_INST table if one does not exist already before setting the priority.

@divyachandralekha
Copy link
Contributor Author

@divyachandralekha, currently all the commands starting with "config spanning-tree mst instance" expects an entry for given instance already exists in STP_MST_INST table in config db. If an entry for the given instance does not already exist in config db, there is failure. We would like to suggest to have a command to newly create an entry in "STP_MST_INST" table. We can use the command "config spanning-tree mst instance priority " to create an entry in STP_MST_INST table if one does not exist already before setting the priority.

@vganesan-nokia , This can be taken up as an enhancement. The current behaviour is intentional, as it prevents creating or consuming an MST instance without any VLAN mapping. This ensures that MST instances are only created when they have a valid purpose in the configuration.

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@divyachandralekha
Copy link
Contributor Author

@vganesan-nokia , Please approve the changes

vlan_str = mst_entry.get('vlan@', '')
vlan_list = format_vlan_list(vlan_str)
click.echo("")
click.echo("####### MST{:<8} Vlans mapped : {}".format(mst_id, vlan_list))
Copy link
Contributor

Choose a reason for hiding this comment

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

If the instance is 0 we can add the word (CIST) as propsed in the HLD

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will take care in next PR.

ctx.invoke(show_stp_vlan, vlanid=vlanid)
# For MSTP mode, use new format
if g_stp_mode == 'MSTP':
ctx.invoke(show_mstp_summary)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion for alternate approach:
If we can do this similar to how it is done for PVST we can show spanning tree for all MST instances and also for a specific instance (for "show spanning-tree mst instance command) using the same function show_mst_instnace_detail().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will take care in next PR.

show_mst_region_info()


def show_mst_instance_detail(mst_id):
Copy link
Contributor

@vganesan-nokia vganesan-nokia Nov 25, 2025

Choose a reason for hiding this comment

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

When I compare the implemented show output to the show information in HLD, I see that the information shown here is for the summary. i..e, the interface information is shown in single row for each interface. Should we rename this function to "show_mst_instance_summary()" to make the name approriately mean what is done in the function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will take care in next PR.

show_mst_port_info(mst_id, ifname)


def show_mst_port_info(mst_id, ifname):
Copy link
Contributor

Choose a reason for hiding this comment

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

We may need another function like "show_mst_port_info_detail()" which can be used for showing MST instance detail where the each port info is displayed in deatil (as per "show spanning-tree mst detail" info in the HLD)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will take care in next PR.

# CIST Root timers (typically same as bridge timers)
click.echo("CIST Root Timers : MaxAge {}s Hello {}s FwdDly {}s MaxHops {}".format(
mst_global['max_age'], mst_global['hello_time'],
mst_global['forward_delay'], mst_global['max_hops']))
Copy link
Contributor

Choose a reason for hiding this comment

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

Recommendation: It is better to implement the "show spanning-tree statistics [mst ]" as part of this PR. We already have some statistics (such as bpd rx, bpdu tx and num fwd transitions) in the STP_MST_PORT_TABLE entries. We can also implement "show spanning-tree mst interface " as part of the PR to meet all the show commands specified in HLD

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it seems the MSTP show commands are missed during implementation.
Currently I have enhanced the existing show command to verify the MSTP. Rest all show MSTP related changes will add in next PR.

assert result.exit_code != 0
assert "Invalid value" in result.output
assert "is not one of 'enable', 'disable'" in result.output
assert "choose from enable, disable" in result.output
Copy link
Contributor

Choose a reason for hiding this comment

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

A generic commnent not for this line.
We need unit test for the show commands impelemented in show/stp.py.

@vganesan-nokia
Copy link
Contributor

@divyachandralekha, currently all the commands starting with "config spanning-tree mst instance" expects an entry for given instance already exists in STP_MST_INST table in config db. If an entry for the given instance does not already exist in config db, there is failure. We would like to suggest to have a command to newly create an entry in "STP_MST_INST" table. We can use the command "config spanning-tree mst instance priority " to create an entry in STP_MST_INST table if one does not exist already before setting the priority.

@vganesan-nokia , This can be taken up as an enhancement. The current behaviour is intentional, as it prevents creating or consuming an MST instance without any VLAN mapping. This ensures that MST instances are only created when they have a valid purpose in the configuration.

@divyachandralekha, thanks for confirming that this is was intentional. Yes, we can do this as enhancement.

@vganesan-nokia
Copy link
Contributor

@vganesan-nokia , Please approve the changes

@divyachandralekha, I have some reivew comments for the show commands implementation. I think the show command code was added after I post my previous review comments.

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@divyachandralekha
Copy link
Contributor Author

@vganesan-nokia , All your review comments are noted. I will take care of those in next PR.

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

@vganesan-nokia vganesan-nokia left a comment

Choose a reason for hiding this comment

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

Thanks for respoinding to the review comments. Looking forward to the next PR.

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@divyachandralekha
Copy link
Contributor Author

@qiluo-msft , Please merge the changes

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.

3 participants