'Create three v3 endpoint refs based on a legacy ref.'

@controller.v2_deprecated
def create_endpoint(self, request, endpoint):

    self.assert_admin(request)
    self._require_attribute(endpoint, 'publicurl')
    self._require_attribute(endpoint, 'service_id')
    for interface in INTERFACES:
        interface_url = endpoint.get((interface + 'url'))
        if interface_url:
            utils.check_endpoint_url(interface_url)
    if (endpoint.get('region') is not None):
        try:
            self.catalog_api.get_region(endpoint['region'])
        except exception.RegionNotFound:
            region = dict(id=endpoint['region'])
            self.catalog_api.create_region(region, initiator=request.audit_initiator)
    legacy_endpoint_ref = endpoint.copy()
    urls = {}
    for i in INTERFACES:
        url = ('%surl' % i)
        if endpoint.get(url):
            urls[i] = endpoint.pop(url)
        elif (url in endpoint):
            endpoint.pop(url)
            legacy_endpoint_ref.pop(url)
    legacy_endpoint_id = uuid.uuid4().hex
    for (interface, url) in urls.items():
        endpoint_ref = endpoint.copy()
        endpoint_ref['id'] = uuid.uuid4().hex
        endpoint_ref['legacy_endpoint_id'] = legacy_endpoint_id
        endpoint_ref['interface'] = interface
        endpoint_ref['url'] = url
        endpoint_ref['region_id'] = endpoint_ref.pop('region', None)
        self.catalog_api.create_endpoint(endpoint_ref['id'], endpoint_ref, initiator=request.audit_initiator)
    legacy_endpoint_ref['id'] = legacy_endpoint_id
    return {'endpoint': legacy_endpoint_ref}
