]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Fix _validate_mac_address method
authorAaron Rosen <aaronorosen@gmail.com>
Sat, 15 Mar 2014 05:57:09 +0000 (22:57 -0700)
committerAaron Rosen <aaronorosen@gmail.com>
Mon, 17 Mar 2014 22:29:57 +0000 (15:29 -0700)
commitb9390333a146d0435710f85d365318268e267fc3
tree45936720e56b335fb4a8c92c5e91d9fec57f9d00
parent2cc1d68f0e9aa32be33096b520b39a099b89fc29
Fix _validate_mac_address method

The method _validate_mac_address previously used: netaddr.EUI(data)
which would convert data passed in to the correct mac_address representation.
For example if data=123 it would return: EUI('00-00-00-00-00-7B'). To fix
this issue I used netaddr.valid_mac() instead which returns a bool if a mac is
valid or not and does not raise. Note this file needs some improvements to
improve how exception handling is done that will come later.

Change-Id: I4fb868e40abbad9e743028cc768f47ca9b3e0e70
Closes-bug: 1291163
neutron/api/v2/attributes.py
neutron/tests/unit/test_attributes.py