A method is provided of determining a layer-2 topology of an IT infrastructure which includes layer-2 interconnect devices having ports. A list of layer-2 interconnect devices available in the IT infrastructure is obtained. Uplink and non-uplink ports of layer-2 interconnect devices are determined. All the, or a subset of the, layer-2 interconnect devices are assigned to one initial group. The initial group is iteratively refined by selecting a layer-2 interconnect device and assigning all layer-2 interconnect devices reachable via its non-uplink ports to new subgroups.