Merge "ovn: Advertise metadata IPv6 route via RA Route Information Option"

This commit is contained in:
Zuul authored and Gerrit Code Review committed 2026-07-13 13:33:36 +00:00
commit 6390bbd3fa
2 files changed
+60

No files matched your search

@@ -1390,6 +1390,10 @@ class OVNClient:
ipv6_ra_configs['send_periodic'] = 'false'
ipv6_ra_configs['mtu'] = str(net['mtu'])
if ipv6_ra_configs and ovn_conf.is_ovn_metadata_enabled():
ipv6_ra_configs['route_info'] = (
'MEDIUM-%s' % const.METADATA_V6_CIDR)
return list(networks), ipv6_ra_configs
def _add_router_ext_gw(self, context, router, txn):
@@ -734,6 +734,62 @@ class TestOVNClient(TestOVNClientBase):
ctx, filters={'id': []})
plugin.get_network.assert_not_called()
def test__get_nets_and_ipv6_ra_confs_metadata_route_info(self):
"""route_info advertises metadata IPv6 address when enabled."""
cfg.CONF.set_override('ovn_metadata_enabled', True, group='ovn')
plugin = mock.MagicMock()
self.get_plugin.return_value = plugin
subnets = [
{'id': 'sub-v6', 'cidr': 'fd00::/64',
'network_id': 'net1', 'ipv6_address_mode': 'slaac'},
]
plugin.get_subnets.return_value = subnets
network = {'id': 'net1', 'mtu': 1500,
'router:external': False}
plugin.get_network.return_value = network
port = {
'fixed_ips': [
{'subnet_id': 'sub-v6', 'ip_address': 'fd00::5'},
],
'device_owner': const.DEVICE_OWNER_ROUTER_INTF,
}
ctx = ncontext.Context()
_, ipv6_ra_configs = (
self.ovn_client._get_nets_and_ipv6_ra_confs_for_router_port(
ctx, port))
self.assertIn('route_info', ipv6_ra_configs)
self.assertEqual('MEDIUM-%s' % const.METADATA_V6_CIDR,
ipv6_ra_configs['route_info'])
def test__get_nets_and_ipv6_ra_confs_no_route_info_metadata_disabled(self):
"""route_info is absent when metadata is disabled."""
cfg.CONF.set_override('ovn_metadata_enabled', False, group='ovn')
plugin = mock.MagicMock()
self.get_plugin.return_value = plugin
subnets = [
{'id': 'sub-v6', 'cidr': 'fd00::/64',
'network_id': 'net1', 'ipv6_address_mode': 'slaac'},
]
plugin.get_subnets.return_value = subnets
network = {'id': 'net1', 'mtu': 1500,
'router:external': False}
plugin.get_network.return_value = network
port = {
'fixed_ips': [
{'subnet_id': 'sub-v6', 'ip_address': 'fd00::5'},
],
'device_owner': const.DEVICE_OWNER_ROUTER_INTF,
}
ctx = ncontext.Context()
_, ipv6_ra_configs = (
self.ovn_client._get_nets_and_ipv6_ra_confs_for_router_port(
ctx, port))
self.assertNotIn('route_info', ipv6_ra_configs)
def _make_fake_lsp(self, name, lsp_type='', options=None):
lsp = mock.Mock()
lsp.name = name