def pub_SliverStatus(self, slice_xrn=None, creds=[], options={}): try: self.pm.check_permissions("SliverStatus", locals()) except Exception as e: return self.buildPropertyList(GENI_ERROR_CODE.CREDENTIAL_INVALID, output=e) try: slivers = GeniDB.getSliverList() try: sliver = get_slice_details_from_slivers(slivers, slice_xrn) except: raise Exception("Sliver for slice URN (%s) does not exist" % (slice_xrn)) result = dict() result["slice_urn"] = slice_xrn result["sliver_urn"] = sliver["sliver_urn"] result["status"] = sliver["status"] result["created"] = sliver["creation"] result["description"] = sliver["desc"] result["expires"] = sliver["expiration"] propertyList = self.buildPropertyList(GENI_ERROR_CODE.SUCCESS, value=result) except UnknownSlice as e: msg = "Attempt to get status on unknown sliver for slice %s" % (slice_xrn) propertyList = self.buildPropertyList(GENI_ERROR_CODE.SEARCHFAILED, output=msg) e.log(self._log, msg, logging.INFO) 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
def pub_SliverStatus(self, slice_xrn=None, creds=[], options={}): try: self.pm.check_permissions('SliverStatus', locals()) except Exception as e: return self.buildPropertyList(GENI_ERROR_CODE.CREDENTIAL_INVALID, output=e) try: slivers = GeniDB.getSliverList() try: sliver = get_slice_details_from_slivers(slivers, slice_xrn) except: raise Exception("Sliver for slice URN (%s) does not exist" % (slice_xrn)) result = dict() result["slice_urn"] = slice_xrn result["sliver_urn"] = sliver["sliver_urn"] result["status"] = sliver["status"] result["created"] = sliver["creation"] result["description"] = sliver["desc"] result["expires"] = sliver["expiration"] propertyList = self.buildPropertyList(GENI_ERROR_CODE.SUCCESS, value=result) except UnknownSlice as e: msg = "Attempt to get status on unknown sliver for slice %s" % ( slice_xrn) propertyList = self.buildPropertyList(GENI_ERROR_CODE.SEARCHFAILED, output=msg) e.log(self._log, msg, logging.INFO) 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
def pub_DeleteSliver(self, xrn, creds, options={}): """Delete a sliver Stop all the slice's resources and remove the reservation. Returns True or False indicating whether it did this successfully. """ try: self.pm.check_permissions("DeleteSliver", locals()) except Exception as e: return self.buildPropertyList(GENI_ERROR_CODE.CREDENTIAL_INVALID, output=e) self._log.info("Is HERE:") try: slivers = GeniDB.getSliverList() self._log.info("Is HERE:") sliver = get_slice_details_from_slivers(slivers, xrn) self._log.info("Deleteing Sliver") self._log.info(sliver["slice_urn"]) data = GeniDB.getSliverData(sliver["sliver_urn"], True) foam.geni.lib.deleteSliver(sliver_urn=sliver["sliver_urn"]) # foam.task.emailGAPIDeleteSliver(data) propertyList = self.buildPropertyList(GENI_ERROR_CODE.SUCCESS, value=True) except UnknownSlice as e: propertyList = self.buildPropertyList(GENI_ERROR_CODE.SEARCHFAILED, output=msg) except Exception as e: msg = "Exception: %s" % str(e) propertyList = self.buildPropertyList(GENI_ERROR_CODE.ERROR, output=msg) finally: return propertyList
def pub_DeleteSliver(self, xrn, creds, options={}): """Delete a sliver Stop all the slice's resources and remove the reservation. Returns True or False indicating whether it did this successfully. """ try: self.pm.check_permissions('DeleteSliver', locals()) except Exception as e: return self.buildPropertyList(GENI_ERROR_CODE.CREDENTIAL_INVALID, output=e) self._log.info("Is HERE:") try: slivers = GeniDB.getSliverList() self._log.info("Is HERE:") sliver = get_slice_details_from_slivers(slivers, xrn) self._log.info("Deleteing Sliver") self._log.info(sliver["slice_urn"]) data = GeniDB.getSliverData(sliver["sliver_urn"], True) foam.geni.lib.deleteSliver(sliver_urn=sliver["sliver_urn"]) #foam.task.emailGAPIDeleteSliver(data) propertyList = self.buildPropertyList(GENI_ERROR_CODE.SUCCESS, value=True) except UnknownSlice as e: propertyList = self.buildPropertyList(GENI_ERROR_CODE.SEARCHFAILED, output=msg) except Exception as e: msg = "Exception: %s" % str(e) propertyList = self.buildPropertyList(GENI_ERROR_CODE.ERROR, output=msg) finally: return propertyList