Closed resparis closed 2 years ago
@resparis This isn't a Nornir issue (so issue should either be in Netmiko or Nornir-Netmiko repository and not in main Nornir repository).
So you have your own index
file? What is the full path to the index file?
@ktbyers thanks for the quick response. The full path is /home/resparis/Documents/Health_Check/ntc_templates/
I just tried os.environ["NTC_TEMPLATES_DIR"] = "/home/resparis/Documents/Health_Check/ntc_templates/" and did not work either.
(hc_env) resparis@ubuntu:~/Documents/Health_Check/ntc_templates$ pwd /home/resparis/Documents/Health_Check/ntc_templates (hc_env) resparis@ubuntu:~/Documents/Health_Check/ntc_templates$ ls -la total 56 drwxrwxr-x 2 resparis resparis 4096 Mar 17 05:42 . drwxrwxr-x 6 resparis resparis 4096 Mar 17 09:01 .. -rw-rw-r-- 1 resparis resparis 41393 Mar 17 05:43 index -rw-rw-r-- 1 resparis resparis 148 Mar 17 05:32 juniper_junos_show_vpls_mac_table_instance2.textfsm (hc_env) resparis@ubuntu:~/Documents/Health_Check/ntc_templates$ more index | grep vpls juniper_junos_show_vpls_mac_table_instance2.textfsm, .*, juniper_junos, show vpls mac-table instance
I don't see a TextFSM index
file there?
If you just have a specific template file you want to use, then you need to use the following two arguments:
use_textfsm=True
textfsm_template="/path/to/textfsm_file.tpl
You would use these as arguments here:
result = nr.run(netmiko_send_command, command_string="show vpls mac-table instance", use_textfsm=True)
I don't see a TextFSM
index
file there?If you just have a specific template file you want to use, then you need to use the following two arguments:
use_textfsm=True textfsm_template="/path/to/textfsm_file.tpl
It is there:
(hc_env) resparis@ubuntu:~/Documents/Health_Check/ntc_templates$ ls -la total 56 drwxrwxr-x 2 resparis resparis 4096 Mar 17 05:42 . drwxrwxr-x 6 resparis resparis 4096 Mar 17 09:01 .. -rw-rw-r-- 1 resparis resparis 41393 Mar 17 05:43 index -rw-rw-r-- 1 resparis resparis 148 Mar 17 05:32 juniper_junos_show_vpls_mac_table_instance2.textfsm
Did you edit the index file and add your entry?
It might be easier just to point directly at the template file (as per the commands I sent above).
Feel free to keep discussing here if you want but I am closing the issue as this is not a problem with nornir itself
textfsm_template
I just test adding template path as you suggested. It worked. Thanks a lot
Hi All,
I want to use a custom dictory for NTC-Templaces with Netmiko.
So far I tried: from nornir import InitNornir from nornir_netmiko.tasks import netmiko_send_command, netmiko_send_config from nornir_utils.plugins.functions import print_result import json import os
os.environ["NTC_TEMPLATES_DIR"] = "/ntc_templates/" result = nr.run(netmiko_send_command, command_string="show vpls mac-table instance", use_textfsm=True)
But it is not working.
Any ideas?