Just a shot in the dark here, but I thought I'd ask in case anyone has some ideas:
I've got a testing scenario where some (GUI-less/embedded) IPv6 devices are going to be temporarily plugged into the ports of a managed Ethernet switch, and a control program (running on a separate Linux PC, also connected to the switch) will detect when one of these devices appears on the LAN, and automatically run a test to make sure the device is working correctly.
There will typically be a dozen or so of these devices connected at once (so we can run tests in parallel), and devices will be connected and disconnected on a regular basis by people who don't necessarily know anything about networking; they only know how to plug in an Ethernet cable, then (some hours later) look at the PC's screen to see if the test passed or not.
The issue at hand how to indicate to the testing person when a particular device has failed a test. One option is for the error log/message to include the device's MAC address (derived from its link-local IPv6 address), and that might be sufficient in a pinch, but it would be much nicer if the testing program could also say something like "The device connected to port #5 isn't working right, have a look at that one". That way the tester can just follow the ethernet cable to faulty device, rather than having to figure out what each device's MAC address is until he/she finds the matching one.
I don't think that it's possible for the Linux computer to tell which switch port a particular device is connected to (let me know if I'm wrong about that). But assuming that's the case, the next best thing would be if I could program the switch to do MAC address translations, e.g. so that any device that is plugged in to port #n always appears (to the Linux computer) as if it has MAC address foo:bar:baz:n, and therefore shows up as IPv6 address fe80::2foo:bar:baz:n. If the switch did MAC address translation like that, then the control software could determine which port the device was connected to simply by looking at the last section of the fake MAC address.
So my question is, is this behavior something that any managed Ethernet switches support? If so, what is this feature called (so I can find a switch that does it)? If not, is there a better approach to this problem that I should be looking at instead?
I've never heard of a switch that can translate a MAC address. What most good managed switches will let you do, however, is query the bridge table via SNMP: dot1dBridge.dot1dTpFdbTable in the standard Bridge MIB looks like the way to go. You'll need to convert the MAC address to decimal and append it to the MIB prefix, and it'll spit out the port it learned it on. There's some added trickery if you need to deal with VLANs.
http://wiki.xdroop.com/space/snmp/Switching+Tables has an example.