Repository navigation
feat(ironic): add a cisco_nxos hardware type for Nexus switches - #2825
Conversation
Move the code that stores a driver's reported versions as Ironic firmware components out of panos_firmware into utils/firmware_components.sync() so other out-of-band firmware interfaces can reuse it. A component whose version changed also has the new version recorded as last_version_flashed, as before.
Python test results875 tests 875 ✅ 9s ⏱️ Results for commit 9143cf2. ♻️ This comment has been updated with latest results. |
98833fd to
9feff02
Compare
Add a `cisco_nxos` hardware type: a netdev with inspect and firmware interfaces that read the switch over NX-API (JSON-RPC over HTTPS). Both only run `show` commands and never change the switch. Inspect creates a baremetal port named `<node>:<interface>` for each physical Ethernet interface, carrying the interface's burned-in MAC, so a server's LLDP data from its BMC can be matched to switch ports. It never deletes ports, and a port whose MAC or name is already used by another port is logged and skipped rather than failing inspection. NX-OS sends each interface's MAC as the LLDP chassis ID by default and the switch MAC with `lldp chassis-id switch`, so inspect also records the switch MAC from `show vdc detail` as properties['chassis_mac'], and stores inspection data whose plugin data says which mode the switch is in (`lldp_chassis_id`, from `show running-config lldp`). Neither of those, nor a missing firmware version, fails inspection. The inventory's system_vendor holds the manufacturer, model and serial number from `show version`, shaped like redfish inspection's; inspect does not write them to the node, leaving that to inspection rules. The structured commands are sent as one JSON-RPC batch, so inspection makes two requests to the switch. The firmware interface records the running NX-OS release as a firmware component, without the switch's make, model or serial; updating is not implemented. driver_info takes `nxos_address`, `nxos_username`, `nxos_password` and `nxos_verify_ca`, named like the redfish driver's. The credentials and verify_ca fall back to the new [cisco_nxos] config group. Enable `cisco_nxos` for the ironic component's hardware types, firmware and inspect interfaces.
9feff02 to
9143cf2
Compare
|
@cardoe -
|
|
@khackworth so with regards to the ports, my initial attempt here is to do away with the data collection we need to do to import these into Nautobot. I'm game for changing all of this to how it makes sense. |
| from ironic_understack.utils import nxos_api | ||
|
|
||
| REQUIRED_PROPERTIES = { | ||
| "nxos_address": "Address of the switch's management interface, " |
There was a problem hiding this comment.
| "nxos_address": "Address of the switch's management interface, " | |
| "nxos_address": "IP address of the switch's management interface, " |
|
|
||
|
|
||
| def components_from_show_version(version: dict) -> list[dict]: | ||
| """Return the ``nxos`` component, or nothing if no release is reported.""" |
There was a problem hiding this comment.
| """Return the ``nxos`` component, or nothing if no release is reported.""" | |
| """Return the ``nxos`` component, or the empty list if no release is reported.""" |
|
I'm worried that we are collecting data with no automatic way to "refresh" it periodically. I'd be worried that we're adding steps to the process, except we have promised if we add switches here, we will no longer need to add those switches to nautobot. Also, the discovery piece here means we need to enter less data than we did before. |
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.
Adds a
cisco_nxosIronic hardware type for Cisco Nexus switches. It's a netdev with inspect and firmware interfaces that read the switch over NX-API (JSON-RPC over HTTPS,feature nxapi). Both interfaces only runshowcommands and never change the switch.Commits
panos_firmwareintoutils/firmware_components.sync(). Behaviour is unchanged.Inspect
<node>:<EthernetX/Y>for each physical Ethernet interface, carrying the interface's burned-in MAC. A server's LLDP data from its iDRAC can then be matched to switch ports.show vdc detailasproperties['chassis_mac']. NX-OS sends each interface's MAC as the LLDP chassis ID by default, and the switch MAC whenlldp chassis-id switchis configured.lldp_chassis_id(switchorinterface, read fromshow running-config lldp), so you can tell which MAC to match against.system_vendorholdsmanufacturer,product_name(the chassis model) andserial_numberfromshow version, shaped like redfish inspection's, with any field the switch doesn't report left out. Inspect doesn't write them to the node, so inspection rules can copy them (e.g. toextra.serial).show version,show interfaceandshow vdc detailgo to the switch in one batched request, andshow running-config lldpin a second.Firmware
Records the running NX-OS release as the
nxosfirmware component. The switch's make, model and serial aren't part of it; they're in the inspection data. This runs as a verify, clean and service step. Updating firmware isn't implemented.Configuration
nxos_address,nxos_username,nxos_passwordandnxos_verify_ca, named like the redfish driver's.verify_cafall back to the new[cisco_nxos]config group.cisco_nxosas a hardware type and as a firmware and inspect interface.Testing
show vdc detail;cli_asciireply format;