Skip to content

Instantly share code, notes, and snippets.

@robinsmidsrod
Last active Dec 10, 2015
Embed
What would you like to do?
Some Enterprise-grade HP servers seems to identify with the wrong UUID to iPXE.
#!perl
use strict;
use warnings;
use Test::More;
my $actual_uuid = '1F00B3E0-00C6-0800-2C4A-BCAEC5280EAD';
my $ipxe_uuid = 'e0b3001f-c600-0008-2c4a-bcaec5280ead';
is( convert_ipxe_uuid($ipxe_uuid), $actual_uuid, "iPXE UUID converted successfully" );
done_testing();
exit;
sub convert_ipxe_uuid {
my ($ipxe_uuid) = @_;
my @parts = split /-/, uc $ipxe_uuid;
$parts[0] = reverse_hex($parts[0]);
$parts[1] = reverse_hex($parts[1]);
$parts[2] = reverse_hex($parts[2]);
return uc join("-", @parts);
}
sub reverse_hex {
my ($hex_str) = @_;
return unpack("H*",
join("",
reverse
split("",
pack("H*", $hex_str)
)
)
);
}
@robinsmidsrod
Copy link
Author

robinsmidsrod commented Dec 31, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment