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

[show lldp cli] show lldp table/neighbors return 'the input device is not a TTY' #5239

Closed
bingwang-ms opened this issue Aug 24, 2020 · 1 comment

Comments

@bingwang-ms
Copy link
Contributor

bingwang-ms commented Aug 24, 2020

Description

Steps to reproduce the issue:
Run show lldp table or show lldp neighbors from SSH command, like

ssh admin@10.64.247.224 "show lldp table"   
the input device is not a TTY

ssh admin@10.64.247.224 "show lldp neighbors" 
the input device is not a TTY

I guess the reason for this issue is in get_info method in /usr/bin/lldpshow .
IMO, we should replace the -it in docker exec with -i, because there is no need for a pseudo-TTY when running in command line.

 def get_info(self, lldp_detail_info, lldp_port):
        """
        use 'lldpctl' command to gather local lldp detailed information
        """
        for lldp_instace_num in range(len(self.lldp_instance)):
            lldp_interface_list = lldp_port if lldp_port is not None else self.lldp_interface[lldp_instace_num]
            # In detail mode we will pass interface list (only front ports) and get O/P as plain text 
            # and in table format we will get xml output
            lldp_cmd = 'sudo docker exec -it lldp{} lldpctl '.format(self.lldp_instance[lldp_instace_num]) + ('-f xml' if not lldp_detail_info else lldp_interface_list)
            p = subprocess.Popen(lldp_cmd, stdout=subprocess.PIPE, shell=True)
            (output, err) = p.communicate()
            ......

Describe the results you received:
The show lldp table or show lldp neighbors return error message when runing in a SSH command:

the input device is not a TTY

But it works fine when we login to the DUT with the same account, and run the same command.
Since our test scripts connect DUT with SSH and retrive result from stdout, test cases using show lldp table or show lldp neighbors will fail.

Describe the results you expected:
The correct result including lldp table or neighbors is expected.

Additional information you deem important (e.g. issue happens only occasionally):
This issue is found in 20191130.40, 20191130.43, 20191130.45, but not found in 20181130.

**Output of `show version`:**
SONiC Software Version: SONiC.20191130.40
Distribution: Debian 9.12
Kernel: 4.9.0-11-2-amd64
Build commit: 289a32803
Build date: Mon Jun 29 11:39:04 UTC 2020
Built by: sonicbld@jenkins-slave-phx-2

Platform: x86_64-arista_7260cx3_64
HwSKU: Arista-7260CX3-D108C8
ASIC: broadcom
Serial Number: SSJ17444852
Uptime: 05:20:44 up  1:59,  2 users,  load average: 1.06, 1.13, 1.24

Docker images:
REPOSITORY                 TAG                 IMAGE ID            SIZE
docker-snmp-sv2            20191130.40         3325157d4dbe        345MB
docker-snmp-sv2            latest              3325157d4dbe        345MB
docker-fpm-frr             20191130.40         8ad36dcdb5a5        332MB
docker-fpm-frr             latest              8ad36dcdb5a5        332MB
docker-acms                20191130.40         3f5353cfa153        181MB
docker-acms                latest              3f5353cfa153        181MB
docker-lldp-sv2            20191130.40         be7f34fbfbaf        309MB
docker-lldp-sv2            latest              be7f34fbfbaf        309MB
docker-orchagent           20191130.40         5435c0535722        330MB
docker-orchagent           latest              5435c0535722        330MB
docker-syncd-brcm          20191130.40         fac2e1b53764        435MB
docker-syncd-brcm          latest              fac2e1b53764        435MB
docker-teamd               20191130.40         208a210cf3fe        312MB
docker-teamd               latest              208a210cf3fe        312MB
docker-platform-monitor    20191130.40         4b171d5fd1f2        355MB
docker-platform-monitor    latest              4b171d5fd1f2        355MB
docker-database            20191130.40         86e4be25beee        288MB
docker-database            latest              86e4be25beee        288MB
docker-dhcp-relay          20191130.40         9f36e6bb8135        298MB
docker-dhcp-relay          latest              9f36e6bb8135        298MB
docker-router-advertiser   20191130.40         7bf10b2c3f2d        288MB
docker-router-advertiser   latest              7bf10b2c3f2d        288MB
k8s.gcr.io/kube-proxy      v1.18.0             43940c34f24f        117MB
quay.io/coreos/flannel     v0.12.0-amd64       4e9f801d2217        52.8MB
k8s.gcr.io/pause           3.2                 80d28bedfe5d        683kB
**Attach debug file `sudo generate_dump`:**

```
(paste your output here)
```
@bingwang-ms bingwang-ms changed the title [show lldp cli] shpw lldp table/neighbors return 'the input device is not a TTY' [show lldp cli] show lldp table/neighbors return 'the input device is not a TTY' Aug 24, 2020
@bingwang-ms
Copy link
Contributor Author

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

No branches or pull requests

1 participant