Skip to content
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

Merged
merged 3 commits into from
Oct 2, 2017

Conversation

samaity
Copy link
Contributor

@samaity samaity commented Sep 29, 2017

… 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.

… 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.
@msftclas
Copy link

msftclas commented Sep 29, 2017

CLA assistant check
All CLA requirements met.

debug/main.py Outdated


# Add 'bgp' group to both the root 'cli' group and the 'ip' subgroup
cli.add_command(bgp)
Copy link
Contributor

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.

Copy link
Contributor Author

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)
Copy link
Contributor

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.

Copy link
Contributor Author

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.

a = self.db.keys(self.db.APPL_DB)
#print(a)
tables = self.db.keys(self.db.APPL_DB, "PORT_TABLE:*")
i={}
Copy link
Contributor

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.

Copy link
Contributor Author

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)
Copy link
Contributor

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.

Copy link
Contributor Author

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"""
Copy link
Contributor

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

Copy link
Contributor Author

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)
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

show/main.py Show resolved Hide resolved
show/main.py Outdated
@click.argument('interfacename', required=False)
def default(interfacename):
if interfacename is not None:
command = "sudo sfputil -p {}".format(interfacename)
Copy link
Contributor

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.

Copy link
Contributor Author

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"""
Copy link
Contributor

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

Copy link
Contributor Author

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)
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@samaity samaity force-pushed the master branch 2 times, most recently from b540049 to 7398670 Compare October 2, 2017 06:30
undebug/main.py Outdated
run_command(command)

if __name__ == '__main__':
cli()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace tab with spaces.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@jleveque jleveque merged commit 63f05ad into sonic-net:master Oct 2, 2017
zhenggen-xu pushed a commit to zhenggen-xu/sonic-utilities that referenced this pull request Jun 6, 2018
* 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)
vdahiya12 pushed a commit to vdahiya12/sonic-utilities that referenced this pull request Jul 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants