the vrf variable in the ip_helper_addresses definition is undefined. i moved vrf = child.re_match_typed(r"vrf\s+member\s+(\S+)", default="") from line #1217 outside of the conditional to make it work but hoping to see a proper fix. If you think that suffices i can do a pull request.
CiscoConfParse Version
1.9.51
What Operating System are you using?
Linux - Debian, Ubuntu, CentOS, RHEL or others
What Python version(s) have this problem?
Python 3.10
Show us how to reproduce the problem. Please tell us if the problem is specific to certain inputs or situations.
parse = CiscoConfParse('nxos-confg', syntax='nxos', factory=True)
svis = parse.find_objects_w_child(parentspec=r"^interface Vlan", childspec=r"no\sshutdown")
for svi in svis:
print(svi.ip_helper_addresses)
Python tracebacks
Traceback (most recent call last):
File "/home/blah/evpn/./get_svi_datacenters.py", line 17, in <module>
print(svi.name, svi.description, svi.vrf, svi.ip, svi.ip_accessgroup_in, svi.ip_accessgroup_out, svi.ip_helper_addresses)
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/blah/.local/lib/python3.12/site-packages/ciscoconfparse/models_nxos.py", line 1227, in ip_helper_addresses
retval.append({"addr": addr, "vrf": vrf, "global": bool(global_addr)})
^^^
UnboundLocalError: cannot access local variable 'vrf' where it is not associated with a value
Contact Details
jason@caladan.ca
What happened?
the vrf variable in the ip_helper_addresses definition is undefined. i moved
vrf = child.re_match_typed(r"vrf\s+member\s+(\S+)", default="")
from line #1217 outside of the conditional to make it work but hoping to see a proper fix. If you think that suffices i can do a pull request.CiscoConfParse Version
1.9.51
What Operating System are you using?
Linux - Debian, Ubuntu, CentOS, RHEL or others
What Python version(s) have this problem?
Python 3.10
Show us how to reproduce the problem. Please tell us if the problem is specific to certain inputs or situations.
Python tracebacks
Relevant log output
No response
Code of Conduct