Replies: 1 comment
-
|
This is what worked for me. You first have to assign the mac address to the interface, then you can set it as primary nb_mac_address = nb.dcim.mac_addresses.get(id=1)
example_interface = nb.dcim.interfaces.get(id=1)
nb_mac_address.assigned_object_type = "dcim.interface"
nb_mac_address.assigned_object_id = example_interface.id
nb_mac_address.save()
example_interface.primary_mac_address = nb_mac_address.id
example_interface.save() |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey, my Netbox is on version 4.2.7 currently, therefore the MAC adresses are handled as seperate objects that can be assigned to an interface. However, I can't figure out how to set those with the current version of Pynetbox. As the MAC address is no "normal" attribute of the interface anymore, setting it with the normal "update({'mac_address': ....)" method does not seem to work. How can I set or create a MAC address for an interface with the current Pynetbox version?
Beta Was this translation helpful? Give feedback.
All reactions