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

Add Remote CLI on Chassis to simplify connections between supervisor and linecard #2302

Draft
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

noahsolomon-ms
Copy link

@noahsolomon-ms noahsolomon-ms commented Aug 8, 2022

What I did

Added commands rexec (remote execute) and rshell (remote shell) to SONiC command line on chassis supervisors. These commands allow you to execute a command through SSH from a supervisor on a linecard (rexec) or to enter the SSH shell for a linecard (rshell).
Additionally, these commands take in linecard names, which are then mapped to linecard IP addresses using the Redis State database.

  • The rexec command allows you to execute a command on one (or many) linecards.
    • Arguments:
      • LINECARD_NAMES One or more linecard names. Tab-completion enabled.
    • Options:
      • -c/--command COMMAND (required) The command to execute.
      • -p/--password-file Read password from a file. If not provided, user will be prompted for a password.
    • Example 1: rexec linecard0 linecard1 --command "show interface status"
    • Example 2: `rexec all --command "show ip bgp summary"
  • The rshell command allows you to access the linecards shell, similar to ssh.
    • Arguments:
      • LINECARD_NAMES One or more linecard names. Tab-completion enabled.
    • Options:
      • -p/--password-file Read password from a file. If not provided, user will be prompted for a password.
    • Example usage: rshell linecard0

How I did it

I created the rcli directory with multiple files that use Click to parse command line inputs. The two relevant files here are rexec.py and rshell.py. These files also make use of linecard.py, which contains most of the plumbing to initiate and manage SSH connections. This project primarily uses the Paramiko Python library to manage SSH connections.

How to verify it

(work in progress)

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Aug 8, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

@lgtm-com
Copy link

lgtm-com bot commented Aug 8, 2022

This pull request introduces 6 alerts when merging 5eb3b55 into bcf36eb - view on LGTM.com

new alerts:

  • 4 for Unused import
  • 2 for Unused argument in a formatting call

@lgtm-com
Copy link

lgtm-com bot commented Aug 9, 2022

This pull request introduces 3 alerts when merging 08bef0d into be1866f - view on LGTM.com

new alerts:

  • 2 for Unused argument in a formatting call
  • 1 for Unused import

Signed-off-by: Noah Solomon <t-nosolomon@microsoft.com>
Signed-off-by: Noah Solomon <t-nosolomon@microsoft.com>
Signed-off-by: Noah Solomon <t-nosolomon@microsoft.com>
Signed-off-by: Noah Solomon <t-nosolomon@microsoft.com>
Signed-off-by: Noah Solomon <t-nosolomon@microsoft.com>
Signed-off-by: Noah Solomon <t-nosolomon@microsoft.com>
Signed-off-by: Noah Solomon <t-nosolomon@microsoft.com>
Signed-off-by: Noah Solomon <t-nosolomon@microsoft.com>
Signed-off-by: Noah Solomon <t-nosolomon@microsoft.com>
Signed-off-by: Noah Solomon <t-nosolomon@microsoft.com>
Signed-off-by: Noah Solomon <t-nosolomon@microsoft.com>
Signed-off-by: Noah Solomon <t-nosolomon@microsoft.com>
Signed-off-by: Noah Solomon <t-nosolomon@microsoft.com>
@lgtm-com
Copy link

lgtm-com bot commented Aug 10, 2022

This pull request introduces 1 alert when merging c1f95ed into 14c483f - view on LGTM.com

new alerts:

  • 1 for Unused import

Signed-off-by: Noah Solomon <t-nosolomon@microsoft.com>
Signed-off-by: Noah Solomon <t-nosolomon@microsoft.com>
Signed-off-by: Noah Solomon <t-nosolomon@microsoft.com>
Signed-off-by: Noah Solomon <t-nosolomon@microsoft.com>
Signed-off-by: Noah Solomon <t-nosolomon@microsoft.com>
Signed-off-by: Noah Solomon <t-nosolomon@microsoft.com>
Signed-off-by: Noah Solomon <t-nosolomon@microsoft.com>
Signed-off-by: Noah Solomon <t-nosolomon@microsoft.com>
@lgtm-com
Copy link

lgtm-com bot commented Aug 19, 2022

This pull request introduces 1 alert when merging 2755737 into 7704f63 - view on LGTM.com

new alerts:

  • 1 for Unreachable code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant