summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-04-02 19:14:10 +0200
committerChristian Poessinger <christian@poessinger.com>2020-04-02 19:14:10 +0200
commitb5310b0979408d2e82252a5dde74375b016cb410 (patch)
tree7b553dfef827589e074531349f14037790a80e3a /python
parent92d04a74411695b61c78985a91ca0a68017091ef (diff)
downloadvyos-1x-b5310b0979408d2e82252a5dde74375b016cb410.tar.gz
vyos-1x-b5310b0979408d2e82252a5dde74375b016cb410.zip
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 <module> 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
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ifconfig/l2tpv3.py26
1 files changed, 13 insertions, 13 deletions
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')