From 426f04bd60604d22b48a8498d7fe871db4db1cb1 Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Thu, 23 Aug 2012 15:44:36 -0400 Subject: [PATCH 1/1] removing deprecated methods --- sfa/methods/CreateSliver.py | 57 ------------------------------------- sfa/methods/Start.py | 37 ------------------------ sfa/methods/Stop.py | 37 ------------------------ sfa/methods/UpdateSliver.py | 33 --------------------- sfa/methods/reset_slice.py | 30 ------------------- 5 files changed, 194 deletions(-) delete mode 100644 sfa/methods/CreateSliver.py delete mode 100644 sfa/methods/Start.py delete mode 100644 sfa/methods/Stop.py delete mode 100644 sfa/methods/UpdateSliver.py delete mode 100644 sfa/methods/reset_slice.py diff --git a/sfa/methods/CreateSliver.py b/sfa/methods/CreateSliver.py deleted file mode 100644 index 27974891..00000000 --- a/sfa/methods/CreateSliver.py +++ /dev/null @@ -1,57 +0,0 @@ -from sfa.util.faults import SfaInvalidArgument, InvalidRSpec -from sfa.util.xrn import urn_to_hrn -from sfa.util.method import Method -from sfa.util.sfatablesRuntime import run_sfatables -from sfa.trust.credential import Credential -from sfa.storage.parameter import Parameter, Mixed -from sfa.rspecs.rspec import RSpec - -class CreateSliver(Method): - """ - Allocate resources to a slice. This operation is expected to - start the allocated resources asynchornously after the operation - has successfully completed. Callers can check on the status of - the resources using SliverStatus. - - @param slice_urn (string) URN of slice to allocate to - @param credentials ([string]) of credentials - @param rspec (string) rspec to allocate - - """ - interfaces = ['aggregate', 'slicemgr'] - accepts = [ - Parameter(str, "Slice URN"), - Mixed(Parameter(str, "Credential string"), - Parameter(type([str]), "List of credentials")), - Parameter(str, "RSpec"), - Parameter(type([]), "List of user information"), - Parameter(dict, "options"), - ] - returns = Parameter(str, "Allocated RSpec") - - def call(self, slice_xrn, creds, rspec, users, options): - hrn, type = urn_to_hrn(slice_xrn) - - self.api.logger.info("interface: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, hrn, self.name)) - - # Find the valid credentials - valid_creds = self.api.auth.checkCredentials(creds, 'createsliver', hrn) - origin_hrn = Credential(string=valid_creds[0]).get_gid_caller().get_hrn() - - # make sure users info is specified - if not users: - msg = "'users' must be specified and cannot be null. You may need to update your client." - raise SfaInvalidArgument(name='users', extra=msg) - - # flter rspec through sfatables - if self.api.interface in ['aggregate']: - chain_name = 'INCOMING' - elif self.api.interface in ['slicemgr']: - chain_name = 'FORWARD-INCOMING' - self.api.logger.debug("CreateSliver: sfatables on chain %s"%chain_name) - rspec = run_sfatables(chain_name, hrn, origin_hrn, rspec) - slivers = RSpec(rspec).version.get_nodes_with_slivers() - if not slivers: - raise InvalidRSpec("Missing or element. Request rspec must explicitly allocate slivers") - result = self.api.manager.CreateSliver(self.api, slice_xrn, creds, rspec, users, options) - return result diff --git a/sfa/methods/Start.py b/sfa/methods/Start.py deleted file mode 100644 index 14122225..00000000 --- a/sfa/methods/Start.py +++ /dev/null @@ -1,37 +0,0 @@ -from sfa.util.xrn import urn_to_hrn -from sfa.util.method import Method - -from sfa.trust.credential import Credential - -from sfa.storage.parameter import Parameter, Mixed - -class Start(Method): - """ - Start the specified slice - - @param xrn human readable name of slice to instantiate (hrn or urn) - @param cred credential string specifying the rights of the caller - @return 1 is successful, faults otherwise - """ - - interfaces = ['aggregate', 'slicemgr', 'component'] - - accepts = [ - Parameter(str, "Human readable name of slice to start (hrn or urn)"), - Mixed(Parameter(str, "Credential string"), - Parameter(type([str]), "List of credentials")), - ] - - returns = Parameter(int, "1 if successful") - - def call(self, xrn, creds): - hrn, type = urn_to_hrn(xrn) - valid_creds = self.api.auth.checkCredentials(creds, 'startslice', hrn) - - #log the call - origin_hrn = Credential(string=valid_creds[0]).get_gid_caller().get_hrn() - self.api.logger.info("interface: %s\tcaller-hrn: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, origin_hrn, hrn, self.name)) - - self.api.manager.start_slice(self.api, xrn, creds) - - return 1 diff --git a/sfa/methods/Stop.py b/sfa/methods/Stop.py deleted file mode 100644 index 0d802827..00000000 --- a/sfa/methods/Stop.py +++ /dev/null @@ -1,37 +0,0 @@ -from sfa.util.xrn import urn_to_hrn -from sfa.util.method import Method - -from sfa.trust.credential import Credential - -from sfa.storage.parameter import Parameter, Mixed - -class Stop(Method): - """ - Stop the specified slice - - @param cred credential string specifying the rights of the caller - @param xrn human readable name of slice to instantiate (hrn or urn) - @return 1 is successful, faults otherwise - """ - - interfaces = ['aggregate', 'slicemgr', 'component'] - - accepts = [ - Parameter(str, "Human readable name of slice to instantiate (hrn or urn)"), - Mixed(Parameter(str, "Credential string"), - Parameter(type([str]), "List of credentials")), - ] - - returns = Parameter(int, "1 if successful") - - def call(self, xrn, creds): - hrn, type = urn_to_hrn(xrn) - valid_creds = self.api.auth.checkCredentials(creds, 'stopslice', hrn) - - #log the call - origin_hrn = Credential(string=valid_creds[0]).get_gid_caller().get_hrn() - self.api.logger.info("interface: %s\tcaller-hrn: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, origin_hrn, hrn, self.name)) - - self.api.manager.stop_slice(self.api, xrn, creds) - - return 1 diff --git a/sfa/methods/UpdateSliver.py b/sfa/methods/UpdateSliver.py deleted file mode 100644 index 72910d74..00000000 --- a/sfa/methods/UpdateSliver.py +++ /dev/null @@ -1,33 +0,0 @@ -from sfa.storage.parameter import Parameter, Mixed - -from sfa.methods.CreateSliver import CreateSliver - -class UpdateSliver(CreateSliver): - """ - Allocate resources to a slice. This operation is expected to - start the allocated resources asynchornously after the operation - has successfully completed. Callers can check on the status of - the resources using SliverStatus. - - @param slice_urn (string) URN of slice to allocate to - @param credentials ([string]) of credentials - @param rspec (string) rspec to allocate - - """ - interfaces = ['aggregate', 'slicemgr'] - accepts = [ - Parameter(str, "Slice URN"), - Mixed(Parameter(str, "Credential string"), - Parameter(type([str]), "List of credentials")), - Parameter(str, "RSpec"), - Parameter(type([]), "List of user information"), - Parameter(dict, "options"), - ] - returns = Parameter(str, "Allocated RSpec") - - - - def call(self, slice_xrn, creds, rspec, users, options): - - return CreateSliver.call(self, slice_xrn, creds, rspec, users, options) - diff --git a/sfa/methods/reset_slice.py b/sfa/methods/reset_slice.py deleted file mode 100644 index c3975ffd..00000000 --- a/sfa/methods/reset_slice.py +++ /dev/null @@ -1,30 +0,0 @@ -from sfa.util.xrn import urn_to_hrn -from sfa.util.method import Method - -from sfa.storage.parameter import Parameter, Mixed - -class reset_slice(Method): - """ - Reset the specified slice - - @param cred credential string specifying the rights of the caller - @param xrn human readable name of slice to instantiate (hrn or urn) - @return 1 is successful, faults otherwise - """ - - interfaces = ['aggregate', 'slicemgr', 'component'] - - accepts = [ - Parameter(str, "Credential string"), - Parameter(str, "Human readable name of slice to instantiate (hrn or urn)"), - Mixed(Parameter(str, "Human readable name of the original caller"), - Parameter(None, "Origin hrn not specified")) - ] - - returns = Parameter(int, "1 if successful") - - def call(self, cred, xrn, origin_hrn=None): - hrn, type = urn_to_hrn(xrn) - self.api.auth.check(cred, 'resetslice', hrn) - self.api.manager.reset_slice (self.api, xrn) - return 1 -- 2.43.0