- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
06-16-2020 01:08 PM
Greetings,
Using pandevice, I am able to add a tunnel interface, give it and IP, comment, and set the virtual router. using the set_virtual_router() function. However when trying the set_zone() function to set the security zone, I get an error.
<previous code removed>
#Create a network interface object named tunnl.[TunnelID]
tun = network.TunnelInterface(TunnelID,ip=DATACENTER_TUN_INTF,comment=TUN_COMMENT)
#Add the tunnel object to the Template object and create it.
Template_obj.add(tun).create()
TUN_ZONE='internal'
tun.set_virtual_router(DC_VR,refresh=True,update=True,running_config=True)
#everything is good up until this point
tun.set_zone(TUN_ZONE,refresh=True,update=True,running_config=True)
The error I get when I run the code:
Traceback (most recent call last):
File "/Users/mrzepa/opt/anaconda3/lib/python3.7/site-packages/pandevice/base.py", line 2447, in _get_param_specific_info
p = token.format(**{})
KeyError: 'mode'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/mrzepa/src/scratch.py", line 313, in <module>
main()
File "/Users/mrzepa/src/scratch.py", line 280, in main
tun.set_zone('zap',refresh=True,update=True,running_config=True)
File "/Users/mrzepa/opt/anaconda3/lib/python3.7/site-packages/pandevice/network.py", line 325, in set_zone
update, running_config, return_type, False, mode=mode)
File "/Users/mrzepa/opt/anaconda3/lib/python3.7/site-packages/pandevice/base.py", line 1522, in _set_reference
obj.update(reference_var)
File "/Users/mrzepa/opt/anaconda3/lib/python3.7/site-packages/pandevice/base.py", line 621, in update
path, value, var_path = self._get_param_specific_info(variable)
File "/Users/mrzepa/opt/anaconda3/lib/python3.7/site-packages/pandevice/base.py", line 2455, in _get_param_specific_info
raise ValueError(msg.format(param, param_ref))
ValueError: While updating variable interface, missing replacement variable mode in path
Any help would be most appreciated. Thanks.
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!