In order to discover the topology of a fully-interconnected-switched network which contains no routers, and divide the network into some VLANs depending on the switch they are physically connected to, I needed to detect firstly if two nodes are connected physically to the same switch.
Since, switches don't rewrite Ethernet frames, and don't leave their own signature on traversing frames, I needed to use LLDP because there is no other reliable mean (Of course there are some special configuration to be done on the switch to avoid traversing LLDP frames).
So, each switch should firstly broadcast LLDP frame which is to be stored in the MIB of the processes.
My Question: Is it possible (from machine A1 connected to switch A) to know the MAC address of the switch connected to machine Xn by using SNMP?
Yes, it is. With SNMP and LLDP it is possible to map the entire network. However, this requires that all devices and switches in the network actually support both SNMP and LLDP, and have it enabled. Unmanaged switches typically have no support for this.