1
1
import click
2
- from debug .main import AliasedGroup ,cli
3
- from debug .main import run_command
2
+ import utilities_common .cli as clicommon
4
3
5
4
#
6
5
# This group houses Spanning_tree commands and subgroups
7
6
#
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 )
9
8
@click .pass_context
10
9
def spanning_tree (ctx ):
11
10
'''debug spanning_tree commands'''
12
11
if ctx .invoked_subcommand is None :
13
12
command = 'sudo stpctl dbg enable'
14
- run_command (command )
13
+ clicommon . run_command (command )
15
14
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 )
17
16
def stp_debug_dump ():
18
17
pass
19
18
20
19
@stp_debug_dump .command ('global' )
21
20
def stp_debug_dump_global ():
22
21
command = 'sudo stpctl global'
23
- run_command (command )
22
+ clicommon . run_command (command )
24
23
25
24
@stp_debug_dump .command ('vlan' )
26
25
@click .argument ('vlan_id' , metavar = '<vlan_id>' , required = True )
27
26
def stp_debug_dump_vlan (vlan_id ):
28
27
command = 'sudo stpctl vlan ' + vlan_id
29
- run_command (command )
28
+ clicommon . run_command (command )
30
29
31
30
@stp_debug_dump .command ('interface' )
32
31
@click .argument ('vlan_id' , metavar = '<vlan_id>' , required = True )
33
32
@click .argument ('interface_name' , metavar = '<interface_name>' , required = True )
34
33
def stp_debug_dump_vlan_intf (vlan_id , interface_name ):
35
34
command = 'sudo stpctl port ' + vlan_id + " " + interface_name
36
- run_command (command )
35
+ clicommon . run_command (command )
37
36
38
37
@spanning_tree .command ('show' )
39
38
def stp_debug_show ():
40
39
command = 'sudo stpctl dbg show'
41
- run_command (command )
40
+ clicommon . run_command (command )
42
41
43
42
@spanning_tree .command ('reset' )
44
43
def stp_debug_reset ():
45
44
command = 'sudo stpctl dbg disable'
46
- run_command (command )
45
+ clicommon . run_command (command )
47
46
48
47
@spanning_tree .command ('bpdu' )
49
48
@click .argument ('mode' , metavar = '{rx|tx}' , required = False )
@@ -63,7 +62,7 @@ def stp_debug_bpdu(mode, disable):
63
62
command = 'sudo stpctl dbg bpdu tx-on'
64
63
else :
65
64
command = 'sudo stpctl dbg bpdu on'
66
- run_command (command )
65
+ clicommon . run_command (command )
67
66
68
67
@spanning_tree .command ('verbose' )
69
68
@click .option ('-d' , '--disable' , is_flag = True )
@@ -72,7 +71,7 @@ def stp_debug_verbose(disable):
72
71
command = 'sudo stpctl dbg verbose off'
73
72
else :
74
73
command = 'sudo stpctl dbg verbose on'
75
- run_command (command )
74
+ clicommon . run_command (command )
76
75
77
76
@spanning_tree .command ('event' )
78
77
@click .option ('-d' , '--disable' , is_flag = True )
@@ -81,7 +80,7 @@ def stp_debug_event(disable):
81
80
command = 'sudo stpctl dbg event off'
82
81
else :
83
82
command = 'sudo stpctl dbg event on'
84
- run_command (command )
83
+ clicommon . run_command (command )
85
84
86
85
@spanning_tree .command ('vlan' )
87
86
@click .argument ('vlan_id' , metavar = '<vlan_id/all>' , required = True )
@@ -91,7 +90,7 @@ def stp_debug_vlan(vlan_id, disable):
91
90
command = 'sudo stpctl dbg vlan ' + vlan_id + ' off'
92
91
else :
93
92
command = 'sudo stpctl dbg vlan ' + vlan_id + ' on'
94
- run_command (command )
93
+ clicommon . run_command (command )
95
94
96
95
@spanning_tree .command ('interface' )
97
96
@click .argument ('interface_name' , metavar = '<interface_name/all>' , required = True )
@@ -101,6 +100,6 @@ def stp_debug_intf(interface_name, disable):
101
100
command = 'sudo stpctl dbg port ' + interface_name + ' off'
102
101
else :
103
102
command = 'sudo stpctl dbg port ' + interface_name + ' on'
104
- run_command (command )
103
+ clicommon . run_command (command )
105
104
106
105
0 commit comments