From b5310b0979408d2e82252a5dde74375b016cb410 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Thu, 2 Apr 2020 19:14:10 +0200 Subject: fconfig: l2tpv3: T1823: fix configuration build syntax Fixes reference to unspecified variable Traceback (most recent call last): File "/usr/libexec/vyos/conf_mode/interfaces-l2tpv3.py", line 245, in apply(c) File "/usr/libexec/vyos/conf_mode/interfaces-l2tpv3.py", line 211, inapply l = L2TPv3If(l2tpv3['intf'], **conf) File "/usr/lib/python3/dist-packages/vyos/ifconfig/interface.py", line 185, in __init__ self._create() File "/usr/lib/python3/dist-packages/vyos/ifconfig/l2tpv3.py", line 48, in _create cmd = 'ip l2tp add tunnel tunnel_id {} '.format(config['tunnel_id']) NameError: name 'config' is not defined --- python/vyos/ifconfig/l2tpv3.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'python') diff --git a/python/vyos/ifconfig/l2tpv3.py b/python/vyos/ifconfig/l2tpv3.py index d98b11ab0..f0d64a53d 100644 --- a/python/vyos/ifconfig/l2tpv3.py +++ b/python/vyos/ifconfig/l2tpv3.py @@ -47,21 +47,21 @@ class L2TPv3If(Interface): def _create(self): # create tunnel interface - cmd = 'ip l2tp add tunnel tunnel_id {} '.format(config['tunnel_id']) - cmd += 'peer_tunnel_id {} '.format(config['peer_tunnel_id']) - cmd += 'udp_sport {} '.format(config['local_port']) - cmd += 'udp_dport {} '.format(config['remote_port']) - cmd += 'encap {} '.format(config['encapsulation']) - cmd += 'local {} '.format(config['local_address']) - cmd += 'remote {} '.format(config['remote_address']) - self._cmd(cmd) + cmd = 'ip l2tp add tunnel tunnel_id {tunnel_id}' + cmd += ' peer_tunnel_id {peer_tunnel_id}' + cmd += ' udp_sport {local_port}' + cmd += ' udp_dport {remote_port}' + cmd += ' encap {encapsulation}' + cmd += ' local {local_address}' + cmd += ' remote {remote_address}' + self._cmd(cmd.format(**self.config)) # setup session - cmd = 'ip l2tp add session name {} '.format(self.config['ifname']) - cmd += 'tunnel_id {} '.format(config['tunnel_id']) - cmd += 'session_id {} '.format(config['session_id']) - cmd += 'peer_session_id {} '.format(config['peer_session_id']) - self._cmd(cmd) + cmd = 'ip l2tp add session name {ifname}' + cmd += ' tunnel_id {tunnel_id}' + cmd += ' session_id {session_id}' + cmd += ' peer_session_id {peer_session_id}' + self._cmd(cmd.format(**self.config)) # interface is always A/D down. It needs to be enabled explicitly self.set_admin_state('down') -- cgit v1.2.3