-
Notifications
You must be signed in to change notification settings - Fork 661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancement of 'show' commands and addition of 'debug', and 'undebug'… #113
Conversation
… hierarchy in CLI utilities > added script to get interface status. > added few subcommands under "show interfaces" command. > enhanced "show process" to get all processes sorted by CPU & memory. > added "show services" command to get all the running process from all the dockers. > added "show vlan" command. > enhanced multiple subcommands under > added debug', and 'undebug' CLI utilities.
debug/main.py
Outdated
|
||
|
||
# Add 'bgp' group to both the root 'cli' group and the 'ip' subgroup | ||
cli.add_command(bgp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unnecessary, as bgp
is added to the cli
group only, and this is done via the decorator on line 110.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
show/main.py
Outdated
# 'summary' subcommand ("show interfaces summary") | ||
@interfaces.command() | ||
# 'summary' subcommand ("show interfaces summary") -- called if no subcommands are passed | ||
@interfaces.command(default=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not a fan of the DefaultGroup
we have implemented using Click, because when a group has a default command, it does not allow for using Tab to show available subcommands.
We either need to eliminate default commands for groups altogether, or try to fix our DefaultGroup to allow the Tab functionality to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the time being, will get rid of this 'default' behavior. Agree that 'tabs' is a nice-to-have feature.
scripts/interface_stat
Outdated
a = self.db.keys(self.db.APPL_DB) | ||
#print(a) | ||
tables = self.db.keys(self.db.APPL_DB, "PORT_TABLE:*") | ||
i={} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add spaces around =
for consistent style.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
debug/main.py
Outdated
|
||
|
||
# Add 'bgp' group to both the root 'cli' group and the 'ip' subgroup | ||
cli.add_command(bgp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is unnecessary, as bgp
is only added to the cli
group, and this is already done via the decorator on line 110.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
debug/main.py
Outdated
|
||
@click.group(cls=AliasedGroup, context_settings=CONTEXT_SETTINGS) | ||
def cli(): | ||
"""SONiC command line - 'debug' command""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace tabs with spaces everywhere they occur within the file for consistent style
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, just noticed the entire file was lacking indentation consistency.
show/main.py
Outdated
command="free -m" | ||
run_command(command) | ||
|
||
@click.group(cls=AliasedGroup, default_if_no_args=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to @cli.group(cls=AliasedGroup, default_if_no_args=False)
and remove cli.add_command(vlan)
on line 678.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
show/main.py
Outdated
@click.argument('interfacename', required=False) | ||
def default(interfacename): | ||
if interfacename is not None: | ||
command = "sudo sfputil -p {}".format(interfacename) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sfputil
syntax changed recently. Please update all sfputil
calls here and below to new syntax.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
undebug/main.py
Outdated
|
||
@click.group(cls=AliasedGroup, context_settings=CONTEXT_SETTINGS) | ||
def cli(): | ||
"""SONiC command line - 'undebug' command""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace tabs with spaces everywhere they occur within the file for consistent style
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
undebug/main.py
Outdated
|
||
|
||
# Add 'bgp' group to both the root 'cli' group and the 'ip' subgroup | ||
cli.add_command(bgp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is unnecessary, as bgp is only added to the cli group, and this is already done via the decorator on line 108.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
b540049
to
7398670
Compare
undebug/main.py
Outdated
run_command(command) | ||
|
||
if __name__ == '__main__': | ||
cli() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace tab with spaces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* msft_github/master: Enhancement of 'show' commands and addition of 'debug', and 'undebug'… (sonic-net#113) CLI support for Layer 2 MAC/FDB show (sonic-net#106) [show]: Add 'show interfaces alias' command to display port name/alias mapping (sonic-net#107) Add 'ipv6' group along with 'bgp' and 'route' subcommands; Remove duplicate commands ('bgp,' 'route') from under root group (sonic-net#102) [generate_dump]: Skip the sparse file /var/log/lastlog (sonic-net#104) Added syncd SAI dump to sysdump script (sonic-net#89) Adapt to new minigraph_parser schema (sonic-net#103) [core dump] remove number of parameter assumption from script coredump-compress [FastReboot]: Update FR to make it working with 1.0.3 (sonic-net#95)
… hierarchy in CLI utilities