fix(network): cable

https://github.com/netbox-community/netbox/issues/9102
This commit is contained in:
clbu 2024-10-10 23:15:55 +02:00
parent 818c835711
commit 1429fedb9d
No known key found for this signature in database
GPG key ID: 0891443A5398527F

View file

@ -556,10 +556,12 @@ class ServerNetwork(Network):
switch_ip,
))
cable = nb.dcim.cables.create(
termination_a_id=nb_server_interface.id,
termination_a_type="dcim.interface",
termination_b_id=nb_switch_interface.id,
termination_b_type="dcim.interface",
a_terminations=[
{"object_type": "dcim.interface", "object_id": nb_server_interface.id},
],
b_terminations=[
{"object_type": "dcim.interface", "object_id": nb_switch_interface.id},
],
)
nb_server_interface.cable = cable
logging.info(
@ -579,7 +581,7 @@ class ServerNetwork(Network):
switch_ip, switch_interface, nb_server_interface
)
else:
nb_sw_int = nb_server_interface.cable.termination_b
nb_sw_int = nb_server_interface.cable.b_terminations[0]
nb_sw = nb_sw_int.device
nb_mgmt_int = nb.dcim.interfaces.get(
device_id=nb_sw.id,