-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
setting primary IP failes when IP assigments are removed and re-assigned #204
Comments
Can you provide the REST API calls that work for you? |
sure. I have got a little "Layer" between my script and nautobot (authentication and some error handling, nothing more).
|
I apologize for the delay in getting back to this. I was unable to reproduce this error via pynautobot using the demo site (which is currently on 2.2.7) with the following code: from pynautobot import api
url = "https://demo.nautobot.com/"
token = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
nautobot = api(url=url, token=token)
# get device, interface and IP
device = nautobot.dcim.devices.get(name='atl01-sdwan-02')
interface = nautobot.dcim.interfaces.get(device_id=device.id, name='Loopback0')
ip_address = nautobot.ipam.ip_addresses.get(address='192.0.2.1')
## REST OF YOUR ORIGINAL SNIPPET
....
Can you confirm your original code snippet is correct? Your snippet is only removing a single assignment since you are filtering the assignments by the interface and the IP ID's: id_list = nautobot.ipam.ip_address_to_interface.filter(interface=interface.id, ip_address=ip_address.id) Is this maybe a bug in your code or did you provide an incorrect snippet? |
Environment:
nautobot 2.2.5
pynautobot: 2.2.0
Details:
When I remove all existing IP assignmets of an interface, then re-assign all IP addresses to the interface and set the primary IP of the device, the primary IP is NOT set. Using the rest API works well. This could be similar to issue 197!
The follwing code does not work, it deletes the primary IP of the device
When I add the following line to the code
right before setting the primary IP, it works.
I was asked to open this issue (https://networktocode.slack.com/archives/C01NWPK6WHL/p1718816339526429)
The text was updated successfully, but these errors were encountered: