Learning switch configurations