Upgrade switch

The final commit updates and fixes unit tests for switch.py.

nx_switch.py still needs some work, but we can deal with that later.