Skip to content

Commit

Permalink
PVST Feature commit (#3567)
Browse files Browse the repository at this point in the history
* PVST co pr commit

* PVST co pr commit

* Trigger Pipelines

* Fix for pre-commit

* Fix pre-commit failures

* fix pre-commit failures

* fix pre-commit failures

* fix pre-commit failures

* pre-commit fixes

* pre-commit fixes

* pre-commit fixes

* pre-commit fixes

* fix precommit failures

* fix precommit failures

* fix precommit failures

* fix precommit failures

* fix precommit failures

* fix precommit failures

* fix precommit failures

* fix precommit failures

* fix precommit failures

* Fix stp test failures

* Fix stp test failures

* Fix stp test failures

* fix precommit failures

* fix precommit failures

* fix precommit failures

* Fix stp test failures

* Fixing spacing errors in stp_test

* Fix stp test failures

* Fix stp test failures

* Fix stp test failures

* Fix stp test failures

* Fix stp test failures

* Fix stp test failures

* Remove svscode settings

* Addressed review comments

* Addressed review comments

* Addressed review comments

* Addressed review comments

* Fix test errors

* Fix test issues

* Fix test issues

* Fix test issues

* Fix test issues

* fix test failures

* fix test failures

* fix test failures

* fix test failures

* fix test failures

* fix test failures

* fix test failures

* fix test failures

* fix test failures

* fix test failures

* fix test failures

* fix test failures

* fix test failures

* Fix errors

* Fix errors

* Fix errors

* Fix errors

* Fix errors

* Fix errors

* Fix errors

* Fix errors

* Fix errors

* Fix failures

* Fix failures

* Fix failures

* Fix failures

* Fix failures

* Fix failures

* Fix errors

* Fix errors

* Fix errors

* Fix errors

* Fix errors

* fix errors

* fix errors

* Fix errors

* Fix errors

* Fix errors

* Fix errors

* Fix errors

* Fix errors

* Fix errors

* Fix errors

* Fix errors

* Fix errors

* Fix errors

* Fix errors

* Fix errors

* Fix errors

* Fix errors

* Fix errors

* Addressing review comments

* Addressing review comments

* Addressing review comments

* Addressing review comments

* Addressing review comments

* Addressing review comments

---------

Co-authored-by: Rida Hanif <rida.hanif@xflowresearch.com>
Co-authored-by: ridahanif96 <ridahanif958@gmail.com>
Co-authored-by: Wajahat Razi <wajahat37@gmail.com>
  • Loading branch information
4 people authored Nov 14, 2024
1 parent 0e18807 commit a8f7bde
Show file tree
Hide file tree
Showing 15 changed files with 2,003 additions and 5 deletions.
6 changes: 5 additions & 1 deletion clear/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from show.plugins.pbh import read_pbh_counters
from config.plugins.pbh import serialize_pbh_counters
from . import plugins

from . import stp
# This is from the aliases example:
# https://github.com/pallets/click/blob/57c6f09611fc47ca80db0bd010f05998b3c0aa95/examples/aliases/aliases.py
class Config(object):
Expand Down Expand Up @@ -145,6 +145,10 @@ def ipv6():
pass


# 'STP'
#
cli.add_command(stp.spanning_tree)

#
# Inserting BGP functionality into cli's clear parse-chain.
# BGP commands are determined by the routing-stack being elected.
Expand Down
46 changes: 46 additions & 0 deletions clear/stp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import click
import utilities_common.cli as clicommon

#
# This group houses Spanning_tree commands and subgroups
#


@click.group(cls=clicommon.AliasedGroup)
@click.pass_context
def spanning_tree(ctx):
'''Clear Spanning-tree counters'''
pass


@spanning_tree.group('statistics', cls=clicommon.AliasedGroup, invoke_without_command=True)
@click.pass_context
def stp_clr_stats(ctx):
if ctx.invoked_subcommand is None:
command = 'sudo stpctl clrstsall'
clicommon.run_command(command)


@stp_clr_stats.command('interface')
@click.argument('interface_name', metavar='<interface_name>', required=True)
@click.pass_context
def stp_clr_stats_intf(ctx, interface_name):
command = 'sudo stpctl clrstsintf ' + interface_name
clicommon.run_command(command)


@stp_clr_stats.command('vlan')
@click.argument('vlan_id', metavar='<vlan_id>', required=True)
@click.pass_context
def stp_clr_stats_vlan(ctx, vlan_id):
command = 'sudo stpctl clrstsvlan ' + vlan_id
clicommon.run_command(command)


@stp_clr_stats.command('vlan-interface')
@click.argument('vlan_id', metavar='<vlan_id>', required=True)
@click.argument('interface_name', metavar='<interface_name>', required=True)
@click.pass_context
def stp_clr_stats_vlan_intf(ctx, vlan_id, interface_name):
command = 'sudo stpctl clrstsvlanintf ' + vlan_id + ' ' + interface_name
clicommon.run_command(command)
7 changes: 5 additions & 2 deletions config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
from . import switchport
from . import dns
from . import bgp_cli

from . import stp

# mock masic APIs for unit test
try:
Expand Down Expand Up @@ -1434,7 +1434,10 @@ def config(ctx):
config.add_command(vlan.vlan)
config.add_command(vxlan.vxlan)

#add mclag commands
# add stp commands
config.add_command(stp.spanning_tree)

# add mclag commands
config.add_command(mclag.mclag)
config.add_command(mclag.mclag_member)
config.add_command(mclag.mclag_unique_ip)
Expand Down
Loading

0 comments on commit a8f7bde

Please sign in to comment.