3865.2.2
by Gavin Panella
Update copyright notices everywhere. |
1 |
# Copyright 2014-2015 Canonical Ltd. This software is licensed under the
|
3413.1.1
by Raphael Badin
Refactor node listing to display pxe mac first. |
2 |
# GNU Affero General Public License version 3 (see the file LICENSE).
|
3 |
||
4 |
"""MAC-related utilities."""
|
|
5 |
||
6 |
from __future__ import ( |
|
7 |
absolute_import, |
|
8 |
print_function, |
|
9 |
unicode_literals, |
|
10 |
)
|
|
11 |
||
12 |
str = None |
|
13 |
||
14 |
__metaclass__ = type |
|
15 |
__all__ = [ |
|
16 |
'get_vendor_for_mac', |
|
17 |
]
|
|
18 |
||
19 |
from netaddr import ( |
|
20 |
EUI, |
|
21 |
NotRegisteredError, |
|
3629.7.3
by ubuntudotcom1
Make format. |
22 |
)
|
3413.1.1
by Raphael Badin
Refactor node listing to display pxe mac first. |
23 |
|
24 |
||
25 |
def get_vendor_for_mac(mac): |
|
26 |
"""Return vendor for MAC."""
|
|
27 |
data = EUI(mac) |
|
28 |
try: |
|
29 |
return data.oui.registration().org |
|
30 |
except NotRegisteredError: |
|
31 |
return 'Unknown Vendor' |