diff options
| author | Viacheslav Hletenko <v.gletenko@vyos.io> | 2025-01-24 15:26:27 +0000 |
|---|---|---|
| committer | Viacheslav Hletenko <v.gletenko@vyos.io> | 2025-01-24 15:34:33 +0000 |
| commit | 9425dce22f1bc8393d5ea6b2ae39b4ef70b7fa50 (patch) | |
| tree | 26b8356d17e6d03a9e86f5dfc2e8443a460f21cb /src | |
| parent | 912128ab9a6d0272c67b199050c0a9b1bf79b24f (diff) | |
| download | vyos-1x-9425dce22f1bc8393d5ea6b2ae39b4ef70b7fa50.tar.gz vyos-1x-9425dce22f1bc8393d5ea6b2ae39b4ef70b7fa50.zip | |
GRE: Add ability to configure multipoint mode
Add ability to configure multipoint mode.
Remote IP address in this case has to be 0.0.0.0
Only one tunnel with the same source IP is allowed in the
point-to-multipoint mode
set vpp interfaces gre gre0 mode 'point-to-multipoint'
set vpp interfaces gre gre0 remote '0.0.0.0'
set vpp interfaces gre gre0 source-address '192.0.2.1'
Diffstat (limited to 'src')
| -rw-r--r-- | src/conf_mode/vpp_interfaces_gre.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/conf_mode/vpp_interfaces_gre.py b/src/conf_mode/vpp_interfaces_gre.py index 4cb1a71ea..334725994 100644 --- a/src/conf_mode/vpp_interfaces_gre.py +++ b/src/conf_mode/vpp_interfaces_gre.py @@ -124,13 +124,27 @@ def verify(config): return None # source-address and remote are mandatory options - required_keys = {'source_address', 'remote', 'tunnel_type'} + required_keys = {'source_address', 'remote', 'mode', 'tunnel_type'} if not all(key in config for key in required_keys): missing_keys = required_keys - set(config.keys()) raise ConfigError( f"Required options are missing: {', '.join(missing_keys).replace('_', '-')}" ) + # check multipoint mode + if config.get('mode') == 'point-to-multipoint': + # For multipoint mode, remote IP must be 0.0.0.0 + if config.get('remote') != '0.0.0.0': + raise ConfigError('For point-to-multipoint mode, remote must be 0.0.0.0') + # Only one multipoint GRE tunnel is allowed from the same source address + for ifname, iface in config.get('vpp_interfaces', {}).items(): + if iface.get('mode') == 'point-to-multipoint' and iface.get( + 'source_address' + ) == config.get('source_address'): + raise ConfigError( + 'Only one multipoint GRE tunnel is allowed from the same source address' + ) + # Change 'vpp interfaces gre greX kernel-interface vpp-tunX' # => 'vpp interfaces gre greX kernel-interface vpp-tunY' # check if we have kernel interface config 'vpp kernel-interface vpp-tunX' @@ -159,8 +173,9 @@ def apply(config): src_addr = config.get('source_address') dst_addr = config.get('remote') kernel_interface = config.get('kernel_interface', '') + mode = config.get('mode') tunnel_type = config.get('tunnel_type') - i = GREInterface(ifname, src_addr, dst_addr, tunnel_type, kernel_interface) + i = GREInterface(ifname, src_addr, dst_addr, tunnel_type, mode, kernel_interface) i.add() # Add kernel-interface (LCP) if interface is not exist |
