Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
376 views
in Technique[技术] by (71.8m points)

python 3.x - Netmiko TEXTSFM Windows 10 issues

I am running Python 3 on a Windows 10 computer. When I run this it works fine. When I add the use_textfsm=True) to the results I get a permission error where the templates are at. Permissions seem to be fine. I would like to try copy the template folder to a new location but I am not sure how to tell netmiko the new location for that folder.

from nornir import InitNornir
from nornir.core.task import Result, Task
from nornir_netmiko.tasks.netmiko_send_command import netmiko_send_command
from nornir_utils.plugins.functions import print_result
nr = InitNornir("h:/Scripts/IPvZero-master/nornir_textFSM_video/config.yaml")
results = nr.run(netmiko_send_command, command_string="show interface switchport")
print_result(results)*

TextFSM Integration Netmiko has been configured to automatically look in ~/ntc-template/templates/index for the ntc-templates index file. Alternatively, you can explicitly tell Netmiko where to look for the TextFSM template directory by setting the NET_TEXTFSM environment variable (note, there must be an index file in this directory):

export NET_TEXTFSM=/path/to/ntc-templates/templates/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...