如何打印出使用netmiko的send_command()发送的命令

时间:2019-06-24 09:17:30

标签: python-3.x network-programming

假设我正在将以下命令发送到不支持该命令的交换机/平台。 “发送所需的流量控制”

有没有一种方法可以打印出来,而不必像下面指示的那样在打印语句中手动键入命令?

我的代码:

        for line in req_intfs:
            print(line.text)
            result = connection.send_command_timing(line.text+"\n")
            if "% Invalid input detected" in result:
                print("error: " + result + "wrong mode")
                exit(1)
            result = connection.send_command_timing("flowcontrol send desired\n")
            if "% Invalid input detected" in result:
                print("error: " + result + "cmd not suppoted: flowcontrol send desired")
            result = connection.send_command_timing("flowcontrol receive desired\n")
            if "% Invalid input detected" in result:
                print("error: " + result + "cmd not supported: flowcontrol receive desired")

0 个答案:

没有答案