sort hash keys to generate a stable result

using unsorted hash keys technically provides the same result, but
the testcases are unable to validate the generated output
remember mapping from device name to device label / uuid

(the previous code did not work at all)