From: Thierry Parmentelat Date: Fri, 5 Feb 2010 17:27:49 +0000 (+0000) Subject: cleanup v42 legacy - GetSlivers exports 'interfaces' - needs related change in nm X-Git-Tag: PLCAPI-5.0-2^2~7 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=4b46356836b21e665c5a3424e0a249cac31e594e;p=plcapi.git cleanup v42 legacy - GetSlivers exports 'interfaces' - needs related change in nm --- diff --git a/PLC/API.py b/PLC/API.py index c4ec4c2..4e75ae3 100644 --- a/PLC/API.py +++ b/PLC/API.py @@ -84,7 +84,6 @@ except ImportError: from PLC.Config import Config from PLC.Faults import * import PLC.Methods -import PLC.Legacy import PLC.Accessors def import_deep(name): diff --git a/PLC/Legacy/AddNodeNetwork.py b/PLC/Legacy/AddNodeNetwork.py deleted file mode 100644 index 7fdfd79..0000000 --- a/PLC/Legacy/AddNodeNetwork.py +++ /dev/null @@ -1,13 +0,0 @@ -# $Id$ -# $URL$ -from PLC.v42Legacy import patch -from PLC.v42LegacyNodeNetworks import v42rename, v43rename -from PLC.Methods.AddInterface import AddInterface -class AddNodeNetwork(AddInterface): - """ Legacy version of AddInterface. """ - status = "deprecated" - def call(self, auth, node_id_or_hostname, interface_fields): - node_id_or_hostname=patch(node_id_or_hostname,v42rename) - interface_fields=patch(interface_fields,v42rename) - result=AddInterface.call(self,auth,node_id_or_hostname,interface_fields) - return patch(result,v43rename) diff --git a/PLC/Legacy/AddNodeNetworkSetting.py b/PLC/Legacy/AddNodeNetworkSetting.py deleted file mode 100644 index d2421c9..0000000 --- a/PLC/Legacy/AddNodeNetworkSetting.py +++ /dev/null @@ -1,14 +0,0 @@ -# $Id$ -# $URL$ -from PLC.v42Legacy import patch -from PLC.v42LegacyNodeNetworkSettings import v42rename, v43rename -from PLC.Methods.AddInterfaceTag import AddInterfaceTag -class AddNodeNetworkSetting(AddInterfaceTag): - """ Legacy version of AddInterfaceTag. """ - status = "deprecated" - def call(self, auth, interface_id, tag_type_id_or_name, value): - interface_id=patch(interface_id,v42rename) - tag_type_id_or_name=patch(tag_type_id_or_name,v42rename) - value=patch(value,v42rename) - result=AddInterfaceTag.call(self,auth,interface_id,tag_type_id_or_name,value) - return patch(result,v43rename) diff --git a/PLC/Legacy/AddNodeNetworkSettingType.py b/PLC/Legacy/AddNodeNetworkSettingType.py deleted file mode 100644 index cdfc0d1..0000000 --- a/PLC/Legacy/AddNodeNetworkSettingType.py +++ /dev/null @@ -1,12 +0,0 @@ -# $Id$ -# $URL$ -from PLC.v42Legacy import patch -from PLC.v42LegacyNodeNetworkSettingTypes import v42rename, v43rename -from PLC.Methods.AddTagType import AddTagType -class AddNodeNetworkSettingType(AddTagType): - """ Legacy version of AddTagType. """ - status = "deprecated" - def call(self, auth, tag_type_fields): - tag_type_fields=patch(tag_type_fields,v42rename) - result=AddTagType.call(self,auth,tag_type_fields) - return patch(result,v43rename) diff --git a/PLC/Legacy/AddSliceAttribute.py b/PLC/Legacy/AddSliceAttribute.py deleted file mode 100644 index 15c8412..0000000 --- a/PLC/Legacy/AddSliceAttribute.py +++ /dev/null @@ -1,16 +0,0 @@ -# $Id$ -# $URL$ -from PLC.v42Legacy import patch -from PLC.v42LegacySliceAttributes import v42rename, v43rename -from PLC.Methods.AddSliceTag import AddSliceTag -class AddSliceAttribute(AddSliceTag): - """ Legacy version of AddSliceTag. """ - status = "deprecated" - def call(self, auth, slice_id_or_name, tag_type_id_or_name, value, node_id_or_hostname = None, nodegroup_id_or_name = None): - slice_id_or_name=patch(slice_id_or_name,v42rename) - tag_type_id_or_name=patch(tag_type_id_or_name,v42rename) - value=patch(value,v42rename) - node_id_or_hostname=patch(node_id_or_hostname,v42rename) - nodegroup_id_or_name=patch(nodegroup_id_or_name,v42rename) - result=AddSliceTag.call(self,auth,slice_id_or_name,tag_type_id_or_name,value,node_id_or_hostname,nodegroup_id_or_name) - return patch(result,v43rename) diff --git a/PLC/Legacy/AddSliceAttributeType.py b/PLC/Legacy/AddSliceAttributeType.py deleted file mode 100644 index b75efb6..0000000 --- a/PLC/Legacy/AddSliceAttributeType.py +++ /dev/null @@ -1,12 +0,0 @@ -# $Id$ -# $URL$ -from PLC.v42Legacy import patch -from PLC.v42LegacySliceAttributeTypes import v42rename, v43rename -from PLC.Methods.AddTagType import AddTagType -class AddSliceAttributeType(AddTagType): - """ Legacy version of AddTagType. """ - status = "deprecated" - def call(self, auth, tag_type_fields): - tag_type_fields=patch(tag_type_fields,v42rename) - result=AddTagType.call(self,auth,tag_type_fields) - return patch(result,v43rename) diff --git a/PLC/Legacy/DeleteNodeNetwork.py b/PLC/Legacy/DeleteNodeNetwork.py deleted file mode 100644 index 426457e..0000000 --- a/PLC/Legacy/DeleteNodeNetwork.py +++ /dev/null @@ -1,12 +0,0 @@ -# $Id$ -# $URL$ -from PLC.v42Legacy import patch -from PLC.v42LegacyNodeNetworks import v42rename, v43rename -from PLC.Methods.DeleteInterface import DeleteInterface -class DeleteNodeNetwork(DeleteInterface): - """ Legacy version of DeleteInterface. """ - status = "deprecated" - def call(self, auth, interface_id): - interface_id=patch(interface_id,v42rename) - result=DeleteInterface.call(self,auth,interface_id) - return patch(result,v43rename) diff --git a/PLC/Legacy/DeleteNodeNetworkSetting.py b/PLC/Legacy/DeleteNodeNetworkSetting.py deleted file mode 100644 index 05d76ee..0000000 --- a/PLC/Legacy/DeleteNodeNetworkSetting.py +++ /dev/null @@ -1,12 +0,0 @@ -# $Id$ -# $URL$ -from PLC.v42Legacy import patch -from PLC.v42LegacyNodeNetworkSettings import v42rename, v43rename -from PLC.Methods.DeleteInterfaceTag import DeleteInterfaceTag -class DeleteNodeNetworkSetting(DeleteInterfaceTag): - """ Legacy version of DeleteInterfaceTag. """ - status = "deprecated" - def call(self, auth, interface_tag_id): - interface_tag_id=patch(interface_tag_id,v42rename) - result=DeleteInterfaceTag.call(self,auth,interface_tag_id) - return patch(result,v43rename) diff --git a/PLC/Legacy/DeleteNodeNetworkSettingType.py b/PLC/Legacy/DeleteNodeNetworkSettingType.py deleted file mode 100644 index ef3517b..0000000 --- a/PLC/Legacy/DeleteNodeNetworkSettingType.py +++ /dev/null @@ -1,12 +0,0 @@ -# $Id$ -# $URL$ -from PLC.v42Legacy import patch -from PLC.v42LegacyNodeNetworkSettingTypes import v42rename, v43rename -from PLC.Methods.DeleteTagType import DeleteTagType -class DeleteNodeNetworkSettingType(DeleteTagType): - """ Legacy version of DeleteTagType. """ - status = "deprecated" - def call(self, auth, tag_type_id_or_name): - tag_type_id_or_name=patch(tag_type_id_or_name,v42rename) - result=DeleteTagType.call(self,auth,tag_type_id_or_name) - return patch(result,v43rename) diff --git a/PLC/Legacy/DeleteSliceAttribute.py b/PLC/Legacy/DeleteSliceAttribute.py deleted file mode 100644 index e562918..0000000 --- a/PLC/Legacy/DeleteSliceAttribute.py +++ /dev/null @@ -1,12 +0,0 @@ -# $Id$ -# $URL$ -from PLC.v42Legacy import patch -from PLC.v42LegacySliceAttributes import v42rename, v43rename -from PLC.Methods.DeleteSliceTag import DeleteSliceTag -class DeleteSliceAttribute(DeleteSliceTag): - """ Legacy version of DeleteSliceTag. """ - status = "deprecated" - def call(self, auth, slice_tag_id): - slice_tag_id=patch(slice_tag_id,v42rename) - result=DeleteSliceTag.call(self,auth,slice_tag_id) - return patch(result,v43rename) diff --git a/PLC/Legacy/DeleteSliceAttributeType.py b/PLC/Legacy/DeleteSliceAttributeType.py deleted file mode 100644 index dc568b6..0000000 --- a/PLC/Legacy/DeleteSliceAttributeType.py +++ /dev/null @@ -1,12 +0,0 @@ -# $Id$ -# $URL$ -from PLC.v42Legacy import patch -from PLC.v42LegacySliceAttributeTypes import v42rename, v43rename -from PLC.Methods.DeleteTagType import DeleteTagType -class DeleteSliceAttributeType(DeleteTagType): - """ Legacy version of DeleteTagType. """ - status = "deprecated" - def call(self, auth, tag_type_id_or_name): - tag_type_id_or_name=patch(tag_type_id_or_name,v42rename) - result=DeleteTagType.call(self,auth,tag_type_id_or_name) - return patch(result,v43rename) diff --git a/PLC/Legacy/GetNodeNetworkSettingTypes.py b/PLC/Legacy/GetNodeNetworkSettingTypes.py deleted file mode 100644 index 0a62eb4..0000000 --- a/PLC/Legacy/GetNodeNetworkSettingTypes.py +++ /dev/null @@ -1,13 +0,0 @@ -# $Id$ -# $URL$ -from PLC.v42Legacy import patch -from PLC.v42LegacyNodeNetworkSettingTypes import v42rename, v43rename -from PLC.Methods.GetTagTypes import GetTagTypes -class GetNodeNetworkSettingTypes(GetTagTypes): - """ Legacy version of GetTagTypes. """ - status = "deprecated" - def call(self, auth, tag_type_filter = None, return_fields = None): - tag_type_filter=patch(tag_type_filter,v42rename) - return_fields=patch(return_fields,v42rename) - result=GetTagTypes.call(self,auth,tag_type_filter,return_fields) - return patch(result,v43rename) diff --git a/PLC/Legacy/GetNodeNetworkSettings.py b/PLC/Legacy/GetNodeNetworkSettings.py deleted file mode 100644 index e528bb4..0000000 --- a/PLC/Legacy/GetNodeNetworkSettings.py +++ /dev/null @@ -1,13 +0,0 @@ -# $Id$ -# $URL$ -from PLC.v42Legacy import patch -from PLC.v42LegacyNodeNetworkSettings import v42rename, v43rename -from PLC.Methods.GetInterfaceTags import GetInterfaceTags -class GetNodeNetworkSettings(GetInterfaceTags): - """ Legacy version of GetInterfaceTags. """ - status = "deprecated" - def call(self, auth, interface_tag_filter = None, return_fields = None): - interface_tag_filter=patch(interface_tag_filter,v42rename) - return_fields=patch(return_fields,v42rename) - result=GetInterfaceTags.call(self,auth,interface_tag_filter,return_fields) - return patch(result,v43rename) diff --git a/PLC/Legacy/GetNodeNetworks.py b/PLC/Legacy/GetNodeNetworks.py deleted file mode 100644 index a1c95dd..0000000 --- a/PLC/Legacy/GetNodeNetworks.py +++ /dev/null @@ -1,13 +0,0 @@ -# $Id$ -# $URL$ -from PLC.v42Legacy import patch -from PLC.v42LegacyNodeNetworks import v42rename, v43rename -from PLC.Methods.GetInterfaces import GetInterfaces -class GetNodeNetworks(GetInterfaces): - """ Legacy version of GetInterfaces. """ - status = "deprecated" - def call(self, auth, interface_filter = None, return_fields = None): - interface_filter=patch(interface_filter,v42rename) - return_fields=patch(return_fields,v42rename) - result=GetInterfaces.call(self,auth,interface_filter,return_fields) - return patch(result,v43rename) diff --git a/PLC/Legacy/GetSliceAttributeTypes.py b/PLC/Legacy/GetSliceAttributeTypes.py deleted file mode 100644 index 2d15413..0000000 --- a/PLC/Legacy/GetSliceAttributeTypes.py +++ /dev/null @@ -1,13 +0,0 @@ -# $Id$ -# $URL$ -from PLC.v42Legacy import patch -from PLC.v42LegacySliceAttributeTypes import v42rename, v43rename -from PLC.Methods.GetTagTypes import GetTagTypes -class GetSliceAttributeTypes(GetTagTypes): - """ Legacy version of GetTagTypes. """ - status = "deprecated" - def call(self, auth, tag_type_filter = None, return_fields = None): - tag_type_filter=patch(tag_type_filter,v42rename) - return_fields=patch(return_fields,v42rename) - result=GetTagTypes.call(self,auth,tag_type_filter,return_fields) - return patch(result,v43rename) diff --git a/PLC/Legacy/GetSliceAttributes.py b/PLC/Legacy/GetSliceAttributes.py deleted file mode 100644 index aa0b321..0000000 --- a/PLC/Legacy/GetSliceAttributes.py +++ /dev/null @@ -1,13 +0,0 @@ -# $Id$ -# $URL$ -from PLC.v42Legacy import patch -from PLC.v42LegacySliceAttributes import v42rename, v43rename -from PLC.Methods.GetSliceTags import GetSliceTags -class GetSliceAttributes(GetSliceTags): - """ Legacy version of GetSliceTags. """ - status = "deprecated" - def call(self, auth, slice_tag_filter = None, return_fields = None): - slice_tag_filter=patch(slice_tag_filter,v42rename) - return_fields=patch(return_fields,v42rename) - result=GetSliceTags.call(self,auth,slice_tag_filter,return_fields) - return patch(result,v43rename) diff --git a/PLC/Legacy/UpdateNodeNetwork.py b/PLC/Legacy/UpdateNodeNetwork.py deleted file mode 100644 index 411445a..0000000 --- a/PLC/Legacy/UpdateNodeNetwork.py +++ /dev/null @@ -1,13 +0,0 @@ -# $Id$ -# $URL$ -from PLC.v42Legacy import patch -from PLC.v42LegacyNodeNetworks import v42rename, v43rename -from PLC.Methods.UpdateInterface import UpdateInterface -class UpdateNodeNetwork(UpdateInterface): - """ Legacy version of UpdateInterface. """ - status = "deprecated" - def call(self, auth, interface_id, interface_fields): - interface_id=patch(interface_id,v42rename) - interface_fields=patch(interface_fields,v42rename) - result=UpdateInterface.call(self,auth,interface_id,interface_fields) - return patch(result,v43rename) diff --git a/PLC/Legacy/UpdateNodeNetworkSetting.py b/PLC/Legacy/UpdateNodeNetworkSetting.py deleted file mode 100644 index 0f3da52..0000000 --- a/PLC/Legacy/UpdateNodeNetworkSetting.py +++ /dev/null @@ -1,13 +0,0 @@ -# $Id$ -# $URL$ -from PLC.v42Legacy import patch -from PLC.v42LegacyNodeNetworkSettings import v42rename, v43rename -from PLC.Methods.UpdateInterfaceTag import UpdateInterfaceTag -class UpdateNodeNetworkSetting(UpdateInterfaceTag): - """ Legacy version of UpdateInterfaceTag. """ - status = "deprecated" - def call(self, auth, interface_tag_id, value): - interface_tag_id=patch(interface_tag_id,v42rename) - value=patch(value,v42rename) - result=UpdateInterfaceTag.call(self,auth,interface_tag_id,value) - return patch(result,v43rename) diff --git a/PLC/Legacy/UpdateNodeNetworkSettingType.py b/PLC/Legacy/UpdateNodeNetworkSettingType.py deleted file mode 100644 index 9e2cc28..0000000 --- a/PLC/Legacy/UpdateNodeNetworkSettingType.py +++ /dev/null @@ -1,13 +0,0 @@ -# $Id$ -# $URL$ -from PLC.v42Legacy import patch -from PLC.v42LegacyNodeNetworkSettingTypes import v42rename, v43rename -from PLC.Methods.UpdateTagType import UpdateTagType -class UpdateNodeNetworkSettingType(UpdateTagType): - """ Legacy version of UpdateTagType. """ - status = "deprecated" - def call(self, auth, tag_type_id_or_name, tag_type_fields): - tag_type_id_or_name=patch(tag_type_id_or_name,v42rename) - tag_type_fields=patch(tag_type_fields,v42rename) - result=UpdateTagType.call(self,auth,tag_type_id_or_name,tag_type_fields) - return patch(result,v43rename) diff --git a/PLC/Legacy/UpdateSliceAttribute.py b/PLC/Legacy/UpdateSliceAttribute.py deleted file mode 100644 index 9508ae3..0000000 --- a/PLC/Legacy/UpdateSliceAttribute.py +++ /dev/null @@ -1,13 +0,0 @@ -# $Id$ -# $URL$ -from PLC.v42Legacy import patch -from PLC.v42LegacySliceAttributes import v42rename, v43rename -from PLC.Methods.UpdateSliceTag import UpdateSliceTag -class UpdateSliceAttribute(UpdateSliceTag): - """ Legacy version of UpdateSliceTag. """ - status = "deprecated" - def call(self, auth, slice_tag_id, value): - slice_tag_id=patch(slice_tag_id,v42rename) - value=patch(value,v42rename) - result=UpdateSliceTag.call(self,auth,slice_tag_id,value) - return patch(result,v43rename) diff --git a/PLC/Legacy/UpdateSliceAttributeType.py b/PLC/Legacy/UpdateSliceAttributeType.py deleted file mode 100644 index 7395bfe..0000000 --- a/PLC/Legacy/UpdateSliceAttributeType.py +++ /dev/null @@ -1,13 +0,0 @@ -# $Id$ -# $URL$ -from PLC.v42Legacy import patch -from PLC.v42LegacySliceAttributeTypes import v42rename, v43rename -from PLC.Methods.UpdateTagType import UpdateTagType -class UpdateSliceAttributeType(UpdateTagType): - """ Legacy version of UpdateTagType. """ - status = "deprecated" - def call(self, auth, tag_type_id_or_name, tag_type_fields): - tag_type_id_or_name=patch(tag_type_id_or_name,v42rename) - tag_type_fields=patch(tag_type_fields,v42rename) - result=UpdateTagType.call(self,auth,tag_type_id_or_name,tag_type_fields) - return patch(result,v43rename) diff --git a/PLC/Legacy/__init__.py b/PLC/Legacy/__init__.py deleted file mode 100644 index 64f72be..0000000 --- a/PLC/Legacy/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -## Please use make index to update this file -native_methods = """ -AddNodeNetwork -AddNodeNetworkSetting -AddNodeNetworkSettingType -AddSliceAttribute -AddSliceAttributeType -DeleteNodeNetwork -DeleteNodeNetworkSetting -DeleteNodeNetworkSettingType -DeleteSliceAttribute -DeleteSliceAttributeType -GetNodeNetworkSettingTypes -GetNodeNetworkSettings -GetNodeNetworks -GetSliceAttributeTypes -GetSliceAttributes -UpdateNodeNetwork -UpdateNodeNetworkSetting -UpdateNodeNetworkSettingType -UpdateSliceAttribute -UpdateSliceAttributeType -""".split() diff --git a/PLC/Methods/GetNodeGroups.py b/PLC/Methods/GetNodeGroups.py index 6a59556..6428f80 100644 --- a/PLC/Methods/GetNodeGroups.py +++ b/PLC/Methods/GetNodeGroups.py @@ -7,7 +7,7 @@ from PLC.Filter import Filter from PLC.Auth import Auth from PLC.NodeGroups import NodeGroup, NodeGroups -class v43GetNodeGroups(Method): +class GetNodeGroups(Method): """ Returns an array of structs containing details about node groups. If nodegroup_filter is specified and is an array of node group @@ -30,54 +30,3 @@ class v43GetNodeGroups(Method): def call(self, auth, nodegroup_filter = None, return_fields = None): return NodeGroups(self.api, nodegroup_filter, return_fields) - - -nodegroup_fields = NodeGroup.fields.copy() -nodegroup_fields['name'] = Parameter(str, "Legacy version of groupname", max = 50), - -class v42GetNodeGroups(v43GetNodeGroups): - """ - Legacy wrapper for v42GetNodeGroups. - """ - - accepts = [ - Auth(), - Mixed([Mixed(NodeGroup.fields['nodegroup_id'], - NodeGroup.fields['groupname'])], - Filter(nodegroup_fields)), - Parameter([str], "List of fields to return", nullok = True) - ] - - returns = [nodegroup_fields] - - def call(self, auth, nodegroup_filter = None, return_fields = None): - # convert name -> groupname in both filters - if isinstance(nodegroup_filter, dict): - if nodegroup_filter.has_key('name'): - groupname = nodegroup_filter.pop('name') - if not nodegroup_filter.has_key('groupname'): - nodegroup_filter['groupname']=groupname - - if isinstance(return_fields, list): - if 'name' in return_fields: - return_fields.remove('name') - if 'groupname' not in return_fields: - return_fields.append('groupname') - - nodegroups = NodeGroups(self.api, nodegroup_filter, return_fields) - # if groupname is present, then create a name mapping - for nodegroup in nodegroups: - if nodegroup.has_key('groupname'): - nodegroup['name']=nodegroup['groupname'] - return nodegroups - -class GetNodeGroups(v42GetNodeGroups): - """ - Returns an array of structs containing details about node groups. - If nodegroup_filter is specified and is an array of node group - identifiers or names, or a struct of node group attributes, only - node groups matching the filter will be returned. If return_fields - is specified, only the specified details will be returned. - """ - - pass diff --git a/PLC/Methods/GetNodes.py b/PLC/Methods/GetNodes.py index 90be951..a49cac1 100644 --- a/PLC/Methods/GetNodes.py +++ b/PLC/Methods/GetNodes.py @@ -10,7 +10,7 @@ from PLC.Auth import Auth admin_only = ['key', 'session', 'boot_nonce' ] -class v43GetNodes(Method): +class GetNodes(Method): """ Returns an array of structs containing details about nodes. If node_filter is specified and is an array of node identifiers or @@ -89,55 +89,3 @@ class v43GetNodes(Method): del node[field] return nodes - -node_fields = Node.fields.copy() -node_fields['nodenetwork_ids']=Parameter([int], "Legacy version of interface_ids") - -class v42GetNodes(v43GetNodes): - """ - Legacy wrapper for v43GetNodes. - """ - - accepts = [ - Auth(), - Mixed([Mixed(Node.fields['node_id'], - Node.fields['hostname'])], - Parameter(str,"hostname"), - Parameter(int,"node_id"), - Filter(node_fields)), - Parameter([str], "List of fields to return", nullok = True), - ] - returns = [node_fields] - - def call(self, auth, node_filter = None, return_fields = None): - # convert nodenetwork_ids -> interface_ids - if isinstance(node_filter, dict): - if node_filter.has_key('nodenetwork_ids'): - interface_ids = node_filter.pop('nodenetwork_ids') - if not node_filter.has_key('interface_ids'): - node_filter['interface_ids']=interface_ids - - if isinstance(return_fields, list): - if 'nodenetwork_ids' in return_fields: - return_fields.remove('nodenetwork_ids') - if 'interface_ids' not in return_fields: - return_fields.append('interface_ids') - nodes = v43GetNodes.call(self,auth,node_filter,return_fields) - # if interface_ids are present, then create a nodenetwork_ids mapping - for node in nodes: - if node.has_key('interface_ids'): - node['nodenetwork_ids']=node['interface_ids'] - return nodes - -class GetNodes(v42GetNodes): - """ - Returns an array of structs containing details about nodes. If - node_filter is specified and is an array of node identifiers or - hostnames, or a struct of node attributes, only nodes matching the - filter will be returned. If return_fields is specified, only the - specified details will be returned. - - Some fields may only be viewed by admins. - """ - - pass diff --git a/PLC/Methods/GetSlices.py b/PLC/Methods/GetSlices.py index 0d34bbf..ab4cdf6 100644 --- a/PLC/Methods/GetSlices.py +++ b/PLC/Methods/GetSlices.py @@ -8,7 +8,7 @@ from PLC.Persons import Person, Persons from PLC.Sites import Site, Sites from PLC.Slices import Slice, Slices -class v43GetSlices(Method): +class GetSlices(Method): """ Returns an array of structs containing details about slices. If slice_filter is specified and is an array of slice identifiers or @@ -76,57 +76,3 @@ class v43GetSlices(Method): return slices -slice_fields = Slice.fields.copy() -slice_fields['slice_attribute_ids']=Parameter([int], "Legacy version of slice_tag_ids") - -class v42GetSlices(v43GetSlices): - """ - Legacy wrapper for v43GetSlices. - """ - - accepts = [ - Auth(), - Mixed([Mixed(Slice.fields['slice_id'], - Slice.fields['name'])], - Parameter(str,"name"), - Parameter(int,"slice_id"), - Filter(slice_fields)), - Parameter([str], "List of fields to return", nullok = True) - ] - - returns = [slice_fields] - - def call(self, auth, slice_filter = None, return_fields = None): - # convert nodenetwork_ids -> interface_ids - if isinstance(slice_filter, dict): - if slice_filter.has_key('slice_attribute_ids'): - slice_tag_ids = slice_filter.pop('slice_attribute_ids') - if not slice_filter.has_key('slice_tag_ids'): - slice_filter['slice_tag_ids']=slice_tag_ids - if isinstance(return_fields, list): - if 'slice_attribute_ids' in return_fields: - return_fields.remove('slice_attribute_ids') - if 'slice_tag_ids' not in return_fields: - return_fields.append('slice_tag_ids') - slices = v43GetSlices.call(self,auth,slice_filter,return_fields) - # add in a slice_tag_ids -> slice_attribute_ids - for slice in slices: - if slice.has_key('slice_tag_ids'): - slice['slice_attribute_ids']=slice['slice_tag_ids'] - return slices - -class GetSlices(v42GetSlices): - """ - Returns an array of structs containing details about slices. If - slice_filter is specified and is an array of slice identifiers or - slice names, or a struct of slice attributes, only slices matching - the filter will be returned. If return_fields is specified, only the - specified details will be returned. - - Users may only query slices of which they are members. PIs may - query any of the slices at their sites. Admins and nodes may query - any slice. If a slice that cannot be queried is specified in - slice_filter, details about that slice will not be returned. - """ - - pass diff --git a/PLC/Methods/GetSlivers.py b/PLC/Methods/GetSlivers.py index 5a129ca..08196b0 100644 --- a/PLC/Methods/GetSlivers.py +++ b/PLC/Methods/GetSlivers.py @@ -118,7 +118,7 @@ def get_slivers(api, auth, slice_filter, node = None): return slivers -class v43GetSlivers(Method): +class GetSlivers(Method): """ Returns a struct containing information about the specified node (or calling node, if called by a node and node_id_or_hostname is @@ -142,7 +142,7 @@ class v43GetSlivers(Method): 'timestamp': Parameter(int, "Timestamp of this call, in seconds since UNIX epoch"), 'node_id': Node.fields['node_id'], 'hostname': Node.fields['hostname'], - 'networks': [Interface.fields], + 'interfaces': [Interface.fields], 'groups': [NodeGroup.fields['groupname']], 'conf_files': [ConfFile.fields], 'initscripts': [InitScript.fields], @@ -188,7 +188,7 @@ class v43GetSlivers(Method): raise PLCInvalidArgument, "Not a local node" # Get interface information - networks = Interfaces(self.api, node['interface_ids']) + interfaces = Interfaces(self.api, node['interface_ids']) # Get node group information nodegroups = NodeGroups(self.api, node['nodegroup_ids']).dict('groupname') @@ -283,44 +283,10 @@ class v43GetSlivers(Method): 'timestamp': timestamp, 'node_id': node['node_id'], 'hostname': node['hostname'], - 'networks': networks, + 'interfaces': interfaces, 'groups': groups, 'conf_files': conf_files.values(), 'initscripts': initscripts, 'slivers': slivers, 'accounts': accounts } - -class v42GetSlivers(v43GetSlivers): - """ - Legacy wrapper for v43GetSlivers. - """ - - def call(self, auth, node_id_or_hostname = None): - result = v43GetSlivers.call(self,auth,node_id_or_hostname) - networks = result['networks'] - - for i in range(0,len(networks)): - network = networks[i] - if network.has_key("interface_id"): - network['nodenetwork_id']=network['interface_id'] - if network.has_key("interface_tag_ids"): - network['nodenetwork_setting_ids']=network['interface_tag_ids'] - networks[i]=network - - result['networks']=networks - return result - -class GetSlivers(v42GetSlivers): - """ - Returns a struct containing information about the specified node - (or calling node, if called by a node and node_id_or_hostname is - not specified), including the current set of slivers bound to the - node. - - All of the information returned by this call can be gathered from - other calls, e.g. GetNodes, GetInterfaces, GetSlices, etc. This - function exists almost solely for the benefit of Node Manager. - """ - - pass diff --git a/PLC/__init__.py b/PLC/__init__.py index 0be5ac4..7debd12 100644 --- a/PLC/__init__.py +++ b/PLC/__init__.py @@ -49,10 +49,4 @@ Slices Table TagTypes sendmail -v42Legacy -v42LegacyNodeNetworkSettingTypes -v42LegacyNodeNetworkSettings -v42LegacyNodeNetworks -v42LegacySliceAttributeTypes -v42LegacySliceAttributes """.split() diff --git a/PLC/v42Legacy.py b/PLC/v42Legacy.py deleted file mode 100644 index a6a063d..0000000 --- a/PLC/v42Legacy.py +++ /dev/null @@ -1,13 +0,0 @@ -# $Id$ -# $URL$ - -# apply rename on list (columns) or dict (filter) args -def patch (arg,rename): - if isinstance(arg,list): - for i in range(0,len(arg)): - arg[i] = patch(arg[i],rename) - return arg - if isinstance(arg,dict): - return dict ( [ (rename(k),v) for (k,v) in arg.iteritems() ] ) - return rename(arg) - diff --git a/PLC/v42LegacyNodeNetworkSettingTypes.py b/PLC/v42LegacyNodeNetworkSettingTypes.py deleted file mode 100644 index c7b937e..0000000 --- a/PLC/v42LegacyNodeNetworkSettingTypes.py +++ /dev/null @@ -1,11 +0,0 @@ -# $Id$ -# $URL$ - -# mapping of argument/return names for *NodeNetworkSettingType* -v42_to_v43_argmap = { "name":"tagname", - "nodenetwork_setting_type_id": "tag_type_id", - } -v43_to_v42_argmap = dict([ (v,k) for k,v in v42_to_v43_argmap.iteritems()]) - -def v42rename (x): return v42_to_v43_argmap.get(x,x) -def v43rename (x): return v43_to_v42_argmap.get(x,x) diff --git a/PLC/v42LegacyNodeNetworkSettings.py b/PLC/v42LegacyNodeNetworkSettings.py deleted file mode 100644 index 1171f9e..0000000 --- a/PLC/v42LegacyNodeNetworkSettings.py +++ /dev/null @@ -1,16 +0,0 @@ -# $Id$ -# $URL$ - -# mapping of argument/return names for *NodeNetworkSettings* and *InterfaceTags* calls -v42_to_v43_argmap = { - "nodenetwork_id":"interface_id", - "nodenetwork_ids":"interface_ids", - "nodenetwork_setting_id":"interface_tag_id", - "nodenetwork_setting_ids":"interface_tag_ids", - "nodenetwork_setting_type_id":"tag_type_id", - "name":"tagname" - } -v43_to_v42_argmap = dict([ (v,k) for k,v in v42_to_v43_argmap.iteritems()]) - -def v42rename (x): return v42_to_v43_argmap.get(x,x) -def v43rename (x): return v43_to_v42_argmap.get(x,x) diff --git a/PLC/v42LegacyNodeNetworks.py b/PLC/v42LegacyNodeNetworks.py deleted file mode 100644 index 21a4a7d..0000000 --- a/PLC/v42LegacyNodeNetworks.py +++ /dev/null @@ -1,13 +0,0 @@ -# $Id$ -# $URL$ - -# mapping of argument/return names for *NodeNetwork* and *Interface* calls -v42_to_v43_argmap = { - "nodenetwork_id":"interface_id", - "nodenetwork_ids":"interface_ids", - "nodenetwork_setting_ids":"interface_tag_ids", -} -v43_to_v42_argmap = dict([ (v,k) for k,v in v42_to_v43_argmap.iteritems()]) - -def v42rename (x): return v42_to_v43_argmap.get(x,x) -def v43rename (x): return v43_to_v42_argmap.get(x,x) diff --git a/PLC/v42LegacySliceAttributeTypes.py b/PLC/v42LegacySliceAttributeTypes.py deleted file mode 100644 index 0636984..0000000 --- a/PLC/v42LegacySliceAttributeTypes.py +++ /dev/null @@ -1,13 +0,0 @@ -# $Id$ -# $URL$ - -# mapping of argument/return names for *SliceAttributeType* calls - -v42_to_v43_argmap = { "name":"tagname", - "slice_attribute_id":"slice_tag_id", - "attribute_type_id":"tag_type_id", - } -v43_to_v42_argmap = dict([ (v,k) for k,v in v42_to_v43_argmap.iteritems()]) - -def v42rename (x): return v42_to_v43_argmap.get(x,x) -def v43rename (x): return v43_to_v42_argmap.get(x,x) diff --git a/PLC/v42LegacySliceAttributes.py b/PLC/v42LegacySliceAttributes.py deleted file mode 100644 index 09d906c..0000000 --- a/PLC/v42LegacySliceAttributes.py +++ /dev/null @@ -1,12 +0,0 @@ -# $Id$ -# $URL$ - -# mapping of argument/return names for *{SliceAttribute,NetworkSetting}Type* and *TagType* calls - -v42_to_v43_argmap = { "name":"tagname", - "slice_attribute_id":"slice_tag_id", - } -v43_to_v42_argmap = dict([ (v,k) for k,v in v42_to_v43_argmap.iteritems()]) - -def v42rename (x): return v42_to_v43_argmap.get(x,x) -def v43rename (x): return v43_to_v42_argmap.get(x,x)