networking_baremetal.agent package

Submodules

networking_baremetal.agent.agent_config module

Configuration options for ironic-neutron-agent.

networking_baremetal.agent.agent_config.list_opts()

Return a list of oslo_config options for config generation.

Returns:

list of (group_name, options) tuples

networking_baremetal.agent.agent_config.register_agent_opts(conf)

Register all agent configuration options.

Parameters:

conf – oslo_config.cfg.ConfigOpts instance

networking_baremetal.agent.agent_config.register_baremetal_agent_opts(conf)

Register baremetal agent configuration options (deprecated).

Prefer register_agent_opts() instead.

Parameters:

conf – oslo_config.cfg.ConfigOpts instance

networking_baremetal.agent.agent_config.register_l2vni_opts(conf)

Register L2VNI configuration options (deprecated).

Prefer register_agent_opts() instead.

Parameters:

conf – oslo_config.cfg.ConfigOpts instance

networking_baremetal.agent.ironic_neutron_agent module

class networking_baremetal.agent.ironic_neutron_agent.BaremetalNeutronAgent

Bases: ServiceBase

cleanup_stale_agents()

Cleans up stale baremetal agents

This method identifies baremetal agents that are marked as inactive in the Neutron server and are not associated with any nodes in Ironic. It then deletes these stale agents.

get_template_node_state(node_uuid)
reset()

Reset service.

Called in case a service running in daemon mode receives SIGHUP.

start()

Start service.

stop(failure=False)

Stop service.

wait()

Wait for service to complete.

class networking_baremetal.agent.ironic_neutron_agent.HashRingMemberManagerNotificationEndpoint

Bases: object

Class variables members and hashring is shared by all instances

filter_rule = <oslo_messaging.notify.filter.NotificationFilter object>
hashring = <tooz.hashring.HashRing object>
info(ctxt, publisher_id, event_type, payload, metadata)
members = []
networking_baremetal.agent.ironic_neutron_agent.list_opts()
networking_baremetal.agent.ironic_neutron_agent.main()

networking_baremetal.agent.l2vni_trunk_manager module

L2VNI Trunk Reconciliation Manager.

Manages trunk ports and subports for OVN network nodes to ensure only required VLANs are trunked to each chassis based on ha_chassis_group membership and network requirements.

Architecture: - One Neutron network per OVN ha_chassis_group for anchor port modeling - One shared subport anchor network for all trunk subports - Anchor ports (trunk parents) attach to ha_chassis_group networks - Subports signal VLAN bindings to ML2 switch plugins - Stateless reconciliation based on current OVN/Neutron state

class networking_baremetal.agent.l2vni_trunk_manager.L2VNITrunkManager(neutron_client, ovn_nb_idl, ovn_sb_idl, ironic_client, member_manager=None, agent_id=None)

Bases: object

Manages L2VNI trunk ports and subports for network nodes.

reconcile()

Main reconciliation entry point.

Performs stateless reconciliation of trunk infrastructure: 1. Ensure ha_chassis_group networks exist 2. Ensure subport anchor network exists 3. Discover/create trunk ports for chassis 4. Calculate required VLANs per chassis from OVN state 5. Reconcile subports to match requirements 6. Clean up unused infrastructure

reconcile_single_vlan(network_id, physnet, vlan_id, action='add')

Targeted reconciliation for a single VLAN.

Called by OVN event handlers when a specific localnet port is created or deleted. Much faster than full reconciliation because we already know which VLAN to add/remove.

Parameters:
  • network_id – Neutron network UUID (tenant network with VLAN)

  • physnet – Physical network name

  • vlan_id – VLAN ID to add or remove

  • action – ‘add’ for CREATE events, ‘remove’ for DELETE events

networking_baremetal.agent.ovn_client module

OVN client connections for agent.

class networking_baremetal.agent.ovn_client.AgentOvnNbIdl(remote, schema, **kwargs)

Bases: OvsdbIdl

Custom OVN NB IDL with event handler support for agent.

Extends the standard OvsdbIdl to add RowEvent notification support. This allows the agent to watch for specific OVN database changes (e.g., localnet port creation) and trigger immediate reconciliation.

notify(event, row, updates=None)

Called by IDL when database changes occur.

Forwards notifications to registered RowEvent handlers.

class networking_baremetal.agent.ovn_client.AgentOvnSbIdl(remote, schema, **kwargs)

Bases: OvsdbIdl

Custom OVN SB IDL with event handler support for agent.

Extends the standard OvsdbIdl to add RowEvent notification support. This allows the agent to watch for specific OVN database changes and trigger immediate reconciliation if needed.

notify(event, row, updates=None)

Called by IDL when database changes occur.

Forwards notifications to registered RowEvent handlers.

networking_baremetal.agent.ovn_client.get_ovn_nb_event_idl()

Get OVN Northbound IDL connection for event watching only.

This connection registers only the minimal set of tables needed for event watching, significantly reducing event notification overhead. Use this connection for registering RowEvent handlers.

For queries and updates, use get_ovn_nb_idl() instead.

Returns:

OVN NB API instance (event-watching connection)

networking_baremetal.agent.ovn_client.get_ovn_nb_idl()

Get OVN Northbound IDL connection.

Returns:

OVN NB API instance

networking_baremetal.agent.ovn_client.get_ovn_sb_idl()

Get OVN Southbound IDL connection.

Returns:

OVN SB API instance

networking_baremetal.agent.ovn_events module

OVN RowEvent handlers for L2VNI reconciliation.

class networking_baremetal.agent.ovn_events.HAChassisGroupNetworkEvent(agent)

Bases: BaseEvent

Trigger router HA binding for HA Chassis group create/update.

Watches for CREATE and UPDATE events on HA_Chassis_Group table where the group is network-level (has neutron:network_id in external_ids but not neutron:router_id).

Uses hash ring to filter events so only the agent responsible for the network processes the event.

Fixes LP#2144458 by enabling immediate router interface binding instead of waiting for periodic reconciliation. Related to LP#1995078 (networking-baremetal side of the solution).

events = ('create', 'update')
match_fn(event, row, old=None)

Filter for HA chassis groups with network_id owned by this agent.

Returns True only if: 1. HA chassis group has neutron:network_id in external_ids 2. This agent owns the network (hash ring check)

Note: We process groups with network_id regardless of whether they also have router_id. In unified HA chassis group scenarios, the same group is used for both the network and router.

Parameters:
  • event – Event type (ROW_CREATE or ROW_UPDATE)

  • row – OVN HA_Chassis_Group row

  • old – Previous row state (for UPDATE events)

Returns:

True if event should be processed, False otherwise

run(event, row, old)

Trigger router interface binding for the network.

Parameters:
  • event – Event type (ROW_CREATE or ROW_UPDATE)

  • row – OVN HA_Chassis_Group row

  • old – Previous row state (for UPDATE events)

table: str = 'HA_Chassis_Group'
class networking_baremetal.agent.ovn_events.LocalnetPortEvent(agent)

Bases: BaseEvent

Trigger L2VNI reconciliation when localnet ports are created or deleted.

Watches for CREATE and DELETE events on Logical_Switch_Port table where type=localnet and the port name follows L2VNI naming convention (contains ‘-localnet-‘).

Uses hash ring to filter events so only the agent responsible for the network processes the event.

CREATE events trigger immediate reconciliation to add required subports. DELETE events trigger immediate reconciliation to remove obsolete subports, ensuring fast cleanup for security and resource isolation.

events = ('create', 'delete')
match_fn(event, row, old=None)

Filter for L2VNI localnet ports owned by this agent.

Returns True only if: 1. Port type is localnet 2. Port name follows L2VNI naming: neutron-<uuid>-localnet-<physnet> 3. This agent owns the network (hash ring check)

Note: Event type filtering (CREATE/DELETE only) is handled by the parent BaseEvent.matches() method, which ensures UPDATE events are filtered out before this method is called.

Parameters:
  • event – Event type (ROW_CREATE or ROW_DELETE)

  • row – OVN Logical_Switch_Port row

  • old – Previous row state (unused for CREATE events)

Returns:

True if event should be processed, False otherwise

run(event, row, old)

Trigger targeted L2VNI reconciliation for specific VLAN.

Parameters:
  • event – Event type (ROW_CREATE or ROW_DELETE)

  • row – OVN Logical_Switch_Port row

  • old – Previous row state (used for DELETE events)

table: str = 'Logical_Switch_Port'

networking_baremetal.agent.router_ha_binding module

Router HA Binding Manager.

Manages HA chassis group binding for router interface ports on VLAN networks with baremetal nodes. Ensures router interface ports are bound to the same HA chassis group as the network’s external ports, enabling router-to-baremetal communication on physical networks.

This is related to LP#1995078 where baremetal nodes on VLAN networks cannot communicate with their router gateway because the router’s internal interface port (LRP) is not bound to any chassis.

This fixes LP#2144458 by providing event-driven HA chassis group binding, eliminating the multi-minute connectivity delays caused by periodic-only reconciliation.

class networking_baremetal.agent.router_ha_binding.RouterHABindingManager(neutron_client, ovn_nb_idl, member_manager, agent_id)

Bases: object

Manages HA chassis group binding for router interface ports.

Ensures router interface ports on VLAN networks are bound to the same HA chassis group as the network’s external ports, enabling router-to- baremetal communication on physical networks.

This manager is event-driven, responding to HA_Chassis_Group creation events to immediately bind router interface ports when network-level HA chassis groups are created.

bind_router_interfaces_for_network(network_id, ha_chassis_group)

Bind router interface ports to network’s HA chassis group.

This is the main entry point called by event handlers when a network HA chassis group is created or updated. It finds all router interface ports on the network and binds them to the specified HA chassis group.

Parameters:
  • network_id – Neutron network UUID

  • ha_chassis_group – OVN HA_Chassis_Group UUID or name

reconcile()

Periodic reconciliation of router HA binding.

Discovers all networks with HA chassis groups and ensures their router interface ports are bound to those groups. This catches:

  1. Routers added to networks after HA chassis group exists

  2. Missed events (agent down/restarting during event)

  3. Race conditions or out-of-order event processing

  4. Manual changes to LRP ha_chassis_group settings

This method is called periodically (default: 600s / 10 minutes) to ensure eventual consistency even if event-driven binding fails.

Module contents