[devutils] add utilities to handle devices#2645
Merged
yxieca merged 1 commit intosonic-net:masterfrom Dec 10, 2020
Merged
Conversation
Collaborator
Author
|
@jleveque, @sujinmkang we can probably add PDU toggling action to this utility too? And any other actions might be useful for you folks? |
|
This pull request introduces 1 alert when merging c932940a50ff847ea7774dd31f9f878ded3495ca into 2c5ff63 - view on LGTM.com new alerts:
|
- list hosts defined in an inventory. - ping hosts defined in an inventory. - ssh to host(s) define din an inventory. (best executed with limited to one host) - console connect to host(s). (not implemetned, for future expansion) Signed-off-by: Ying Xie <ying.xie@microsoft.com>
Collaborator
Author
|
retest vsimage please |
Contributor
Yes, I think this utility could be extended for many purposes, but none off the top of my head at the moment. |
jleveque
approved these changes
Dec 10, 2020
antoninamelnyk
pushed a commit
to antoninamelnyk/sonic-mgmt
that referenced
this pull request
Dec 11, 2020
Summary:
Add utilities for device related oeprations.
Approach
What is the motivation for this PR?
Finding DUT information for access is a chore. Checking device status is not easy especially when comes to multiple devices.
How did you do it?
list hosts defined in an inventory.
ping hosts defined in an inventory.
ssh to host(s) define din an inventory.
(best executed with limited to one host)
console connect to host(s).
(not implemetned, for future expansion)
Signed-off-by: Ying Xie ying.xie@microsoft.com
How did you verify/test it?
yinxi@str-serv-acs-14:~/src/sonic-mgmt/ansible$ ./devutils -h
usage: devutils [-h] [-6] [-a {list,ping,ssh,console}] [-c CATEGORY]
[-i INVENTORY] [-l LIMIT] [-u USER]
Device utilities
optional arguments:
-h, --help show this help message and exit
-6, --ipv6 Include IPv6
-a {list,ping,ssh,console}, --action {list,ping,ssh,console}
Action towards host(s): list, ping, ssh, console,
default list
-c CATEGORY, --category CATEGORY
Categories: all, sonic, ptf, pdu, default all
-i INVENTORY, --inventory INVENTORY
Categories: lab, etc, default lab
-l LIMIT, --limit LIMIT
Host: limit to a single dut host name, default all
-u USER, --user USER User: user account to login to host with, default
admin
antoninamelnyk
added a commit
to antoninamelnyk/sonic-mgmt
that referenced
this pull request
Dec 11, 2020
This reverts commit 14536ca.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Add utilities for device related oeprations.
Type of change
Approach
What is the motivation for this PR?
Finding DUT information for access is a chore. Checking device status is not easy especially when comes to multiple devices.0:w
How did you do it?
(best executed with limited to one host)
(not implemetned, for future expansion)
Signed-off-by: Ying Xie ying.xie@microsoft.com
How did you verify/test it?
yinxi@str-serv-acs-14:~/src/sonic-mgmt/ansible$ ./devutils -h
usage: devutils [-h] [-6] [-a {list,ping,ssh,console}] [-c CATEGORY]
[-i INVENTORY] [-l LIMIT] [-u USER]
Device utilities
optional arguments:
-h, --help show this help message and exit
-6, --ipv6 Include IPv6
-a {list,ping,ssh,console}, --action {list,ping,ssh,console}
Action towards host(s): list, ping, ssh, console,
default list
-c CATEGORY, --category CATEGORY
Categories: all, sonic, ptf, pdu, default all
-i INVENTORY, --inventory INVENTORY
Categories: lab, etc, default lab
-l LIMIT, --limit LIMIT
Host: limit to a single dut host name, default all
-u USER, --user USER User: user account to login to host with, default
admin
yinxi@str-serv-acs-14:~/src/sonic-mgmt/ansible$ ./devutils -a list
type sonic_s6000 host vlab-03 details {'ansible_host': '10.250.0.105', 'ansible_hostv6': 'fec0::ffff:afa:5'}
type sonic_s6000 host lab-s6000-01 details {'ansible_host': '10.251.0.189', 'ansible_hostv6': 'fec0::ffff:afa:9'}
type sonic_s6000 host vlab-01 details {'ansible_host': '10.250.0.101', 'ansible_hostv6': 'fec0::ffff:afa:1'}
type sonic_s6000 host vlab-06 details {'ansible_host': '10.250.0.111', 'ansible_hostv6': 'fec0::ffff:afa:b'}
type sonic_s6000 host vlab-05 details {'ansible_host': '10.250.0.110', 'ansible_hostv6': 'fec0::ffff:afa:a'}
type sonic_s6000 host vlab-04 details {'ansible_host': '10.250.0.107', 'ansible_hostv6': 'fec0::ffff:afa:7'}
type fanout host str-7260-10 details {'ansible_host': '10.251.0.13'}
type fanout host str-7260-11 details {'ansible_host': '10.251.0.234'}
type fanout host str-msn2700-02 details {'os': 'sonic', 'ansible_host': '10.251.0.235'}
type sonic_sn2700_40 host str-msn2700-01 details {'model': 'MSN2700-CS2FO', 'base_mac': '24:8a:07:12:34:56', 'syseeprom_info': {'0x28': 'x86_64-mlnx_x86-r0', '0x29': '2016.11-5.1.0008-9600', '0x22': 'MSN2700-CS2FO', '0x23': 'MT1234X56789', '0x21': 'MSN2700', '0x26': '0', '0x24': '24:8a:07:12:34:56', '0x25': '12/07/2016', '0x2A': '128', '0x2B': 'Mellanox', '0xFE': '0xFBA1E964'}, 'ansible_host': '10.251.0.188', 'serial': 'MT1234X56789'}
type ptf host ptf_vms6-1 details {'ansible_ssh_user': 'root', 'ansible_host': '10.250.0.100', 'ansible_ssh_pass': 'root'}
type ptf host ptf_ptf1 details {'ansible_ssh_user': 'root', 'ansible_host': '10.255.0.188', 'ansible_ssh_pass': 'root'}
type ptf host ptf_vms1-1 details {'ansible_ssh_user': 'root', 'ansible_host': '10.255.0.178', 'ansible_ssh_pass': 'root'}
type sonic_s6100 host vlab-02 details {'ansible_host': '10.250.0.102'}
type sonic_s6100 host lab-s6100-01 details {'ansible_host': '10.251.0.190'}
type sonic_a7260 host lab-a7260-01 details {'hwsku': 'Arista-7260CX3-D108C8', 'ansible_host': '10.251.0.191'}
yinxi@str-serv-acs-14:~/src/sonic-mgmt/ansible$ ./devutils -i str -c sonic -a ping
host str-msn2700-05 (type sonic_mlnx_40) is unreachable at address 10.3.147.48
host str-msn2700-11-3po (type sonic_mlnx_40) is unreachable at address 10.3.147.54
host str-s6000-on-3 (type sonic_dell32_40) is unreachable at address 10.3.146.112
host str-s6000-acs-7 (type sonic_dell32_40) is unreachable at address 10.3.147.195
yinxi@str-serv-acs-14:~/src/sonic-mgmt/ansible$ ./devutils -i str2 -a ssh -l str2-7050cx3-acs-06
admin@10.3.147.26's password:
Linux str2-7050cx3-acs-06 4.19.0-9-2-amd64 #1 SMP Debian 4.19.118-2+deb10u1 (2020-06-07) x86_64
You are on
/ | / _ | \ | ()/ |
_ | | | | | | | |
) | || | |\ | | |
|/ ___/|| _||____|
-- Software for Open Networking in the Cloud --
Unauthorized access and/or use are prohibited.
All access and/or use are subject to monitoring.
Help: http://azure.github.io/SONiC/
Last login: Thu Dec 10 06:23:48 2020 from 10.64.247.30