I think this generator is a bit too complex for this.  What I had in mind is something like:

Class method
def _retryloop(func, attempts=5, delay=1):
    for i in range(attempts):
        yield func()
        time.sleep(delay)

Member methods
def _get_dhcp_port(self):
    do what you have to do to get the port
    return port

def _get_metadata_gw_ip(self, context, subnet):
    for port in _retryloop(self._get_dhcp_port):
        if port is not None:
            return port[0].fixed_ips[0].ip_address
    return None