Simplify code to get controller/switch port