diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-02-27 21:37:15 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-02-28 00:54:37 +0100 |
commit | 582b718221c67ddb71e39fbad0a72241761304a9 (patch) | |
tree | 4bb7c0ea424ce74137e5ba966e05bbeef4e7cede /python/vyos | |
parent | 8f100189086102458ff8e4f61f842cf44a6bf8aa (diff) | |
download | vyos-1x-582b718221c67ddb71e39fbad0a72241761304a9.tar.gz vyos-1x-582b718221c67ddb71e39fbad0a72241761304a9.zip |
tunnel: T3366: rename local-ip to source-address
Streamline the CLI configuration where we try to use source-address when
creating connections which are especially sourced from a discrete address.
Diffstat (limited to 'python/vyos')
-rw-r--r-- | python/vyos/configverify.py | 18 | ||||
-rw-r--r-- | python/vyos/ifconfig/tunnel.py | 4 |
2 files changed, 11 insertions, 11 deletions
diff --git a/python/vyos/configverify.py b/python/vyos/configverify.py index 8286a735c..c901ccbc5 100644 --- a/python/vyos/configverify.py +++ b/python/vyos/configverify.py @@ -100,26 +100,26 @@ def verify_tunnel(config): raise ConfigError('Must configure the tunnel encapsulation for '\ '{ifname}!'.format(**config)) - if 'local_ip' not in config and 'dhcp_interface' not in config: - raise ConfigError('local-ip is mandatory for tunnel') + if 'source_address' not in config and 'dhcp_interface' not in config: + raise ConfigError('source-address is mandatory for tunnel') if 'remote_ip' not in config and config['encapsulation'] != 'gre': raise ConfigError('remote-ip is mandatory for tunnel') - if {'local_ip', 'dhcp_interface'} <= set(config): - raise ConfigError('Can not use both local-ip and dhcp-interface') + if {'source_address', 'dhcp_interface'} <= set(config): + raise ConfigError('Can not use both source-address and dhcp-interface') if config['encapsulation'] in ['ipip6', 'ip6ip6', 'ip6gre', 'ip6erspan']: error_ipv6 = 'Encapsulation mode requires IPv6' - if 'local_ip' in config and not is_ipv6(config['local_ip']): - raise ConfigError(f'{error_ipv6} local-ip') + if 'source_address' in config and not is_ipv6(config['source_address']): + raise ConfigError(f'{error_ipv6} source-address') if 'remote_ip' in config and not is_ipv6(config['remote_ip']): raise ConfigError(f'{error_ipv6} remote-ip') else: error_ipv4 = 'Encapsulation mode requires IPv4' - if 'local_ip' in config and not is_ipv4(config['local_ip']): - raise ConfigError(f'{error_ipv4} local-ip') + if 'source_address' in config and not is_ipv4(config['source_address']): + raise ConfigError(f'{error_ipv4} source-address') if 'remote_ip' in config and not is_ipv4(config['remote_ip']): raise ConfigError(f'{error_ipv4} remote-ip') @@ -130,7 +130,7 @@ def verify_tunnel(config): raise ConfigError(f'Option source-interface can not be used with ' \ f'encapsulation "{encapsulation}"!') elif config['encapsulation'] == 'gre': - if 'local_ip' in config and is_ipv6(config['local_ip']): + if 'source_address' in config and is_ipv6(config['source_address']): raise ConfigError('Can not use local IPv6 address is for mGRE tunnels') def verify_eapol(config): diff --git a/python/vyos/ifconfig/tunnel.py b/python/vyos/ifconfig/tunnel.py index a74d50646..2820e2563 100644 --- a/python/vyos/ifconfig/tunnel.py +++ b/python/vyos/ifconfig/tunnel.py @@ -51,9 +51,9 @@ class TunnelIf(Interface): # - https://man7.org/linux/man-pages/man8/ip-link.8.html # - https://man7.org/linux/man-pages/man8/ip-tunnel.8.html mapping = { - 'local_ip' : 'local', - 'remote_ip' : 'remote', + 'source_address' : 'local', 'source_interface' : 'dev', + 'remote_ip' : 'remote', 'parameters.ip.key' : 'key', 'parameters.ip.tos' : 'tos', 'parameters.ip.ttl' : 'ttl', |