'Get Ryu datapath object for the switch.'

def _get_dp_by_dpid(self, dpid_int):

    timeout_sec = cfg.CONF.OVS.of_connect_timeout
    start_time = timeutils.now()
    while True:
        dp = ofctl_api.get_datapath(self._app, dpid_int)
        if (dp is not None):
            break
        if (timeutils.now() > (start_time + timeout_sec)):
            m = _('Switch    connection    timeout')
            LOG.error(m)
            raise RuntimeError(m)
        eventlet.sleep(1)
    return dp
