11import click
2- from clear .main import *
2+ from clear .main import ipv6 , run_command
33
44
55###############################################################################
99###############################################################################
1010
1111
12- @ipv6 .group (cls = AliasedGroup , default_if_no_args = True ,
13- context_settings = CONTEXT_SETTINGS )
12+ @ipv6 .group ()
1413def bgp ():
1514 """Clear IPv6 BGP (Border Gateway Protocol) information"""
1615 pass
1716
18-
19- # Default 'bgp' command (called if no subcommands or their aliases were passed)
20- @bgp .command (default = True )
21- def default ():
22- """Clear all BGP peers"""
23- command = 'sudo vtysh -c "clear bgp ipv6 *"'
24- run_command (command )
25-
26-
27- @bgp .group (cls = AliasedGroup , default_if_no_args = True ,
28- context_settings = CONTEXT_SETTINGS )
17+ @bgp .group ()
2918def neighbor ():
3019 """Clear specific BGP peers"""
3120 pass
3221
33-
34- @neighbor .command (default = True )
22+ # 'all' subcommand
23+ @neighbor .command ('all' )
3524@click .argument ('ipaddress' , required = False )
36- def default (ipaddress ):
25+ def neigh_all (ipaddress ):
3726 """Clear all BGP peers"""
3827
3928 if ipaddress is not None :
40- command = 'sudo vtysh -c "clear bgp ipv6 {} "' .format (ipaddress )
29+ command = 'sudo vtysh -c "clear bgp ipv6 {}"' .format (ipaddress )
4130 else :
4231 command = 'sudo vtysh -c "clear bgp ipv6 *"'
4332 run_command (command )
4433
45-
4634# 'in' subcommand
4735@neighbor .command ('in' )
4836@click .argument ('ipaddress' , required = False )
@@ -69,25 +57,11 @@ def neigh_out(ipaddress):
6957 run_command (command )
7058
7159
72- @neighbor .group (cls = AliasedGroup , default_if_no_args = True ,
73- context_settings = CONTEXT_SETTINGS )
60+ @neighbor .group ()
7461def soft ():
7562 """Soft reconfig BGP's inbound/outbound updates"""
7663 pass
7764
78-
79- @soft .command (default = True )
80- @click .argument ('ipaddress' , required = False )
81- def default (ipaddress ):
82- """Clear BGP neighbors soft configuration"""
83-
84- if ipaddress is not None :
85- command = 'sudo vtysh -c "clear bgp ipv6 {} soft "' .format (ipaddress )
86- else :
87- command = 'sudo vtysh -c "clear bgp ipv6 * soft"'
88- run_command (command )
89-
90-
9165# 'soft in' subcommand
9266@soft .command ('in' )
9367@click .argument ('ipaddress' , required = False )
@@ -101,6 +75,18 @@ def soft_in(ipaddress):
10175 run_command (command )
10276
10377
78+ # 'soft all' subcommand
79+ @neighbor .command ('all' )
80+ @click .argument ('ipaddress' , required = False )
81+ def soft_all (ipaddress ):
82+ """Clear BGP neighbors soft configuration"""
83+
84+ if ipaddress is not None :
85+ command = 'sudo vtysh -c "clear bgp ipv6 {} soft"' .format (ipaddress )
86+ else :
87+ command = 'sudo vtysh -c "clear bgp ipv6 * soft"'
88+ run_command (command )
89+
10490# 'soft out' subcommand
10591@soft .command ('out' )
10692@click .argument ('ipaddress' , required = False )
0 commit comments