简体   繁体   中英

Junos Device CLI command giving wrong output when executed from python

When i try to execute Device.cli(....) command from python it gives me wrong output. What could be the issue?

For example, if i execute below command on directly on Juniper Device CLI, it gives the correct output with match sadasd-sdasd-asdasd.

show configuration | display set | match sadasd-sdasd-asdasd

But if i execute the same command from Junos CLI with python, output is whole configuration instead of matching with filter string.

device = Device(host=host, user=device_ssh_user, ssh_private_key_file=device_ssh_key,
                passwd=password)
device.open()

configuration = device.cli("show configuration | display set | match sadasd-sdasd-asdasd") 

检查是否有帮助

device.rpc.get_config(options={'format': 'set'})

It is not recommended to use the cli() method in Pyez. Why? Read the below answer.

Already answered here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM