Skip to content
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

Post API on available IP in prefix (/32) marked fully utilized #13105

Closed
Etibru opened this issue Jul 6, 2023 · 2 comments
Closed

Post API on available IP in prefix (/32) marked fully utilized #13105

Etibru opened this issue Jul 6, 2023 · 2 comments
Assignees
Labels
severity: medium Results in substantial degraded or broken functionality for specfic workflows status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@Etibru
Copy link

Etibru commented Jul 6, 2023

NetBox version

v3.5.4

Python version

3.10

Steps to Reproduce

  1. Create prefixes (ex: 10.10.10.1/32) and check "Mark utilized"
  2. From the API, use endpoint "/api/ipam/prefixes/{id}/available-ips/" with Request body empty or not
    ==> Error 500: Internal Server Error

Problem found on netbox version 3.4.8 and tested if still pressing on latest version

Expected Behavior

We would like to have the IP created back

Observed Behavior

Error Error 500: Internal Server Error

{
  "error": "'list' object has no attribute 'size'",
  "exception": "AttributeError",
  "netbox_version": "3.5.4",
  "python_version": "3.10.6"
}

Or in netbox version 3.4.8 :
erreur 500 : Internal server Error

<!DOCTYPE html>
<html lang="en">

<head>
    <title>Server Error</title>
    <link rel="stylesheet" href="/static/netbox-light.css" />
    <meta charset="UTF-8">
</head>

<body>
    <div class="container-fluid">
        <div class="row">
            <div class="col col-md-6 offset-md-3">
                <div class="card border-danger mt-5">
                    <h5 class="card-header">
                        <i class="mdi mdi-alert"></i> Server Error
                    </h5>
                    <div class="card-body">
                        
                            <p>
                                There was a problem with your request. Please contact an administrator.
                            </p>
                        
                        <hr />
                        <p>
                            The complete exception is provided below:
                        </p>
<pre class="block"><strong>&lt;class &#x27;AttributeError&#x27;&gt;</strong><br />
&#x27;list&#x27; object has no attribute &#x27;size&#x27;

Python version: 3.10.6
NetBox version: 3.4.8</pre>
                        <p>
                            If further assistance is required, please post to the <a href="https://github.com/netbox-community/netbox/discussions">NetBox discussion forum</a> on GitHub.
                        </p>
                        <div class="text-end">
                            <a href="/" class="btn btn-primary">Home Page</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>

</html>
@Etibru Etibru added the type: bug A confirmed report of unexpected behavior in the application label Jul 6, 2023
@abhi1693
Copy link
Member

abhi1693 commented Jul 6, 2023

Thank you for opening a bug report. Unfortunately, the information you have provided is not sufficient for someone else to attempt to reproduce the reported behavior. Remember, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. Also be sure that your report does not reference data on the public NetBox demo, as that is subject to change at any time by an outside party and cannot be relied upon for bug reports.

@abhi1693 abhi1693 added the status: revisions needed This issue requires additional information to be actionable label Jul 6, 2023
@Etibru
Copy link
Author

Etibru commented Jul 6, 2023

In just two steps and from a newly installed version of netbox, the bug goes back up.
I repeat my steps
1- Create a prefix (from the web or API), make sure the "Mark utilized" box is checked.
2- From the API and on this endpoint "/api/ipam/prefixes/{id}/available-ips/" (with the id corresponding to the prefix previously created) perform a POST, with the Request body empty or not.

The procedure with curl

  1. Create prefix:
curl -X 'POST' \
  'http://localhost:8000/api/ipam/prefixes/' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'X-CSRFTOKEN: m0i3TRrAfE1UNCRRx4vFMZQ8ZdJ6o2ZvmbIG2gjUpnEAU71IFjAO5VJsLq7LnPkB' \
  -d '{
  "prefix": "10.10.10.1/32",
  "mark_utilized": true
}'

response:

{
  "id": 3,
  "url": "http://localhost:8000/api/ipam/prefixes/3/",
  "display": "10.10.10.1/32",
  "prefix": "10.10.10.1/32",
  "site": null,
  "vrf": null,
  "tenant": null,
  "vlan": null,
  "status": {
    "value": "active",
    "label": "Active"
  },
  "role": null,
  "is_pool": false,
  "mark_utilized": true,
  "description": "",
  "comments": "",
  "tags": [],
  "custom_fields": {},
  "created": "2023-07-06T15:00:36.951408Z",
  "last_updated": "2023-07-06T15:00:36.951423Z",
  "children": 0,
  "_depth": 0
}
  1. Post an IP address object in prefix
curl -X 'POST' \
  'http://localhost:8000/api/ipam/prefixes/3/available-ips/' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'X-CSRFTOKEN: m0i3TRrAfE1UNCRRx4vFMZQ8ZdJ6o2ZvmbIG2gjUpnEAU71IFjAO5VJsLq7LnPkB' \
  -d '{}'

response:

{
  "error": "'list' object has no attribute 'size'",
  "exception": "AttributeError",
  "netbox_version": "3.5.4",
  "python_version": "3.10.6"
}

@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation severity: medium Results in substantial degraded or broken functionality for specfic workflows and removed status: revisions needed This issue requires additional information to be actionable labels Jul 10, 2023
@jeremystretch jeremystretch self-assigned this Jul 10, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
severity: medium Results in substantial degraded or broken functionality for specfic workflows status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

3 participants