Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions roles/reproducer/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,21 @@ cifmw_reproducer_validate_network_host: "controller-0.utility"
cifmw_reproducer_validate_ocp_layout: true

cifmw_reproducer_ironic_node_name_prefix:

# Optional: Define local_link_connection information for Ironic node ports.
# This is used when generating ironic_nodes.yaml. The structure is a dictionary
# where keys are simplified node names with cifmw_run_id stripped out.
# For example, "ironic-uni04delta-ipv6-0" becomes "ironic-0", or
# "ironic-big-uni04delta-ipv6-1" becomes "ironic-big-1".
# Values are lists of local_link_connection dictionaries, one per NIC in the node.
# Example:
# cifmw_reproducer_ironic_local_link_connections:
# ironic-0:
# - switch_info: leaf01.netlab.local
# switch_id: "22:57:f8:dd:04:01"
# port_id: "ethernet1/1"
# ironic-big-1:
# - switch_info: leaf02.netlab.local
# switch_id: "22:57:f8:dd:04:02"
# port_id: "ethernet1/2"
cifmw_reproducer_ironic_local_link_connections: {}
24 changes: 18 additions & 6 deletions roles/reproducer/tasks/generate_bm_info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,23 @@
{% for node in libvirt_manager_bm_info_data.keys() if node.startswith(cifmw_reproducer_ironic_node_name_prefix) %}
{% set _node = libvirt_manager_bm_info_data[node] %}
{% set _conn = _node.connection | urlsplit %}
{% set _run_id_suffix = (cifmw_run_id | default('') | length > 0) | ternary('-' ~ (cifmw_run_id | lower), '') %}
{% set _simple_key = node | regex_replace(_run_id_suffix ~ '(?=-\d+$)', '') if _run_id_suffix else node %}
{% set _ports = [] %}
{% for nic in _node.nics %}
{% set _port_index = loop.index0 %}
{% set _port = {
'address': nic.mac,
'physical_network': nic.network
} %}
{% if _simple_key in cifmw_reproducer_ironic_local_link_connections and
cifmw_reproducer_ironic_local_link_connections[_simple_key] | length > _port_index %}
{% set _ = _port.update({
'local_link_connection': cifmw_reproducer_ironic_local_link_connections[_simple_key][_port_index]
}) %}
{% endif %}
{% set _ = _ports.append(_port) %}
{% endfor %}
{% set _ironic_nodes = _ironic_nodes.append(
{
'name': node,
Expand All @@ -141,12 +158,7 @@
'redfish_username': _node.username,
'redfish_password': _node.password,
},
'ports': [
{
'address': (_node.nics | first).mac,
'physical_network': (_node.nics | first).network,
}
]
'ports': _ports
}
) %}
{% endfor %}
Expand Down