56 lines
828 B
Plaintext
56 lines
828 B
Plaintext
|
=IEEE EUI-64 Identifier Tests=
|
||
|
|
||
|
Copyright (c) 2008-2012, David P. D. Moss. All rights reserved.
|
||
|
|
||
|
{{{
|
||
|
|
||
|
>>> from netaddr import *
|
||
|
|
||
|
}}}
|
||
|
|
||
|
Basic operations.
|
||
|
|
||
|
{{{
|
||
|
|
||
|
>>> mac = EUI('00-1B-77-49-54-FD')
|
||
|
>>> mac
|
||
|
EUI('00-1B-77-49-54-FD')
|
||
|
|
||
|
>>> eui = mac.eui64()
|
||
|
>>> eui
|
||
|
EUI('00-1B-77-FF-FE-49-54-FD')
|
||
|
|
||
|
>>> int(eui) == 7731765737772285
|
||
|
True
|
||
|
|
||
|
>>> eui.packed
|
||
|
'\x00\x1bw\xff\xfeIT\xfd'
|
||
|
|
||
|
>>> eui.bin
|
||
|
'0b11011011101111111111111111110010010010101010011111101'
|
||
|
|
||
|
>>> eui.bits()
|
||
|
'00000000-00011011-01110111-11111111-11111110-01001001-01010100-11111101'
|
||
|
|
||
|
}}}
|
||
|
|
||
|
IPv6 interoperability
|
||
|
|
||
|
{{{
|
||
|
|
||
|
>>> mac = EUI('00-1B-77-49-54-FD')
|
||
|
|
||
|
>>> eui = mac.eui64()
|
||
|
|
||
|
>>> mac
|
||
|
EUI('00-1B-77-49-54-FD')
|
||
|
|
||
|
>>> eui
|
||
|
EUI('00-1B-77-FF-FE-49-54-FD')
|
||
|
|
||
|
>>> mac.ipv6_link_local()
|
||
|
IPAddress('fe80::21b:77ff:fe49:54fd')
|
||
|
|
||
|
>>> eui.ipv6_link_local()
|
||
|
IPAddress('fe80::21b:77ff:fe49:54fd')
|