-
Notifications
You must be signed in to change notification settings - Fork 715
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
[devutils] add utilities to handle devices #2645
Conversation
@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 <[email protected]>
retest vsimage please |
Yes, I think this utility could be extended for many purposes, but none off the top of my head at the moment. |
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 [email protected] 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
This reverts commit 14536ca.
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 [email protected]
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
[email protected]'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