It looks like the gateway port is create in the call to super().update_router. This is called before we query for the ports, and so we can expect the port to exist by the time we get here.