'Extracts the resource id from the provided resource.
This method validates the input resource dict and checks that the
properties which names are passed in `props` argument match
corresponding lists in `allowed` argument. In case of mismatch
exception of type exc is raised.
:param resource: Resource dict.
:param allowed_vals: Tuple of allowed values lists.
:param exc: Exception type to raise.
:param resource_name: Name of resource - used to construct log message.
:param props: Tuple of resource properties names to validate.
:return: Id of a resource.'

@staticmethod
def _extract_resource(resource, allowed_vals, exc, resource_name, props=('status',)):

    resource_id = None
    if resource:
        for (prop, allowed_states) in zip(props, allowed_vals):
            if (resource[prop] not in allowed_states):
                msg = _("Originating    %(res)s    %(prop)s    must    be    one    of    '%(vals)s'    values")
                msg = (msg % {'res': resource_name, 'prop': prop, 'vals': ',    '.join(allowed_states)})
                raise exc(reason=msg)
            resource_id = resource['id']
    return resource_id
