def pub_ListResources (self, credentials, options):
    """Return information about available resources or resources allocated to a slice

    List the resources at this aggregate in an RSpec: may be all resources,
    only those available for reservation, or only those already reserved for the given slice.

    """
    try:
      CredVerifier.checkValid(credentials, [])

      # Parse options
      compressed = options.get("geni_compressed", False)
      urn = options.get("geni_slice_urn", None)
      spec_version = options.get("geni_rspec_version")
      supported_spec = {'version': '3', 'type': 'GENI'}
      if spec_version:
        if spec_version != supported_spec:
          msg = "RSpec type/version not supported"
          propertyList = self.buildPropertyList(GENI_ERROR_CODE.BADVERSION, output=msg)
          return propertyList
      else:
        msg = "Required option geni_rspec_version missing"
        propertyList = self.buildPropertyList(GENI_ERROR_CODE.BADARGS, output=msg)
        return propertyList

      if urn:
        CredVerifier.checkValid(credentials, "getsliceresources", urn)
        self.recordAction("listresources", credentials, urn)
        sliver_urn = GeniDB.getSliverURN(urn)
        if sliver_urn is None:
          raise Exception("Sliver for slice URN (%s) does not exist" % (urn))
        else:
          rspec = GeniDB.getManifest(sliver_urn)
      else:
        self.recordAction("listresources", credentials)
        rspec = foam.geni.lib.getAdvertisement()
      if compressed:
        zrspec = zlib.compress(rspec)
        rspec = base64.b64encode(zrspec)

      propertyList = self.buildPropertyList(GENI_ERROR_CODE.SUCCESS, value=rspec)

    except ExpatError:
      msg = "Error parsing credential strings"
      propertyList = self.buildPropertyList(GENI_ERROR_CODE.BADARGS, output=msg)
      self._log.error(msg)
    except UnknownSlice as x:
      # Raised by GeniDB.getSliverURN()
      msg = "Attempt to list resources on sliver for unknown slice %s" % (urn)
      propertyList = self.buildPropertyList(GENI_ERROR_CODE.ERROR, output=msg)
      x.log(self._log, msg, logging.INFO)
    except xmlrpclib.Fault as x:
      # Something thrown via GCF, we'll presume it was something related to credentials
      msg = "GCF credential check failure: <%s>" % (x)
      propertyList = self.buildPropertyList(GENI_ERROR_CODE.ERROR, output=msg)
      self._log.info(msg)
      self._log.debug(x, exc_info=True)
    except __HOLE__ as x:
      # New GCF problem with user creds that have no gid_caller, probably
      msg = "GCF credential check failure: <%s>" % (x)
      propertyList = self.buildPropertyList(GENI_ERROR_CODE.ERROR, output=msg)
      self._log.info(msg)
      self._log.debug(x, exc_info=True)
    except Exception as e:
      msg = "Exception: %s" % str(e)
      propertyList = self.buildPropertyList(GENI_ERROR_CODE.ERROR, output=msg)
      self._log.exception(msg)
    finally:
      return propertyList
dataset/ETHPy150Open fp7-ofelia/ocf/ofam/src/src/foam/api/gapi2.py/AMAPIv2.pub_ListResources