Software Defined Networking (SDN) is a novel approach to building computer networks. Improved flexibility, simplified management and cost reduction promised by SDN makes many see it as the future of networking. The main insight of SDN is the separation of network control and configuration decisions from packet forwarding devices. This way, complex control software development becomes independent of changes in hardware traffic forwarding switches. Relying on a well-defined interface, a controller program can supervise the whole network built of many switches, produced by multiple vendors. I argue however, that this idealized vision is difficult to achieve in practice and that an SDN controller cannot treat all switches equally. There are multiple reasons why switches following the same specification are heterogeneous: unclear specification, implementation difficulties, cost, and human errors. In this dissertation, I describe a two-phase approach to handle switch diversity in SDN. First, I present systematic techniques to detect various differences between devices. SOFT is a method and a tool that uncovers functional differences in switch software. It relies on established software analysis techniques and a novel application of a constraint solver to find inputs that result in distinct behavior of two switches. Further, I design a systematic methodology for switch update performance measurements. A benchmarking tool based on this technique computes update rate characteristics of hardware switches. By additionally tracking interactions between control and data planes during the update, this methodology is capable of revealing inconsistencies showing that the switches do not follow the specification. Finally, I address the most severe issue detected. RUM, a software layer between the controller and the switches masks and fixes incorrect rule update notifications coming from faulty switches. I demonstrate the usefulness of the described solutions by analyzing existing switches. SOFT detected several inconsistencies between two open source software switches. The performance benchmark revealed errors that compromise network security. It also provided detailed switch characteristics that should be taken into account by controller developers to improve network performance. RUM prevents packet drops in a safe network update without requiring any changes to faulty switches.