Using Python Script to iterate Cli Commands(Multiple times) On Juniper Devices.

Опубликовано: 09 Август 2026
на канале: Network Tips and Topics - Plexinor
191
4

"Want more expert insights and updates? Follow us on LinkedIn and explore our company page to connect with us directly. Don’t miss out - click the link and join the conversation!"

Follow us on LinkedIn   / plexinor  
Company Website Https://www.plexinor.com

lab@admin:~$ cat Python-Looping-commands
from netmiko import Netmiko
from getpass import getpass
import time


my_device = {
"host": "192.168.0.132",
"username": "lab",
"password": getpass(),
"device_type": "juniper_junos",
}


net_connect = Netmiko(**my_device)
n=5
for n in range(1, n + 1):
output = net_connect.send_command("show pfe statistics traffic")
print(output)
print ('#############################################################' )
time.sleep (1)
net_connect.disconnect()