0

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") 
Seanny123
  • 8,776
  • 13
  • 68
  • 124
Srikanth Hugar
  • 385
  • 5
  • 22

2 Answers2

0

Check if this helps

device.rpc.get_config(options={'format': 'set'})
Nitin Kr
  • 521
  • 2
  • 12
0

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

Already answered here

Vijay Shetty
  • 901
  • 10
  • 11