Skip to content

Commit 2de4355

Browse files
committed
STP PR - Fixed lgtm warnings
1 parent 76386b1 commit 2de4355

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

debug/stp.py

+14-15
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,48 @@
11
import click
2-
from debug.main import AliasedGroup,cli
3-
from debug.main import run_command
2+
import utilities_common.cli as clicommon
43

54
#
65
# This group houses Spanning_tree commands and subgroups
76
#
8-
@cli.group(cls=AliasedGroup, default_if_no_args=False, invoke_without_command=True)
7+
@click.group(cls=clicommon.AliasedGroup, default_if_no_args=False, invoke_without_command=True)
98
@click.pass_context
109
def spanning_tree(ctx):
1110
'''debug spanning_tree commands'''
1211
if ctx.invoked_subcommand is None:
1312
command = 'sudo stpctl dbg enable'
14-
run_command(command)
13+
clicommon.run_command(command)
1514

16-
@spanning_tree.group('dump', cls=AliasedGroup, default_if_no_args=False, invoke_without_command=True)
15+
@spanning_tree.group('dump', cls=clicommon.AliasedGroup, default_if_no_args=False, invoke_without_command=True)
1716
def stp_debug_dump():
1817
pass
1918

2019
@stp_debug_dump.command('global')
2120
def stp_debug_dump_global():
2221
command = 'sudo stpctl global'
23-
run_command(command)
22+
clicommon.run_command(command)
2423

2524
@stp_debug_dump.command('vlan')
2625
@click.argument('vlan_id', metavar='<vlan_id>', required=True)
2726
def stp_debug_dump_vlan(vlan_id):
2827
command = 'sudo stpctl vlan ' + vlan_id
29-
run_command(command)
28+
clicommon.run_command(command)
3029

3130
@stp_debug_dump.command('interface')
3231
@click.argument('vlan_id', metavar='<vlan_id>', required=True)
3332
@click.argument('interface_name', metavar='<interface_name>', required=True)
3433
def stp_debug_dump_vlan_intf(vlan_id, interface_name):
3534
command = 'sudo stpctl port ' + vlan_id + " " + interface_name
36-
run_command(command)
35+
clicommon.run_command(command)
3736

3837
@spanning_tree.command('show')
3938
def stp_debug_show():
4039
command = 'sudo stpctl dbg show'
41-
run_command(command)
40+
clicommon.run_command(command)
4241

4342
@spanning_tree.command('reset')
4443
def stp_debug_reset():
4544
command = 'sudo stpctl dbg disable'
46-
run_command(command)
45+
clicommon.run_command(command)
4746

4847
@spanning_tree.command('bpdu')
4948
@click.argument('mode', metavar='{rx|tx}', required=False)
@@ -63,7 +62,7 @@ def stp_debug_bpdu(mode, disable):
6362
command = 'sudo stpctl dbg bpdu tx-on'
6463
else:
6564
command = 'sudo stpctl dbg bpdu on'
66-
run_command(command)
65+
clicommon.run_command(command)
6766

6867
@spanning_tree.command('verbose')
6968
@click.option('-d', '--disable', is_flag=True)
@@ -72,7 +71,7 @@ def stp_debug_verbose(disable):
7271
command = 'sudo stpctl dbg verbose off'
7372
else:
7473
command = 'sudo stpctl dbg verbose on'
75-
run_command(command)
74+
clicommon.run_command(command)
7675

7776
@spanning_tree.command('event')
7877
@click.option('-d', '--disable', is_flag=True)
@@ -81,7 +80,7 @@ def stp_debug_event(disable):
8180
command = 'sudo stpctl dbg event off'
8281
else:
8382
command = 'sudo stpctl dbg event on'
84-
run_command(command)
83+
clicommon.run_command(command)
8584

8685
@spanning_tree.command('vlan')
8786
@click.argument('vlan_id', metavar='<vlan_id/all>', required=True)
@@ -91,7 +90,7 @@ def stp_debug_vlan(vlan_id, disable):
9190
command = 'sudo stpctl dbg vlan ' + vlan_id + ' off'
9291
else:
9392
command = 'sudo stpctl dbg vlan ' + vlan_id + ' on'
94-
run_command(command)
93+
clicommon.run_command(command)
9594

9695
@spanning_tree.command('interface')
9796
@click.argument('interface_name', metavar='<interface_name/all>', required=True)
@@ -101,6 +100,6 @@ def stp_debug_intf(interface_name, disable):
101100
command = 'sudo stpctl dbg port ' + interface_name + ' off'
102101
else:
103102
command = 'sudo stpctl dbg port ' + interface_name + ' on'
104-
run_command(command)
103+
clicommon.run_command(command)
105104

106105

show/stp.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import re
22
import click
3-
import subprocess
43
import utilities_common.cli as clicommon
54
from swsscommon.swsscommon import SonicV2Connector, ConfigDBConnector
65

0 commit comments

Comments
 (0)