Is the lunid the equivalent of the WWN?
Yes and no. WWN stands for World Wide (unique) Name, and is a hex number, typically 64 bits, typically in one of the IEEE number series (the 5 at the beginning means something, and I forgot what). They are supposed to be world-wide unique; any manufacturer that ships a device with WWN 50...01 is a scammer (or at least incompetent).
For SCSI devices, there are separate names (all world-wide unique) for the device itself (known in SCSI language as a target), each of the two ports, and each LUN (*). Since normal disks typically have exactly one LUN, that makes four entities that are numbered. As far as I've seen, most manufacturers assign four sequential numbers to these four entities. There are special versions of the SCSI Inquiry command you can use to read all these numbers. So what you can do is mask the lowest two bits off from any WWN you read, and you end up with something that's unique to the disk drive and non-confusing.
As far as I know (and this is not from studying the manuals, only from experience), SATA devices have a single name. SATA doesn't have the concept of LUN, and they have only a single port, so there is no distinction needed.
Footnote: (*) Everyone calls them LUN, when they mean "a part of a disk drive that can be addressed like a virtual disk". That entity is really called Logical Unit or LU; the LUN is the Logical Unit Number. The whole concept started with the first SCSI-connected RAID arrays, where one "device" (a think with one physical port) could have multiple logical things in it. But most people just use the word LUN to refer to the virtual device, when in reality the LUN is just a small integer (traditionally 0...7, 3 bits).
