Skip to content

feat(ironic): cisco_nxos follow-ups: endpoint URL, clearer errors, richer inspection - #2827

Merged
cardoe merged 6 commits into
mainfrom
cisco-nxos-review-followups
Dec 1, 2026
Merged

cardoe merged 6 commits into
mainfrom
cisco-nxos-review-followups

Conversation

@cardoe

@cardoe cardoe commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Follow-ups to #2825: review feedback, plus fixes from running the driver against a real Nexus (C93180YC-FX3, NX-OS 10.5(6)) in dev.

NX-API endpoint as a URL (review feedback)

  • driver_info['nxos_address'] is now a URL, so switches whose NX-API isn't on 443 work by putting the port in the URL (e.g. https://192.0.2.20:8443). The scheme defaults to https, a bare IPv6 address is bracketed, and the path defaults to /ins unless one is given. A bare address such as 192.0.2.20 still works as before.
  • validate() rejects an address that isn't an http/https URL, has an invalid port, or carries credentials, a query or a fragment.
  • NxosClient takes the endpoint URL instead of building it.
  • rfc3986 (already installed via ironic) is now a direct dependency since it's imported.
  • Rewords the nxos_address property description and the components_from_show_version docstring per Steve's suggestions.

The port handling addresses Kenny's comment about NX-API not being on 443.

Fail fast and explain an unreachable switch

The dev switch had nxapi https port set to a non-default port, and manage sat for 60s before failing with urllib3's raw HTTPSConnectionPool(...) Max retries exceeded ... at 0x....

  • Connect and read timeouts are now separate: 10s to connect, still 60s to read.
  • Failures are a short reason naming the resolved endpoint, e.g. Cannot read the firmware version from NX-API https://192.0.2.20/ins: timed out connecting after 10s; check 'show nxapi' on the switch: .... TLS failures give the underlying cause.
  • When NX-API rejects a whole batch with one error that matches no command (e.g. a null id), that error is reported for each command instead of "no response".

BIOS firmware component

show version's bios_ver_str is recorded as the bios firmware component next to nxos. Each is only recorded if reported.

Inspection inventory, and no more ports from the driver

Inspect now reads the switch's hardware into the inventory, all in the same single NX-API request:

Inventory key From
cpu (model_name, count) show version, show system resources
memory (total, physical_mb) show version
interfaces[].transceiver (type, vendor, part number, revision, serial, Cisco product ID) show interface transceiver
components (chassis, slots, PSUs, fans with description, product ID, version ID, serial) show inventory
chassis_mac, as its own key the way agent inspection keeps bmc_mac show vdc detail

Only show version and show interface are required; a switch that can't answer the rest is logged, not failed. interfaces is always present, even if empty; the other keys are left out when not reported.

Other changes:

  • system_vendor.product_name is the bare model (C93180YC-FX3) instead of cisco Nexus9000 C93180YC-FX3 Chassis. A platform with no separate model keeps its family name (Nexus 5548 Chassis is Nexus 5548).
  • Inspection rules now run after NX-OS inspect, as redfish does. Before, they never ran for these nodes, so existing rules whose conditions match a switch will start applying.
  • Inspect no longer creates or corrects baremetal ports. That's left to a future inspection hook working from interfaces. Ports created by the earlier code are left alone.
  • Inspect no longer writes properties['chassis_mac'] or reads show running-config lldp. The plugin data is now empty: nxos_version duplicated the firmware component and lldp_chassis_id was unused. NxosClient.show_text() and parse_lldp_chassis_id() had no other callers and are removed.

[cisco_nxos] inspection_hooks

A comma-separated list of inspection hooks, like [redfish] inspection_hooks, run on the collected data before it's stored and rules are applied. It's empty by default, because the standard hooks expect a server's inventory; it's where a ports hook for switches will be enabled.

docs/design-guide/ironic.md is updated to match.

@cardoe
cardoe enabled auto-merge November 30, 2026 19:38
@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Python test results

532 tests  ±0   532 ✅ ±0   4s ⏱️ ±0s
  1 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit af97e91. ± Comparison against base commit 3de43af.

♻️ This comment has been updated with latest results.

@cardoe
cardoe requested a review from a team November 30, 2026 19:59
driver_info nxos_address is now a URL, so a switch whose NX-API is not
on 443 can be reached: the port goes in the URL. https is assumed when
the scheme is missing, a bare IPv6 address is bracketed, and the path
defaults to /ins (NX-API's endpoint) unless one is given. A bare
address such as 192.0.2.20 still works as before.

An address that is not an http or https URL, has an invalid port, or
carries credentials, a query or a fragment fails validate(). The
address is parsed with rfc3986, now a direct dependency (it was already
installed through ironic).

NxosClient now takes the endpoint URL rather than building it from the
address.

Also reword the nxos_address and components_from_show_version
descriptions per review on #2825.
@cardoe
cardoe force-pushed the cisco-nxos-review-followups branch from c21acaf to 28c62ef Compare November 30, 2026 20:00
@cardoe cardoe changed the title feat(ironic): take the cisco_nxos NX-API endpoint as a URL feat(ironic): cisco_nxos follow-ups: endpoint URL, clearer errors, richer inspection Nov 30, 2026
@cardoe
cardoe force-pushed the cisco-nxos-review-followups branch from f4903e5 to f172fc4 Compare November 30, 2026 22:51
A switch whose NX-API is disabled, on another port, in another VRF or
behind an ACL drops the connection rather than refusing it. With a
single 60s timeout, verify held the node's lock for a minute before
failing. Connecting now times out after 10s; reading still allows 60s,
since show commands on a large chassis can be slow.

The failure was reported as urllib3's retry wrapper
("HTTPSConnectionPool(...) Max retries exceeded ... at 0x..."). It is
now a short reason with a pointer to 'show nxapi' for connect timeouts
and refusals, the underlying cause for TLS failures, and the resolved
NX-API endpoint (with its port and path) rather than the raw
nxos_address.
show version reports the switch BIOS version as bios_ver_str alongside
the NX-OS release. Record it as the bios firmware component, the name
redfish uses for a server's BIOS, next to nxos. Each component is only
recorded if the switch reports it, so a switch reporting only one of
the two still gets that one.
Inspect now fills the inventory with what the switch reports about its
hardware, all read in the same single NX-API request:

- cpu: model_name from show version and count, the logical CPUs in
  show system resources
- memory: total and physical_mb from show version (the memory NX-OS
  sees, a little under what is installed), converted to an integer
  where a release reports it as a string
- interfaces[].transceiver: type, vendor, part number, revision, serial
  and, for Cisco-coded optics, the Cisco product ID, from
  show interface transceiver
- components: the chassis, slots, power supplies and fans from
  show inventory, with description, product, version ID and serial
- chassis_mac: the switch MAC, as its own key the way agent inspection
  keeps bmc_mac, since it is not a port

Only show version and show interface are required; a switch that
cannot answer the rest is logged, not failed. interfaces is always in
the inventory, even when empty; the other keys are left out when not
reported.

system_vendor.product_name is now the bare model instead of show
version's chassis_id: the leading "cisco", "Chassis" and anything after
it, and the family when a model follows it, are dropped. So
"cisco Nexus9000 C93180YC-FX3 Chassis" is C93180YC-FX3, while a
platform with no separate model keeps its family name ("Nexus 5548
Chassis" is "Nexus 5548"). Inspection rules are now applied after the
data is stored, as redfish inspection does; before, rules never ran for
these nodes.

Inspect no longer creates or corrects baremetal ports; that is left to
an inspection hook working from the inventory's interfaces. It also no
longer writes properties['chassis_mac'] or reads show running-config
lldp. The plugin data is now empty: nxos_version duplicated the nxos
firmware component, and lldp_chassis_id was unused. NxosClient.show_text
and parse_lldp_chassis_id had no other callers and are removed.
Like [redfish] inspection_hooks: a comma-separated list of inspection
hooks the cisco_nxos inspect interface loads at startup and runs on the
data it collects, before storing it and applying inspection rules, in
the same order as redfish inspection.

It is empty by default because the standard hooks (such as ports)
expect a server's inventory. This gives a ports hook for switches a
place to be enabled once it exists.
When NX-API rejects a whole batch, for example as too large, it can
answer with a single JSON-RPC error that matches none of the commands'
ids, often with a null id. Each command was then reported as "no
response" and the switch's message was lost. Report that error for
every command instead.

It only applies when the answer is a lone error matching no command, so
an unmatched success, or a batch where some commands were answered,
is still reported as before.

@khackworth khackworth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

@cardoe
cardoe added this pull request to the merge queue Dec 1, 2026
Merged via the queue into main with commit 91840ab Dec 1, 2026
171 of 175 checks passed
@cardoe
cardoe deleted the cisco-nxos-review-followups branch December 1, 2026 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants