Open pperesbr opened 2 years ago
Hi, as per docs:
:param ttp_template: Name of template to parse output with; can be fully qualified
path, relative path, or name of file in current directory. (default: None).
:type ttp_template: str
do you have file "dis_cur_conf_vpn_instance.ttp" in current working directory next to your script? Might want to try passing absolute path or template content.
Also, may want to check Netmiko run_ttp method as it might make it simpler to achieve functionality your are after
Hi.
My file there is the same directory...
I changed to absolute path and got with one error: group.get_regexes: variable not found in line: ' ipv4-family'
group.get_regexes: variable not found in line: ' ipv4-family'
[[{'vpns': [{'apply_label': 'per-instance',
'name': 'GER-LTE',
'rd': '10429:902041026',
'rts_export': ['10429:16026'],
'rts_import': ['10429:16026'],
'tunnel_policy': 'LB'},
{'name': 'RMG3G-TIM-VIV-IAS-IUPS-UP',
'rd': '26615:36911',
'rts_export': ['26615:36910'],
'rts_import': ['26615:30911',
'26615:30851',
'26615:30711',
'26615:30611',
'26615:30213',
'26615:30113'],
'tunnel_policy': 'LB'},
{'apply_label': 'per-instance',
'name': 'RS-LTE-OI-VIVO-PROVEDOR',
'rd': '8167:9151',
'rts_export': ['8167:9151'],
'rts_import': ['8167:9152'],
'tunnel_policy': 'LB'},
{'apply_label': 'per-instance',
'name': 'RS-LTE-OI-VIVO-PROVEDOR-S',
'rd': '8167:9153',
'rts_export': ['8167:9152'],
'rts_import': ['8167:9151'],
'tunnel_policy': 'LB'},
{'apply_label': 'per-instance',
'name': 'RS-LTE-OI-VIVO-TOMADOR',
'rd': '8167:9101',
'rts_export': ['10429:16025', '7738:9101'],
'rts_import': ['10429:16025', '7738:9102'],
'tunnel_policy': 'LB'},
{'apply_label': 'per-instance',
'name': 'RS-LTE-TIM-VIVO-PROVEDOR',
'rd': '26615:9151',
'rts_export': ['26615:9151'],
'rts_import': ['26615:9152'],
'tunnel_policy': 'LB'},
{'apply_label': 'per-instance',
'name': 'RS-LTE-TIM-VIVO-PROVEDOR-S',
'rd': '26615:9153',
'rts_export': ['26615:9152'],
'rts_import': ['26615:9151'],
'tunnel_policy': 'LB'},
{'apply_label': 'per-instance',
'name': 'RS-LTE-TIM-VIVO-TOMADOR',
'rd': '26615:9101',
'rts_export': ['26615:9101', '10429:16025'],
'rts_import': ['26615:9102', '10429:16025'],
'tunnel_policy': 'LB'},
{'name': 'RS3G-CLR-VIV-PVD-IAS-IUPS-UP',
'rd': '22085:32024',
'rts_export': ['22085:32024', '10429:20624', '26599:10'],
'rts_import': ['22085:32024', '26599:10', '10429:20624'],
'tunnel_policy': 'LB'},
{'import_route_policy': 'RS3G-TIM-VIV-PVD-FROM-SERVICE',
'name': 'RS3G-TIM-VIV-PVD-IAS-IUPS-UP',
'rd': '26615:32024',
'rts_export': ['26615:32024'],
'rts_import': ['26599:10', '10429:20624', '26615:32024']},
{'import_route_policy': 'RS3G-TIM-VIV-TMD-FROM-SERVICE',
'name': 'RS3G-TIM-VIV-TMD-IAS-IUPS-UP',
'rd': '26615:31024',
'rts_export': ['26615:31024'],
'rts_import': ['26599:10', '10429:20624', '26615:31024']},
{'apply_label': 'per-instance',
'name': 'SERVICO-LTE',
'rd': '10429:902041025',
'rts_export': ['10429:16025', '10429:25517', '10429:25519'],
'rts_import': ['10429:16025',
'10429:25517',
'10429:25518',
'10429:25519',
'10429:25520'],
'tunnel_policy': 'LB'},
{'name': 'V13092:IuPS-UP',
'rd': '10429:12748',
'rts_export': ['10429:20624'],
'rts_import': ['10429:20624', '22085:32024', '26615:32024'],
'tunnel_policy': 'LB'}]}]]
For both ways run_ttp and send_command with ttp option.
Why I need to do this way?
Tks,
Paulo
The error happened because the final ouput mismatch.
ip dcn vpn-instance __dcn_vpn__
ipv4-family
#
return
error: group.get_regexes: variable not found in line: ' ipv4-family'
- you seeing this error because ipv4-family line does not contain any {{ variables }}
In theory relative OS path should work as well, not sure why its notworking in your case, you can pass ttp template string as well instead of path to file.
I'm creating lib to get configuration from Huawei equipment with Netmiko and TTP.
When I run my code I receive this error message:
group.get_regexes: variable not found in line: 'dis_cur_conf_vpn_instance.ttp'
Here files with codes.
TTP file:
Class python:
and original output from netmiko without ttp:
Before writed the code, I tested with https://textfsm.nornir.tech/ and that's work.
Tks,
Paulo