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

Bug in Interface when providing MAC address as an integer #111

Closed
jathanism opened this issue Oct 20, 2015 · 0 comments
Closed

Bug in Interface when providing MAC address as an integer #111

jathanism opened this issue Oct 20, 2015 · 0 comments
Labels

Comments

@jathanism
Copy link
Contributor

The serializer for the API endpoint for Interfaces is casting incoming integer representations of MAC addresses as strings, thereby storing them incorrectly.

For example:

# This should be '00:1c:73:2a:60:62'
>>> import netaddr
>>> mac = 122191241314
>>> print netaddr.EUI(mac, dialect=netaddr.mac_unix_expanded)
00:1c:73:2a:60:62

# This should NOT be '12:21:91:24:13:14'
>>> print netaddr.EUI(str(mac), dialect=netaddr.mac_unix_expanded)
12:21:91:24:13:14

I've confirmed that the mac_address field for nsot.api.serializers.InterfaceSerializer is a CharField and needs to be corrected.

@jathanism jathanism added the bug label Oct 20, 2015
jathanism added a commit to jathanism/nsot that referenced this issue Oct 20, 2015
- Integers are no longer being improperly cast to strings and then back
  to an incorrect integer representation. (fixes dropbox#111)
- Added extra unit tests and regression tests for this bug.
- Moved all references to exceptions into `nsot.exc`.
- Moved email validator to `nsot.validators`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant