def build_occi_volume(vol):
    name = vol["displayName"]
    vol_id = vol["id"]
    size = vol["size"]
    # TODO(enolfc): use proper status!
    status = "online"

    cats = []
    cats.append('storage; '
                'scheme="http://schemas.ogf.org/occi/infrastructure#"; '
                'class="kind"; '
                'title="storage resource"; '
                'rel="http://schemas.ogf.org/occi/core#resource"; '
                'location="%s/storage/"' % fakes.application_url)
    attrs = [
        'occi.core.title="%s"' % name,
        'occi.storage.size=%s' % size,
        'occi.storage.state="%s"' % status,
        'occi.core.id="%s"' % vol_id,
    ]
    links = []
    links.append('<%s/storage/%s?action=backup>; '
                 'rel="http://schemas.ogf.org/occi/'
                 'infrastructure/storage/action#backup"' %
                 (fakes.application_url, vol_id))
    links.append('<%s/storage/%s?action=resize>; '
                 'rel="http://schemas.ogf.org/occi/'
                 'infrastructure/storage/action#resize"' %
                 (fakes.application_url, vol_id))
    links.append('<%s/storage/%s?action=online>; '
                 'rel="http://schemas.ogf.org/occi/'
                 'infrastructure/storage/action#online"' %
                 (fakes.application_url, vol_id))
    links.append('<%s/storage/%s?action=snapshot>; '
                 'rel="http://schemas.ogf.org/occi/'
                 'infrastructure/storage/action#snapshot"' %
                 (fakes.application_url, vol_id))
    links.append('<%s/storage/%s?action=offline>; '
                 'rel="http://schemas.ogf.org/occi/'
                 'infrastructure/storage/action#offline"' %
                 (fakes.application_url, vol_id))

    result = []
    for c in cats:
        result.append(("Category", c))
    for l in links:
        result.append(("Link", l))
    for a in attrs:
        result.append(("X-OCCI-Attribute", a))
    return result
dataset/ETHPy150Open openstack/ooi/ooi/tests/middleware/test_storage_controller.py/build_occi_volume/original