Page MenuHomePhabricator

Add switch interface and cable support to AssignIPs script
Closed, ResolvedPublic

Description

Prerequisite for T262899.

We need to add the switch config to the server provisioning automation and the AssignIPs script seems ideal for that based on the order of steps defined in:
https://wikitech.wikimedia.org/wiki/Server_Lifecycle#Requested_-%3E_Planned_additional_steps_&_Spare_-%3E_Planned

This would only be for "regular" servers. Most complex setups, like trunked ports, multiple NICs, etc.. would need to be done manually in Netbox.

The current idea is to add the following fields to https://netbox.wikimedia.org/extras/scripts/interface_automation/AssignIPs/

  • Switch interface name
  • Cable ID
  • Cable type (mostly to distinguish between fiber and DAC, unless we set it to the correct one later on using PuppetDB)

Then the extra data needed and derived from other sources:

  • Switch name, derived from device's rack
  • VLAN, from the existing script fields
  • switch interface type, derived from port name
  • Cable color, derived from cable type

Additionally from its original purpose the script would:

  1. Create the switch interface if not present
  2. Configure or update the switch interface (status, vlan, type)
  3. Connect the PRIMARY server interface to the aforementioned switch interface

Then a Homer run from the operator would be needed to apply the changes to the switch.

This could optionally be extended to support management cables by asking the operator:

  • Management cable ID
  • Management switch port

Which would create the mgmt switch port and connect the mgmt cable.

Additionally, a report for mismatch interfaces type on either-side of the cable would be a nice plus.

Event Timeline

One limitation though is that the current AssignIP script accepts multiple devices (space separated).
Adding support for cables/switch interfaces means either:

  • Expecting a space separated list of cables/interfaces, which is quite error prone
  • Expecting a CSV/YAML like input of devices and their properties, which is a possible next Q goal

In the meantime I was wondering how much the script was used with multiple devices.
And if it would be ok to make it "single device" to support network provisioning until we have a proper mass-creation support.
@wiki_willy @Papaul @Cmjohnson

Hi @ayounsi, Papaul and I talked about this a little bit today, and I think there are some additional questions that we have to gain some context. Are you free for a 15-30min sync up sometime next week, after Monday? Thanks, Willy

One limitation though is that the current AssignIP script accepts multiple devices (space separated).
Adding support for cables/switch interfaces means either:

  • Expecting a space separated list of cables/interfaces, which is quite error prone
  • Expecting a CSV/YAML like input of devices and their properties, which is a possible next Q goal

In the meantime I was wondering how much the script was used with multiple devices.
And if it would be ok to make it "single device" to support network provisioning until we have a proper mass-creation support.
@wiki_willy @Papaul @Cmjohnson

after Monday

Tuesday works for me :)

Thanks @ayounsi. I have it set for 9-9:30am PT (11-11:30am CT) on Tuesday with you and @Papaul

Tuesday works for me :)

Change 635385 had a related patch set uploaded (by Ayounsi; owner: Ayounsi):
[operations/software/netbox-extras@master] Update AssignIPs to handle switch port and cable

https://gerrit.wikimedia.org/r/635385

Change 635853 had a related patch set uploaded (by Ayounsi; owner: Ayounsi):
[operations/software/netbox-extras@master] AssingIPs, cleanup and standardize logs format

https://gerrit.wikimedia.org/r/635853

Change 635385 merged by Ayounsi:
[operations/software/netbox-extras@master] Update AssignIPs to handle switch port and cable

https://gerrit.wikimedia.org/r/635385

ayounsi claimed this task.

This is done. Some CRs are still open for CSV import and log formatting.

Change 635853 merged by Ayounsi:
[operations/software/netbox-extras@master] ProvisionServerNetwork, cleanup and standardize logs format

https://gerrit.wikimedia.org/r/635853