]> 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)
committerMark McClain <mmcclain@yahoo-inc.com>
Tue, 8 Apr 2014 12:18:16 +0000 (08:18 -0400)
commitbb26eb7253c7fb51acd228c840a5365e1df9ae38
tree6a38019533d60b99c264c318096d567572523cf2
parent82eff3762942b3b46490d30eb3fe28dd40a6c607
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
(cherry picked from commit b9390333a146d0435710f85d365318268e267fc3)
neutron/api/v2/attributes.py
neutron/tests/unit/test_attributes.py