summaryrefslogtreecommitdiff
path: root/src/conf_mode/tftp_server.py
diff options
context:
space:
mode:
authorDmitriyEshenko <dmitriy.eshenko@vyos.io>2021-11-22 20:55:06 +0000
committerDmitriyEshenko <dmitriy.eshenko@vyos.io>2021-11-23 08:12:41 +0000
commit6f0249e39164b9d59de6550337e2901e5ed9ebf1 (patch)
tree5c50249d6411e626eae613c0bbe8d9ea3ba6b91f /src/conf_mode/tftp_server.py
parent82ea3b4f3c12023ce17f1062785b6238f457673d (diff)
downloadvyos-1x-6f0249e39164b9d59de6550337e2901e5ed9ebf1.tar.gz
vyos-1x-6f0249e39164b9d59de6550337e2901e5ed9ebf1.zip
tftp: T4012: Add TFTP VRF support
Diffstat (limited to 'src/conf_mode/tftp_server.py')
-rwxr-xr-xsrc/conf_mode/tftp_server.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/conf_mode/tftp_server.py b/src/conf_mode/tftp_server.py
index 2409eec1f..ef726670c 100755
--- a/src/conf_mode/tftp_server.py
+++ b/src/conf_mode/tftp_server.py
@@ -24,6 +24,7 @@ from sys import exit
from vyos.config import Config
from vyos.configdict import dict_merge
+from vyos.configverify import verify_vrf
from vyos.template import render
from vyos.template import is_ipv4
from vyos.util import call
@@ -65,10 +66,11 @@ def verify(tftpd):
if 'listen_address' not in tftpd:
raise ConfigError('TFTP server listen address must be configured!')
- for address in tftpd['listen_address']:
+ for address, address_config in tftpd['listen_address'].items():
if not is_addr_assigned(address):
print(f'WARNING: TFTP server listen address "{address}" not ' \
'assigned to any interface!')
+ verify_vrf(address_config)
return None
@@ -83,7 +85,7 @@ def generate(tftpd):
return None
idx = 0
- for address in tftpd['listen_address']:
+ for address, address_config in tftpd['listen_address'].items():
config = deepcopy(tftpd)
port = tftpd['port']
if is_ipv4(address):
@@ -91,6 +93,9 @@ def generate(tftpd):
else:
config['listen_address'] = f'[{address}]:{port} -6'
+ if 'vrf' in address_config:
+ config['vrf'] = address_config['vrf']
+
file = config_file + str(idx)
render(file, 'tftp-server/default.tmpl', config)
idx = idx + 1