Skip to content

Interface 32767 'Other' Type API bug #3967

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

Closed
darcynz opened this issue Jan 21, 2020 · 8 comments
Closed

Interface 32767 'Other' Type API bug #3967

darcynz opened this issue Jan 21, 2020 · 8 comments
Assignees
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@darcynz
Copy link

darcynz commented Jan 21, 2020

ment

  • Python version: 3.7
  • NetBox version: 2.7.1

Steps to Reproduce

  1. View '32767' Type (Other) interface via api eg:
    https://netbox/api/dcim/interfaces/11373/

View API data of the interface

Request Method: GET
http://***/api/dcim/interfaces/9016/
2.2.9
KeyError
'32767'
/opt/netbox/netbox/utilities/api.py in to_representation, line 86
/usr/local/bin/python
3.7.6
['/opt/netbox/netbox', '/usr/local/bin', '/usr/local/lib/python37.zip', '/usr/local/lib/python3.7', '/usr/local/lib/python3.7/lib-dynload', '/usr/local/lib/python3.7/site-packages']
Tue, 21 Jan 2020 16:06:34 +1300
@darcynz darcynz changed the title Interface 32767 Other Type API bug Interface 32767 'Other' Type API bug Jan 21, 2020
@kobayashi
Copy link
Contributor

This issue has been closed as it does not conform to one of the provided templates as required by the contributing guide. If you'd like to request that your issue be re-opened, please first update the content so that it matches the appropriate template (this may require rewriting your issue entirely).

@kobayashi
Copy link
Contributor

Sorry, I found this was discussed in mailing list.

@kobayashi kobayashi reopened this Jan 21, 2020
@kobayashi
Copy link
Contributor

Could you let us know more specific steps to reproduce the issue like parameters of the interface? While I am trying api access to 'Other type' interface, cannot reproduce.

@candlerb
Copy link
Contributor

I can reproduce this. On a system which has been updated from 2.6 to 2.7:

netbox=# select type,count(*) from dcim_interface group by type;
      type      | count
----------------+-------
 virtual        |    44
 lag            |     1
 100base-tx     |     1
 32767          |     2      <<<< NOTE
 ieee802.11g    |     1
 1000base-t     |    44
 ieee802.11n    |     3
 1000base-x-sfp |     3
(8 rows)

That value wasn't updated as part of the migration.

I note that TYPE_OTHER is missing from LEGACY_MAP here. I don't know if this mapping is used as part of the migration logic.

@candlerb
Copy link
Contributor

FYI: in the GUI at /dcim/interfaces/ or /dcim/interfaces/<N>/, the type just displays as "32767".

Checking in code: frontport and rearport never had the choice other, so should be unaffected.

For completeness: I also checked console and power ports in the database. These are showing empty string as the value for type. This doesn't cause a problem with the API, which returns null for the type, nor for the GUI, which allows the type to be unset (--------)

@candlerb
Copy link
Contributor

Quick fix:

# sudo -u postgres psql netbox
netbox=# update dcim_interface set type='other' where type='32767';
netbox=# \q

(but this ought to go into a new migration)

@jeremystretch jeremystretch self-assigned this Jan 21, 2020
@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application labels Jan 21, 2020
@candlerb
Copy link
Contributor

For reference, original report was here.

I wonder if it would also be worth making the line which raised the exception more robust, by changing self._choices[obj] to self._choices.get(obj) ?

@jeremystretch
Copy link
Member

The patch for this did not include interface templates. Re-opening so it can be re-addressed in the next release.

@jeremystretch jeremystretch reopened this Feb 7, 2020
@lock lock bot locked as resolved and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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

4 participants