Skip to content

Commit 69e1b24

Browse files
hjensasevallesp
authored andcommitted
[reproducer] local_link_connection for ironic node
Add optional cifmw_reproducer_ironic_local_link_connections variable to include local_link_connection data when generating ironic_nodes.yaml. Also iterate through all NICs instead of just the first one. For OSP17 IPv6, we must use the neutron network interface driver in Ironic. The local_link_connection data is mandatory on ports when using the neutron driver. Jira: OSPRH-20021 Signed-off-by: Harald Jensås <[email protected]>
1 parent 5ef63bb commit 69e1b24

File tree

2 files changed

+37
-6
lines changed

2 files changed

+37
-6
lines changed

roles/reproducer/defaults/main.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,21 @@ cifmw_reproducer_validate_network_host: "controller-0.utility"
4848
cifmw_reproducer_validate_ocp_layout: true
4949

5050
cifmw_reproducer_ironic_node_name_prefix:
51+
52+
# Optional: Define local_link_connection information for Ironic node ports.
53+
# This is used when generating ironic_nodes.yaml. The structure is a dictionary
54+
# where keys are simplified node names with cifmw_run_id stripped out.
55+
# For example, "ironic-uni04delta-ipv6-0" becomes "ironic-0", or
56+
# "ironic-big-uni04delta-ipv6-1" becomes "ironic-big-1".
57+
# Values are lists of local_link_connection dictionaries, one per NIC in the node.
58+
# Example:
59+
# cifmw_reproducer_ironic_local_link_connections:
60+
# ironic-0:
61+
# - switch_info: leaf01.netlab.local
62+
# switch_id: "22:57:f8:dd:04:01"
63+
# port_id: "ethernet1/1"
64+
# ironic-big-1:
65+
# - switch_info: leaf02.netlab.local
66+
# switch_id: "22:57:f8:dd:04:02"
67+
# port_id: "ethernet1/2"
68+
cifmw_reproducer_ironic_local_link_connections: {}

roles/reproducer/tasks/generate_bm_info.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,24 @@
131131
{% for node in libvirt_manager_bm_info_data.keys() if node.startswith(cifmw_reproducer_ironic_node_name_prefix) %}
132132
{% set _node = libvirt_manager_bm_info_data[node] %}
133133
{% set _conn = _node.connection | urlsplit %}
134+
{% set _run_id_suffix = (cifmw_run_id | default('') | length > 0) | ternary('-' ~ (cifmw_run_id | lower), '') %}
135+
{#- Strip run_id from node name to get simplified node name for local_link_connection lookup -#}
136+
{% set _simplified_node_name = node | regex_replace(_run_id_suffix ~ '(?=-\d+$)', '') if _run_id_suffix else node %}
137+
{% set _ports = [] %}
138+
{% for nic in _node.nics %}
139+
{% set _port_index = loop.index0 %}
140+
{% set _port = {
141+
'address': nic.mac,
142+
'physical_network': nic.network
143+
} %}
144+
{% if _simplified_node_name in cifmw_reproducer_ironic_local_link_connections and
145+
cifmw_reproducer_ironic_local_link_connections[_simplified_node_name] | length > _port_index %}
146+
{% set _ = _port.update({
147+
'local_link_connection': cifmw_reproducer_ironic_local_link_connections[_simplified_node_name][_port_index]
148+
}) %}
149+
{% endif %}
150+
{% set _ = _ports.append(_port) %}
151+
{% endfor %}
134152
{% set _ironic_nodes = _ironic_nodes.append(
135153
{
136154
'name': node,
@@ -141,12 +159,7 @@
141159
'redfish_username': _node.username,
142160
'redfish_password': _node.password,
143161
},
144-
'ports': [
145-
{
146-
'address': (_node.nics | first).mac,
147-
'physical_network': (_node.nics | first).network,
148-
}
149-
]
162+
'ports': _ports
150163
}
151164
) %}
152165
{% endfor %}

0 commit comments

Comments
 (0)