netmiko: Is Fortinet/Fortigate support broken?

test_fortinet.debuglog.txt

  • OSX 10.11.6
  • Python 3.6.0
  • Netmiko 1.2.8
  • FortiGate-1500D v5.4.3,build1111,161220 (GA)

This is my example script:

#!/usr/bin/env python
# coding=utf-8
"""
    Fortinet Fortigate Test
"""
import logging

from netmiko import ConnectHandler

logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger('global')

devices = []

ips = ["10.10.10.1"]
for ip in ips:
    fortinet = {
        'device_type': 'fortinet',
        'ip':   ip,
        'username': 'admin',
        'password': 'xxxxx'
    }
    devices.append(fortinet)

for device in devices:
    net_connect = ConnectHandler(**device)
    output = net_connect.send_command('config global')
    output = net_connect.send_command('diagnose hardware deviceinfo nic')
    print(output)

Attached is a debug log.

After the config global command is issued by my script (not the one built into netmiko, the initial get system status seem to work, but as you can see I didn’t issue that) the console prompt is returned but not detected and falls into an endless loop of DEBUG:netmiko:read_channel:, as a result the diagnose hardware deviceinfo nic doesn’t execute.

Does anyone else see the same?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 21 (10 by maintainers)

Most upvoted comments

Yep, that’s all fixed now.

As you suggested, I did need to update my test script.

For the future reference of others, final debug attached - test_fortinet.debuglog-otherFW-3.txt - and updated script below.

@ktbyers Thank you.

#!/usr/bin/env python
# coding=utf-8
"""
    Fortinet Fortigate Test
"""
import logging

from netmiko import ConnectHandler

logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger('global')

devices = []

ips = ["10.159.75.204"]
for ip in ips:
    fortinet = {
        'device_type': 'fortinet',
        'ip':   ip,
        'username': 'admin',
        'password': 'xxxxx'
    }
    devices.append(fortinet)

for device in devices:
    net_connect = ConnectHandler(**device)
    output = net_connect.send_command_timing('config global', delay_factor=4)
    output = net_connect.send_command_timing('diagnose hardware deviceinfo nic', delay_factor=4)
    print(output)

= )

I only commented on it because someone w a similar issue had already commented. I only used Pv2 because I was in a hurry and my Pv3 was gen’ing an error w the import netmiko statement. I was in a hurry and moved on. I did briefly look for you email because the post was so old, I wasn’t sure that you’d actually respond. I didn’t find it after looking very briefly and moved on to the post. Sorry Kirk.

I think I found the solution to my problem by adding the 'expect_string = ‘[#?$]’ syntax to my send_command tuple.

Is there a class you offer w just the Netmiko, Paramiko stuff?

On Wed, Feb 9, 2022, 12:00 PM Kirk Byers @.***> wrote:

python2.7 Python 2.7 is dead. Netmiko has not supported it for a long time.

Also not really a good idea to comment on a closed issue that has been closed for almost five years.

— Reply to this email directly, view it on GitHub https://github.com/ktbyers/netmiko/issues/384#issuecomment-1034093663, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVNXZZ4LG5KFGLZUNUJHKATU2K2UDANCNFSM4DBQEDJA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>