From 4492a19a0528f29d64f0c2bc1bb42723fd2df032 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Fri, 28 Nov 2008 14:36:02 +0000 Subject: [PATCH] renaming SliceAttribute into SliceTag and InterfaceSetting into InterfaceTag --- PLC/Accessors/Factory.py | 10 ++-- PLC/InterfaceSettings.py | 58 ------------------- PLC/InterfaceTags.py | 58 +++++++++++++++++++ PLC/Interfaces.py | 4 +- PLC/Legacy/NodeNetworks.py | 2 +- ...InterfaceSetting.py => AddInterfaceTag.py} | 28 ++++----- .../{AddSliceAttribute.py => AddSliceTag.py} | 40 ++++++------- ...erfaceSetting.py => DeleteInterfaceTag.py} | 28 ++++----- PLC/Methods/DeleteNodeTag.py | 2 +- ...eteSliceAttribute.py => DeleteSliceTag.py} | 28 ++++----- PLC/Methods/GetBootMedium.py | 6 +- ...terfaceSettings.py => GetInterfaceTags.py} | 18 +++--- PLC/Methods/GetPeerData.py | 4 +- ...{GetSliceAttributes.py => GetSliceTags.py} | 48 +++++++-------- PLC/Methods/GetSlivers.py | 44 +++++++------- PLC/Methods/SliceExtendedInfo.py | 6 +- PLC/Methods/SliceGetTicket.py | 16 ++--- ...erfaceSetting.py => UpdateInterfaceTag.py} | 32 +++++----- PLC/Methods/UpdateNodeTag.py | 2 +- ...ateSliceAttribute.py => UpdateSliceTag.py} | 32 +++++----- PLC/Methods/__init__.py | 16 ++--- PLC/Nodes.py | 4 +- PLC/Peers.py | 2 +- PLC/SliceAttributes.py | 48 --------------- PLC/SliceTags.py | 48 +++++++++++++++ PLC/Slices.py | 40 ++++++------- PLC/TagTypes.py | 2 +- PLC/__init__.py | 4 +- migrations/v4-to-v5/migrate.sed | 4 +- migrations/v4-to-v5/migrate.sql | 38 ++++++------ planetlab5.sql | 54 ++++++++--------- tools/slice_attributes.py | 44 +++++++------- 32 files changed, 387 insertions(+), 383 deletions(-) delete mode 100644 PLC/InterfaceSettings.py create mode 100644 PLC/InterfaceTags.py rename PLC/Methods/{AddInterfaceSetting.py => AddInterfaceTag.py} (76%) rename PLC/Methods/{AddSliceAttribute.py => AddSliceTag.py} (74%) rename PLC/Methods/{DeleteInterfaceSetting.py => DeleteInterfaceTag.py} (65%) rename PLC/Methods/{DeleteSliceAttribute.py => DeleteSliceTag.py} (66%) rename PLC/Methods/{GetInterfaceSettings.py => GetInterfaceTags.py} (60%) rename PLC/Methods/{GetSliceAttributes.py => GetSliceTags.py} (59%) rename PLC/Methods/{UpdateInterfaceSetting.py => UpdateInterfaceTag.py} (64%) rename PLC/Methods/{UpdateSliceAttribute.py => UpdateSliceTag.py} (64%) delete mode 100644 PLC/SliceAttributes.py create mode 100644 PLC/SliceTags.py diff --git a/PLC/Accessors/Factory.py b/PLC/Accessors/Factory.py index 6b13e0a..f2ced3f 100644 --- a/PLC/Accessors/Factory.py +++ b/PLC/Accessors/Factory.py @@ -12,9 +12,9 @@ from PLC.Faults import * from PLC.Nodes import Nodes, Node from PLC.NodeTags import NodeTags, NodeTag from PLC.Interfaces import Interfaces, Interface -from PLC.InterfaceSettings import InterfaceSettings, InterfaceSetting +from PLC.InterfaceTags import InterfaceTags, InterfaceTag from PLC.Slices import Slices, Slice -from PLC.SliceAttributes import SliceAttributes, SliceAttribute +from PLC.SliceTags import SliceTags, SliceTag # this is another story.. #from PLC.Ilinks import Ilink @@ -26,10 +26,10 @@ taggable_classes = { Node : {'table_class' : Nodes, 'joins_class' : NodeTags, 'join_class' : NodeTag, 'value_key': 'tagvalue', 'secondary_key': 'hostname'}, Interface : {'table_class' : Interfaces, - 'joins_class': InterfaceSettings, 'join_class': InterfaceSetting, + 'joins_class': InterfaceTags, 'join_class': InterfaceTag, 'value_key' : 'value' }, Slice: {'table_class' : Slices, - 'joins_class': SliceAttributes, 'join_class': SliceAttribute, + 'joins_class': SliceTags, 'join_class': SliceTag, 'value_key' : 'value', 'secondary_key':'login_base'}, # Ilink : xxx } @@ -149,7 +149,7 @@ def define_accessors (module, objclass, methodsuffix, tag_type.sync() tag_type_id = tag_type['tag_type_id'] - # locate the join object (e.g. NodeTag, SliceAttribute or InterfaceSetting) + # locate the join object (e.g. NodeTag, SliceTag or InterfaceTag) filter = {'tag_type_id':tag_type_id} if isinstance (id_or_name,int): filter[primary_key]=id_or_name diff --git a/PLC/InterfaceSettings.py b/PLC/InterfaceSettings.py deleted file mode 100644 index d045809..0000000 --- a/PLC/InterfaceSettings.py +++ /dev/null @@ -1,58 +0,0 @@ -# $Id# -# -# Thierry Parmentelat - INRIA -# -# $Revision$ -# -from PLC.Faults import * -from PLC.Parameter import Parameter -from PLC.Filter import Filter -from PLC.Table import Row, Table -from PLC.TagTypes import TagType, TagTypes - -class InterfaceSetting(Row): - """ - Representation of a row in the interface_setting. - To use, instantiate with a dict of values. - """ - - table_name = 'interface_setting' - primary_key = 'interface_setting_id' - fields = { - 'interface_setting_id': Parameter(int, "Interface setting identifier"), - 'interface_id': Parameter(int, "Interface identifier"), - 'tag_type_id': TagType.fields['tag_type_id'], - 'tagname': TagType.fields['tagname'], - 'description': TagType.fields['description'], - 'category': TagType.fields['category'], - 'min_role_id': TagType.fields['min_role_id'], - 'value': Parameter(str, "Interface setting value"), - ### relations - - } - -class InterfaceSettings(Table): - """ - Representation of row(s) from the interface_setting table in the - database. - """ - - def __init__(self, api, interface_setting_filter = None, columns = None): - Table.__init__(self, api, InterfaceSetting, columns) - - sql = "SELECT %s FROM view_interface_settings WHERE True" % \ - ", ".join(self.columns) - - if interface_setting_filter is not None: - if isinstance(interface_setting_filter, (list, tuple, set)): - interface_setting_filter = Filter(InterfaceSetting.fields, {'interface_setting_id': interface_setting_filter}) - elif isinstance(interface_setting_filter, dict): - interface_setting_filter = Filter(InterfaceSetting.fields, interface_setting_filter) - elif isinstance(interface_setting_filter, int): - interface_setting_filter = Filter(InterfaceSetting.fields, {'interface_setting_id': [interface_setting_filter]}) - else: - raise PLCInvalidArgument, "Wrong interface setting filter %r"%interface_setting_filter - sql += " AND (%s) %s" % interface_setting_filter.sql(api) - - - self.selectall(sql) diff --git a/PLC/InterfaceTags.py b/PLC/InterfaceTags.py new file mode 100644 index 0000000..6713a3d --- /dev/null +++ b/PLC/InterfaceTags.py @@ -0,0 +1,58 @@ +# $Id# +# +# Thierry Parmentelat - INRIA +# +# $Revision$ +# +from PLC.Faults import * +from PLC.Parameter import Parameter +from PLC.Filter import Filter +from PLC.Table import Row, Table +from PLC.TagTypes import TagType, TagTypes + +class InterfaceTag(Row): + """ + Representation of a row in the interface_tag. + To use, instantiate with a dict of values. + """ + + table_name = 'interface_tag' + primary_key = 'interface_tag_id' + fields = { + 'interface_tag_id': Parameter(int, "Interface setting identifier"), + 'interface_id': Parameter(int, "Interface identifier"), + 'tag_type_id': TagType.fields['tag_type_id'], + 'tagname': TagType.fields['tagname'], + 'description': TagType.fields['description'], + 'category': TagType.fields['category'], + 'min_role_id': TagType.fields['min_role_id'], + 'value': Parameter(str, "Interface setting value"), + ### relations + + } + +class InterfaceTags(Table): + """ + Representation of row(s) from the interface_tag table in the + database. + """ + + def __init__(self, api, interface_tag_filter = None, columns = None): + Table.__init__(self, api, InterfaceTag, columns) + + sql = "SELECT %s FROM view_interface_tags WHERE True" % \ + ", ".join(self.columns) + + if interface_tag_filter is not None: + if isinstance(interface_tag_filter, (list, tuple, set)): + interface_tag_filter = Filter(InterfaceTag.fields, {'interface_tag_id': interface_tag_filter}) + elif isinstance(interface_tag_filter, dict): + interface_tag_filter = Filter(InterfaceTag.fields, interface_tag_filter) + elif isinstance(interface_tag_filter, int): + interface_tag_filter = Filter(InterfaceTag.fields, {'interface_tag_id': [interface_tag_filter]}) + else: + raise PLCInvalidArgument, "Wrong interface setting filter %r"%interface_tag_filter + sql += " AND (%s) %s" % interface_tag_filter.sql(api) + + + self.selectall(sql) diff --git a/PLC/Interfaces.py b/PLC/Interfaces.py index ca1fe7e..fc06ea1 100644 --- a/PLC/Interfaces.py +++ b/PLC/Interfaces.py @@ -48,7 +48,7 @@ class Interface(Row): table_name = 'interfaces' primary_key = 'interface_id' - join_tables = ['interface_setting'] + join_tables = ['interface_tag'] fields = { 'interface_id': Parameter(int, "Node interface identifier"), 'method': Parameter(str, "Addressing method (e.g., 'static' or 'dhcp')"), @@ -65,7 +65,7 @@ class Interface(Row): 'hostname': Parameter(str, "(Optional) Hostname", nullok = True), 'node_id': Parameter(int, "Node associated with this interface"), 'is_primary': Parameter(bool, "Is the primary interface for this node"), - 'interface_setting_ids' : Parameter([int], "List of interface settings"), + 'interface_tag_ids' : Parameter([int], "List of interface settings"), } def validate_method(self, method): diff --git a/PLC/Legacy/NodeNetworks.py b/PLC/Legacy/NodeNetworks.py index 0c34ea7..a2b6e85 100644 --- a/PLC/Legacy/NodeNetworks.py +++ b/PLC/Legacy/NodeNetworks.py @@ -40,7 +40,7 @@ def patch_legacy_arg (arg): def legacy_method (legacyname): # new method name - newname=legacyname.replace("NodeNetwork","Interface") + newname=legacyname.replace("NodeNetwork","Interface").replace("Setting","Tag") # locate new class newclass=getattr(import_deep("PLC.Methods."+newname),newname) # create class for legacy name diff --git a/PLC/Methods/AddInterfaceSetting.py b/PLC/Methods/AddInterfaceTag.py similarity index 76% rename from PLC/Methods/AddInterfaceSetting.py rename to PLC/Methods/AddInterfaceTag.py index d4f594b..3fd099f 100644 --- a/PLC/Methods/AddInterfaceSetting.py +++ b/PLC/Methods/AddInterfaceTag.py @@ -10,13 +10,13 @@ from PLC.Parameter import Parameter, Mixed from PLC.Auth import Auth from PLC.TagTypes import TagType, TagTypes -from PLC.InterfaceSettings import InterfaceSetting, InterfaceSettings +from PLC.InterfaceTags import InterfaceTag, InterfaceTags from PLC.Interfaces import Interface, Interfaces from PLC.Nodes import Nodes from PLC.Sites import Sites -class AddInterfaceSetting(Method): +class AddInterfaceTag(Method): """ Sets the specified setting for the specified interface to the specified value. @@ -24,7 +24,7 @@ class AddInterfaceSetting(Method): In general only tech(s), PI(s) and of course admin(s) are allowed to do the change, but this is defined in the tag type object. - Returns the new interface_setting_id (> 0) if successful, faults + Returns the new interface_tag_id (> 0) if successful, faults otherwise. """ @@ -33,13 +33,13 @@ class AddInterfaceSetting(Method): accepts = [ Auth(), # no other way to refer to a interface - InterfaceSetting.fields['interface_id'], + InterfaceTag.fields['interface_id'], Mixed(TagType.fields['tag_type_id'], TagType.fields['tagname']), - InterfaceSetting.fields['value'], + InterfaceTag.fields['value'], ] - returns = Parameter(int, 'New interface_setting_id (> 0) if successful') + returns = Parameter(int, 'New interface_tag_id (> 0) if successful') object_type = 'Interface' @@ -56,7 +56,7 @@ class AddInterfaceSetting(Method): tag_type = tag_types[0] # checks for existence - does not allow several different settings - conflicts = InterfaceSettings(self.api, + conflicts = InterfaceTags(self.api, {'interface_id':interface['interface_id'], 'tag_type_id':tag_type['tag_type_id']}) @@ -79,12 +79,12 @@ class AddInterfaceSetting(Method): min(self.caller['role_ids']) > required_min_role: raise PLCPermissionDenied, "Not allowed to modify the specified interface setting, requires role %d",required_min_role - interface_setting = InterfaceSetting(self.api) - interface_setting['interface_id'] = interface['interface_id'] - interface_setting['tag_type_id'] = tag_type['tag_type_id'] - interface_setting['value'] = value + interface_tag = InterfaceTag(self.api) + interface_tag['interface_id'] = interface['interface_id'] + interface_tag['tag_type_id'] = tag_type['tag_type_id'] + interface_tag['value'] = value - interface_setting.sync() - self.object_ids = [interface_setting['interface_setting_id']] + interface_tag.sync() + self.object_ids = [interface_tag['interface_tag_id']] - return interface_setting['interface_setting_id'] + return interface_tag['interface_tag_id'] diff --git a/PLC/Methods/AddSliceAttribute.py b/PLC/Methods/AddSliceTag.py similarity index 74% rename from PLC/Methods/AddSliceAttribute.py rename to PLC/Methods/AddSliceTag.py index 28834e5..9a3d84a 100644 --- a/PLC/Methods/AddSliceAttribute.py +++ b/PLC/Methods/AddSliceTag.py @@ -5,12 +5,12 @@ from PLC.Parameter import Parameter, Mixed from PLC.TagTypes import TagType, TagTypes from PLC.Slices import Slice, Slices from PLC.Nodes import Node, Nodes -from PLC.SliceAttributes import SliceAttribute, SliceAttributes +from PLC.SliceTags import SliceTag, SliceTags from PLC.NodeGroups import NodeGroup, NodeGroups from PLC.InitScripts import InitScript, InitScripts from PLC.Auth import Auth -class AddSliceAttribute(Method): +class AddSliceTag(Method): """ Sets the specified attribute of the slice (or sliver, if node_id_or_hostname is specified) to the specified value. @@ -21,7 +21,7 @@ class AddSliceAttribute(Method): attributes of slices or slivers at their sites, or of which they are members. Admins may set attributes of any slice or sliver. - Returns the new slice_attribute_id (> 0) if successful, faults + Returns the new slice_tag_id (> 0) if successful, faults otherwise. """ @@ -31,9 +31,9 @@ class AddSliceAttribute(Method): Auth(), Mixed(Slice.fields['slice_id'], Slice.fields['name']), - Mixed(SliceAttribute.fields['tag_type_id'], - SliceAttribute.fields['tagname']), - Mixed(SliceAttribute.fields['value'], + Mixed(SliceTag.fields['tag_type_id'], + SliceTag.fields['tagname']), + Mixed(SliceTag.fields['value'], InitScript.fields['name']), Mixed(Node.fields['node_id'], Node.fields['hostname'], @@ -42,7 +42,7 @@ class AddSliceAttribute(Method): NodeGroup.fields['groupname']) ] - returns = Parameter(int, 'New slice_attribute_id (> 0) if successful') + returns = Parameter(int, 'New slice_tag_id (> 0) if successful') def call(self, auth, slice_id_or_name, tag_type_id_or_name, value, node_id_or_hostname = None, nodegroup_id_or_name = None): slices = Slices(self.api, [slice_id_or_name]) @@ -73,10 +73,10 @@ class AddSliceAttribute(Method): if not initscripts: raise PLCInvalidArgument, "No such plc initscript %r"%value - slice_attribute = SliceAttribute(self.api) - slice_attribute['slice_id'] = slice['slice_id'] - slice_attribute['tag_type_id'] = tag_type['tag_type_id'] - slice_attribute['value'] = unicode(value) + slice_tag = SliceTag(self.api) + slice_tag['slice_id'] = slice['slice_id'] + slice_tag['tag_type_id'] = tag_type['tag_type_id'] + slice_tag['value'] = unicode(value) # Sliver attribute if node is specified if node_id_or_hostname is not None: @@ -87,7 +87,7 @@ class AddSliceAttribute(Method): if node['node_id'] not in slice['node_ids']: raise PLCInvalidArgument, "Node not in the specified slice" - slice_attribute['node_id'] = node['node_id'] + slice_tag['node_id'] = node['node_id'] # Sliver attribute shared accross nodes if nodegroup is sepcified if nodegroup_id_or_name is not None: @@ -96,21 +96,21 @@ class AddSliceAttribute(Method): raise PLCInvalidArgument, "No such nodegroup %r"%nodegroup_id_or_name nodegroup = nodegroups[0] - slice_attribute['nodegroup_id'] = nodegroup['nodegroup_id'] + slice_tag['nodegroup_id'] = nodegroup['nodegroup_id'] # Check if slice attribute alreay exists - slice_attributes_check = SliceAttributes(self.api, {'slice_id': slice['slice_id'], + slice_tags_check = SliceTags(self.api, {'slice_id': slice['slice_id'], 'tagname': tag_type['tagname'], 'value': value}) - for slice_attribute_check in slice_attributes_check: - if 'node_id' in slice_attribute and slice_attribute['node_id'] == slice_attribute_check['node_id']: + for slice_tag_check in slice_tags_check: + if 'node_id' in slice_tag and slice_tag['node_id'] == slice_tag_check['node_id']: raise PLCInvalidArgument, "Sliver attribute already exists" - if 'nodegroup_id' in slice_attribute and slice_attribute['nodegroup_id'] == slice_attribute_check['nodegroup_id']: + if 'nodegroup_id' in slice_tag and slice_tag['nodegroup_id'] == slice_tag_check['nodegroup_id']: raise PLCInvalidArgument, "Slice attribute already exists for this nodegroup" if node_id_or_hostname is None and nodegroup_id_or_name is None: raise PLCInvalidArgument, "Slice attribute already exists" - slice_attribute.sync() - self.event_objects = {'SliceAttribute': [slice_attribute['slice_attribute_id']]} + slice_tag.sync() + self.event_objects = {'SliceTag': [slice_tag['slice_tag_id']]} - return slice_attribute['slice_attribute_id'] + return slice_tag['slice_tag_id'] diff --git a/PLC/Methods/DeleteInterfaceSetting.py b/PLC/Methods/DeleteInterfaceTag.py similarity index 65% rename from PLC/Methods/DeleteInterfaceSetting.py rename to PLC/Methods/DeleteInterfaceTag.py index dae3706..82da0dc 100644 --- a/PLC/Methods/DeleteInterfaceSetting.py +++ b/PLC/Methods/DeleteInterfaceTag.py @@ -10,13 +10,13 @@ from PLC.Method import Method from PLC.Parameter import Parameter, Mixed from PLC.Auth import Auth -from PLC.InterfaceSettings import InterfaceSetting, InterfaceSettings +from PLC.InterfaceTags import InterfaceTag, InterfaceTags from PLC.Interfaces import Interface, Interfaces from PLC.Nodes import Node, Nodes from PLC.Sites import Site, Sites -class DeleteInterfaceSetting(Method): +class DeleteInterfaceTag(Method): """ Deletes the specified interface setting @@ -31,7 +31,7 @@ class DeleteInterfaceSetting(Method): accepts = [ Auth(), - InterfaceSetting.fields['interface_setting_id'] + InterfaceTag.fields['interface_tag_id'] ] returns = Parameter(int, '1 if successful') @@ -39,19 +39,19 @@ class DeleteInterfaceSetting(Method): object_type = 'Interface' - def call(self, auth, interface_setting_id): - interface_settings = InterfaceSettings(self.api, [interface_setting_id]) - if not interface_settings: - raise PLCInvalidArgument, "No such interface setting %r"%interface_setting_id - interface_setting = interface_settings[0] + def call(self, auth, interface_tag_id): + interface_tags = InterfaceTags(self.api, [interface_tag_id]) + if not interface_tags: + raise PLCInvalidArgument, "No such interface tag %r"%interface_tag_id + interface_tag = interface_tags[0] - ### reproducing a check from UpdateSliceAttribute, looks dumb though - interfaces = Interfaces(self.api, [interface_setting['interface_id']]) + ### reproducing a check from UpdateSliceTag, looks dumb though + interfaces = Interfaces(self.api, [interface_tag['interface_id']]) if not interfaces: - raise PLCInvalidArgument, "No such interface %r"%interface_setting['interface_id'] + raise PLCInvalidArgument, "No such interface %r"%interface_tag['interface_id'] interface = interfaces[0] - assert interface_setting['interface_setting_id'] in interface['interface_setting_ids'] + assert interface_tag['interface_tag_id'] in interface['interface_tag_ids'] # check permission : it not admin, is the user affiliated with the right site if 'admin' not in self.caller['roles']: @@ -68,7 +68,7 @@ class DeleteInterfaceSetting(Method): min(self.caller['role_ids']) > required_min_role: raise PLCPermissionDenied, "Not allowed to modify the specified interface setting, requires role %d",required_min_role - interface_setting.delete() - self.object_ids = [interface_setting['interface_setting_id']] + interface_tag.delete() + self.object_ids = [interface_tag['interface_tag_id']] return 1 diff --git a/PLC/Methods/DeleteNodeTag.py b/PLC/Methods/DeleteNodeTag.py index 5917cab..fdcc4f9 100644 --- a/PLC/Methods/DeleteNodeTag.py +++ b/PLC/Methods/DeleteNodeTag.py @@ -45,7 +45,7 @@ class DeleteNodeTag(Method): raise PLCInvalidArgument, "No such node tag %r"%node_tag_id node_tag = node_tags[0] - ### reproducing a check from UpdateSliceAttribute, looks dumb though + ### reproducing a check from UpdateSliceTag, looks dumb though nodes = Nodes(self.api, [node_tag['node_id']]) if not nodes: raise PLCInvalidArgument, "No such node %r"%node_tag['node_id'] diff --git a/PLC/Methods/DeleteSliceAttribute.py b/PLC/Methods/DeleteSliceTag.py similarity index 66% rename from PLC/Methods/DeleteSliceAttribute.py rename to PLC/Methods/DeleteSliceTag.py index bdbb871..3463bcd 100644 --- a/PLC/Methods/DeleteSliceAttribute.py +++ b/PLC/Methods/DeleteSliceTag.py @@ -1,13 +1,13 @@ -# $Id# +g# $Id# from PLC.Faults import * from PLC.Method import Method from PLC.Parameter import Parameter, Mixed -from PLC.SliceAttributes import SliceAttribute, SliceAttributes +from PLC.SliceTags import SliceTag, SliceTags from PLC.Slices import Slice, Slices from PLC.Nodes import Node, Nodes from PLC.Auth import Auth -class DeleteSliceAttribute(Method): +class DeleteSliceTag(Method): """ Deletes the specified slice or sliver attribute. @@ -24,23 +24,23 @@ class DeleteSliceAttribute(Method): accepts = [ Auth(), - SliceAttribute.fields['slice_attribute_id'] + SliceTag.fields['slice_tag_id'] ] returns = Parameter(int, '1 if successful') - def call(self, auth, slice_attribute_id): - slice_attributes = SliceAttributes(self.api, [slice_attribute_id]) - if not slice_attributes: + def call(self, auth, slice_tag_id): + slice_tags = SliceTags(self.api, [slice_tag_id]) + if not slice_tags: raise PLCInvalidArgument, "No such slice attribute" - slice_attribute = slice_attributes[0] + slice_tag = slice_tags[0] - slices = Slices(self.api, [slice_attribute['slice_id']]) + slices = Slices(self.api, [slice_tag['slice_id']]) if not slices: raise PLCInvalidArgument, "No such slice" slice = slices[0] - assert slice_attribute['slice_attribute_id'] in slice['slice_attribute_ids'] + assert slice_tag['slice_tag_id'] in slice['slice_tag_ids'] if 'admin' not in self.caller['roles']: if self.caller['person_id'] in slice['person_ids']: @@ -50,11 +50,11 @@ class DeleteSliceAttribute(Method): elif slice['site_id'] not in self.caller['site_ids']: raise PLCPermissionDenied, "Specified slice not associated with any of your sites" - if slice_attribute['min_role_id'] is not None and \ - min(self.caller['role_ids']) > slice_attribute['min_role_id']: + if slice_tag['min_role_id'] is not None and \ + min(self.caller['role_ids']) > slice_tag['min_role_id']: raise PLCPermissioinDenied, "Not allowed to delete the specified attribute" - slice_attribute.delete() - self.event_objects = {'SliceAttribute': [slice_attribute['slice_attribute_id']]} + slice_tag.delete() + self.event_objects = {'SliceTag': [slice_tag['slice_tag_id']]} return 1 diff --git a/PLC/Methods/GetBootMedium.py b/PLC/Methods/GetBootMedium.py index 6c28d2b..5abb295 100644 --- a/PLC/Methods/GetBootMedium.py +++ b/PLC/Methods/GetBootMedium.py @@ -12,7 +12,7 @@ from PLC.Auth import Auth from PLC.Nodes import Node, Nodes from PLC.Interfaces import Interface, Interfaces -from PLC.InterfaceSettings import InterfaceSetting, InterfaceSettings +from PLC.InterfaceTags import InterfaceTag, InterfaceTags from PLC.NodeTags import NodeTags # could not define this in the class.. @@ -197,7 +197,7 @@ class GetBootMedium(Method): file += 'DOMAIN_NAME="%s"\n' % domain # define various interface settings attached to the primary interface - settings = InterfaceSettings (self.api, {'interface_id':interface['interface_id']}) + settings = InterfaceTags (self.api, {'interface_id':interface['interface_id']}) categories = set() for setting in settings: @@ -205,7 +205,7 @@ class GetBootMedium(Method): categories.add(setting['category']) for category in categories: - category_settings = InterfaceSettings(self.api,{'interface_id':interface['interface_id'], + category_settings = InterfaceTags(self.api,{'interface_id':interface['interface_id'], 'category':category}) if category_settings: file += '### Category : %s\n'%category diff --git a/PLC/Methods/GetInterfaceSettings.py b/PLC/Methods/GetInterfaceTags.py similarity index 60% rename from PLC/Methods/GetInterfaceSettings.py rename to PLC/Methods/GetInterfaceTags.py index 31abd59..1b28c2f7 100644 --- a/PLC/Methods/GetInterfaceSettings.py +++ b/PLC/Methods/GetInterfaceTags.py @@ -10,16 +10,16 @@ from PLC.Parameter import Parameter, Mixed from PLC.Filter import Filter from PLC.Auth import Auth -from PLC.InterfaceSettings import InterfaceSetting, InterfaceSettings +from PLC.InterfaceTags import InterfaceTag, InterfaceTags from PLC.Sites import Site, Sites from PLC.Interfaces import Interface, Interfaces -class GetInterfaceSettings(Method): +class GetInterfaceTags(Method): """ Returns an array of structs containing details about interfaces and related settings. - If interface_setting_filter is specified and is an array of + If interface_tag_filter is specified and is an array of interface setting identifiers, only interface settings matching the filter will be returned. If return_fields is specified, only the specified details will be returned. @@ -29,17 +29,17 @@ class GetInterfaceSettings(Method): accepts = [ Auth(), - Mixed([InterfaceSetting.fields['interface_setting_id']], + Mixed([InterfaceTag.fields['interface_tag_id']], Parameter(int,"Interface setting id"), - Filter(InterfaceSetting.fields)), + Filter(InterfaceTag.fields)), Parameter([str], "List of fields to return", nullok = True) ] - returns = [InterfaceSetting.fields] + returns = [InterfaceTag.fields] - def call(self, auth, interface_setting_filter = None, return_fields = None): + def call(self, auth, interface_tag_filter = None, return_fields = None): - interface_settings = InterfaceSettings(self.api, interface_setting_filter, return_fields) + interface_tags = InterfaceTags(self.api, interface_tag_filter, return_fields) - return interface_settings + return interface_tags diff --git a/PLC/Methods/GetPeerData.py b/PLC/Methods/GetPeerData.py index 113fe86..213113b 100644 --- a/PLC/Methods/GetPeerData.py +++ b/PLC/Methods/GetPeerData.py @@ -17,7 +17,7 @@ from PLC.Keys import Key, Keys from PLC.Nodes import Node, Nodes from PLC.Persons import Person, Persons from PLC.Slices import Slice, Slices -from PLC.SliceAttributes import SliceAttributes +from PLC.SliceTags import SliceTags class GetPeerData(Method): """ @@ -67,7 +67,7 @@ class GetPeerData(Method): 'peer_id': None}, person_fields) # filter out system slices - system_slice_ids = SliceAttributes(self.api, {'name': 'system', 'value': '1'}).dict('slice_id') + system_slice_ids = SliceTags(self.api, {'name': 'system', 'value': '1'}).dict('slice_id') slices = Slices(self.api, {'peer_id': None, '~slice_id':system_slice_ids.keys()}) diff --git a/PLC/Methods/GetSliceAttributes.py b/PLC/Methods/GetSliceTags.py similarity index 59% rename from PLC/Methods/GetSliceAttributes.py rename to PLC/Methods/GetSliceTags.py index 882f984..2aef1c5 100644 --- a/PLC/Methods/GetSliceAttributes.py +++ b/PLC/Methods/GetSliceTags.py @@ -3,17 +3,17 @@ from PLC.Faults import * from PLC.Method import Method from PLC.Parameter import Parameter, Mixed from PLC.Filter import Filter -from PLC.SliceAttributes import SliceAttribute, SliceAttributes +from PLC.SliceTags import SliceTag, SliceTags from PLC.Persons import Person, Persons from PLC.Sites import Site, Sites from PLC.Slices import Slice, Slices from PLC.Auth import Auth -class GetSliceAttributes(Method): +class GetSliceTags(Method): """ Returns an array of structs containing details about slice and sliver attributes. An attribute is a sliver attribute if the - node_id field is set. If slice_attribute_filter is specified and + node_id field is set. If slice_tag_filter is specified and is an array of slice attribute identifiers, or a struct of slice attribute attributes, only slice attributes matching the filter will be returned. If return_fields is specified, only the @@ -29,15 +29,15 @@ class GetSliceAttributes(Method): accepts = [ Auth(), - Mixed([SliceAttribute.fields['slice_attribute_id']], - Filter(SliceAttribute.fields)), + Mixed([SliceTag.fields['slice_tag_id']], + Filter(SliceTag.fields)), Parameter([str], "List of fields to return", nullok = True) ] - returns = [SliceAttribute.fields] + returns = [SliceTag.fields] - def call(self, auth, slice_attribute_filter = None, return_fields = None): + def call(self, auth, slice_tag_filter = None, return_fields = None): # If we are not admin, make sure to only return our own slice # and sliver attributes. if isinstance(self.caller, Person) and \ @@ -53,37 +53,37 @@ class GetSliceAttributes(Method): return [] # Get slice attributes that we are able to view - valid_slice_attribute_ids = [] + valid_slice_tag_ids = [] slices = Slices(self.api, valid_slice_ids) for slice in slices: - valid_slice_attribute_ids += slice['slice_attribute_ids'] + valid_slice_tag_ids += slice['slice_tag_ids'] - if not valid_slice_attribute_ids: + if not valid_slice_tag_ids: return [] - if slice_attribute_filter is None: - slice_attribute_filter = valid_slice_attribute_ids + if slice_tag_filter is None: + slice_tag_filter = valid_slice_tag_ids - # Must query at least slice_attribute_id (see below) - if return_fields is not None and 'slice_attribute_id' not in return_fields: - return_fields.append('slice_attribute_id') + # Must query at least slice_tag_id (see below) + if return_fields is not None and 'slice_tag_id' not in return_fields: + return_fields.append('slice_tag_id') added_fields = True else: added_fields = False - slice_attributes = SliceAttributes(self.api, slice_attribute_filter, return_fields) + slice_tags = SliceTags(self.api, slice_tag_filter, return_fields) # Filter out slice attributes that are not viewable if isinstance(self.caller, Person) and \ 'admin' not in self.caller['roles']: - slice_attributes = filter(lambda slice_attribute: \ - slice_attribute['slice_attribute_id'] in valid_slice_attribute_ids, - slice_attributes) + slice_tags = filter(lambda slice_tag: \ + slice_tag['slice_tag_id'] in valid_slice_tag_ids, + slice_tags) - # Remove slice_attribute_id if not specified + # Remove slice_tag_id if not specified if added_fields: - for slice_attribute in slice_attributes: - if 'slice_attribute_id' in slice_attribute: - del slice_attribute['slice_attribute_id'] + for slice_tag in slice_tags: + if 'slice_tag_id' in slice_tag: + del slice_tag['slice_tag_id'] - return slice_attributes + return slice_tags diff --git a/PLC/Methods/GetSlivers.py b/PLC/Methods/GetSlivers.py index bc62f47..53d79a9 100644 --- a/PLC/Methods/GetSlivers.py +++ b/PLC/Methods/GetSlivers.py @@ -13,19 +13,19 @@ from PLC.ConfFiles import ConfFile, ConfFiles from PLC.Slices import Slice, Slices from PLC.Persons import Person, Persons from PLC.Keys import Key, Keys -from PLC.SliceAttributes import SliceAttribute, SliceAttributes +from PLC.SliceTags import SliceTag, SliceTags from PLC.InitScripts import InitScript, InitScripts def get_slivers(api, slice_filter, node = None): # Get slice information - slices = Slices(api, slice_filter, ['slice_id', 'name', 'instantiation', 'expires', 'person_ids', 'slice_attribute_ids']) + slices = Slices(api, slice_filter, ['slice_id', 'name', 'instantiation', 'expires', 'person_ids', 'slice_tag_ids']) # Build up list of users and slice attributes person_ids = set() - slice_attribute_ids = set() + slice_tag_ids = set() for slice in slices: person_ids.update(slice['person_ids']) - slice_attribute_ids.update(slice['slice_attribute_ids']) + slice_tag_ids.update(slice['slice_tag_ids']) # Get user information all_persons = Persons(api, {'person_id':person_ids,'enabled':True}, ['person_id', 'enabled', 'key_ids']).dict() @@ -39,7 +39,7 @@ def get_slivers(api, slice_filter, node = None): all_keys = Keys(api, key_ids, ['key_id', 'key', 'key_type']).dict() # Get slice attributes - all_slice_attributes = SliceAttributes(api, slice_attribute_ids).dict() + all_slice_tags = SliceTags(api, slice_tag_ids).dict() slivers = [] for slice in slices: @@ -58,10 +58,10 @@ def get_slivers(api, slice_filter, node = None): attributes = [] # All (per-node and global) attributes for this slice - slice_attributes = [] - for slice_attribute_id in slice['slice_attribute_ids']: - if slice_attribute_id in all_slice_attributes: - slice_attributes.append(all_slice_attributes[slice_attribute_id]) + slice_tags = [] + for slice_tag_id in slice['slice_tag_ids']: + if slice_tag_id in all_slice_tags: + slice_tags.append(all_slice_tags[slice_tag_id]) # Per-node sliver attributes take precedence over global # slice attributes, so set them first. @@ -70,27 +70,27 @@ def get_slivers(api, slice_filter, node = None): sliver_attributes = [] if node is not None: - for sliver_attribute in filter(lambda a: a['node_id'] == node['node_id'], slice_attributes): + for sliver_attribute in filter(lambda a: a['node_id'] == node['node_id'], slice_tags): sliver_attributes.append(sliver_attribute['tagname']) attributes.append({'tagname': sliver_attribute['tagname'], 'value': sliver_attribute['value']}) # set nodegroup slice attributes - for slice_attribute in filter(lambda a: a['nodegroup_id'] in node['nodegroup_ids'], slice_attributes): + for slice_tag in filter(lambda a: a['nodegroup_id'] in node['nodegroup_ids'], slice_tags): # Do not set any nodegroup slice attributes for # which there is at least one sliver attribute # already set. - if slice_attribute['tagname'] not in slice_attributes: - attributes.append({'tagname': slice_attribute['tagname'], - 'value': slice_attribute['value']}) + if slice_tag['tagname'] not in slice_tags: + attributes.append({'tagname': slice_tag['tagname'], + 'value': slice_tag['value']}) - for slice_attribute in filter(lambda a: a['node_id'] is None, slice_attributes): + for slice_tag in filter(lambda a: a['node_id'] is None, slice_tags): # Do not set any global slice attributes for # which there is at least one sliver attribute # already set. - if slice_attribute['tagname'] not in sliver_attributes: - attributes.append({'tagname': slice_attribute['tagname'], - 'value': slice_attribute['value']}) + if slice_tag['tagname'] not in sliver_attributes: + attributes.append({'tagname': slice_tag['tagname'], + 'value': slice_tag['value']}) slivers.append({ 'name': slice['name'], @@ -141,8 +141,8 @@ class GetSlivers(Method): 'key': Key.fields['key'] }], 'attributes': [{ - 'tagname': SliceAttribute.fields['tagname'], - 'value': SliceAttribute.fields['value'] + 'tagname': SliceTag.fields['tagname'], + 'value': SliceTag.fields['value'] }] }] } @@ -204,8 +204,8 @@ class GetSlivers(Method): initscripts = InitScripts(self.api, {'enabled': True}) # Get system slices - system_slice_attributes = SliceAttributes(self.api, {'tagname': 'system', 'value': '1'}).dict('slice_id') - system_slice_ids = system_slice_attributes.keys() + system_slice_tags = SliceTags(self.api, {'tagname': 'system', 'value': '1'}).dict('slice_id') + system_slice_ids = system_slice_tags.keys() # Get nm-controller slices controller_and_delegated_slices = Slices(self.api, {'instantiation': ['nm-controller', 'delegated']}, ['slice_id']).dict('slice_id') diff --git a/PLC/Methods/SliceExtendedInfo.py b/PLC/Methods/SliceExtendedInfo.py index ade6479..87f0567 100644 --- a/PLC/Methods/SliceExtendedInfo.py +++ b/PLC/Methods/SliceExtendedInfo.py @@ -4,7 +4,7 @@ from PLC.Parameter import Parameter, Mixed from PLC.Filter import Filter from PLC.Auth import Auth from PLC.Slices import Slice, Slices -from PLC.SliceAttributes import SliceAttribute, SliceAttributes +from PLC.SliceTags import SliceTag, SliceTags from PLC.Sites import Site, Sites from PLC.Nodes import Node, Nodes from PLC.Persons import Person, Persons @@ -62,7 +62,7 @@ class SliceExtendedInfo(Method): index = slices.index(slice) node_ids = slices[index].pop('node_ids') person_ids = slices[index].pop('person_ids') - attribute_ids = slices[index].pop('slice_attribute_ids') + attribute_ids = slices[index].pop('slice_tag_ids') if return_users or return_users is None: persons = Persons(self.api, person_ids) person_info = [{'email': person['email'], @@ -76,7 +76,7 @@ class SliceExtendedInfo(Method): for node in nodes] slices[index]['nodes'] = node_info if return_attributes or return_attributes is None: - attributes = SliceAttributes(self.api, attribute_ids) + attributes = SliceTags(self.api, attribute_ids) attribute_info = [{'name': attribute['name'], 'value': attribute['value']} \ for attribute in attributes] diff --git a/PLC/Methods/SliceGetTicket.py b/PLC/Methods/SliceGetTicket.py index 81e5c4f..d9723b9 100644 --- a/PLC/Methods/SliceGetTicket.py +++ b/PLC/Methods/SliceGetTicket.py @@ -9,7 +9,7 @@ from PLC.Faults import * from PLC.Slices import Slice, Slices from PLC.Nodes import Node, Nodes from PLC.Persons import Person, Persons -from PLC.SliceAttributes import SliceAttribute, SliceAttributes +from PLC.SliceTags import SliceTag, SliceTags from PLC.Methods.GetSliceTicket import GetSliceTicket @@ -97,7 +97,7 @@ class SliceGetTicket(GetSliceTicket): nodes = Nodes(self.api, slice['node_ids']).dict() persons = Persons(self.api, slice['person_ids']).dict() - slice_attributes = SliceAttributes(self.api, slice['slice_attribute_ids']).dict() + slice_tags = SliceTags(self.api, slice['slice_tag_ids']).dict() ticket = NamedTemporaryFile() @@ -141,13 +141,13 @@ class SliceGetTicket(GetSliceTicket): # xml.startElement('rspec', {}) - for slice_attribute_id in slice['slice_attribute_ids']: - if not slice_attributes.has_key(slice_attribute_id): + for slice_tag_id in slice['slice_tag_ids']: + if not slice_tags.has_key(slice_tag_id): continue - slice_attribute = slice_attributes[slice_attribute_id] + slice_tag = slice_tags[slice_tag_id] - name = slice_attribute['name'] - value = slice_attribute['value'] + name = slice_tag['name'] + value = slice_tag['value'] def kbps_to_bps(kbps): bps = int(kbps) * 1000 @@ -179,7 +179,7 @@ class SliceGetTicket(GetSliceTicket): if name == 'initscript': (attribute_name, value_name, type) = ('initscript', 'initscript_id', 'integer') - value = slice_attribute['slice_attribute_id'] + value = slice_tag['slice_tag_id'] elif name in name_type_cast: (attribute_name, value_name, type, cast) = name_type_cast[name] value = cast(value) diff --git a/PLC/Methods/UpdateInterfaceSetting.py b/PLC/Methods/UpdateInterfaceTag.py similarity index 64% rename from PLC/Methods/UpdateInterfaceSetting.py rename to PLC/Methods/UpdateInterfaceTag.py index 94c2b8d..2ad69d1 100644 --- a/PLC/Methods/UpdateInterfaceSetting.py +++ b/PLC/Methods/UpdateInterfaceTag.py @@ -10,13 +10,13 @@ from PLC.Method import Method from PLC.Parameter import Parameter, Mixed from PLC.Auth import Auth -from PLC.InterfaceSettings import InterfaceSetting, InterfaceSettings +from PLC.InterfaceTags import InterfaceTag, InterfaceTags from PLC.Interfaces import Interface, Interfaces from PLC.Nodes import Nodes from PLC.Sites import Sites -class UpdateInterfaceSetting(Method): +class UpdateInterfaceTag(Method): """ Updates the value of an existing interface setting @@ -29,27 +29,27 @@ class UpdateInterfaceSetting(Method): accepts = [ Auth(), - InterfaceSetting.fields['interface_setting_id'], - InterfaceSetting.fields['value'] + InterfaceTag.fields['interface_tag_id'], + InterfaceTag.fields['value'] ] returns = Parameter(int, '1 if successful') object_type = 'Interface' - def call(self, auth, interface_setting_id, value): - interface_settings = InterfaceSettings(self.api, [interface_setting_id]) - if not interface_settings: - raise PLCInvalidArgument, "No such interface setting %r"%interface_setting_id - interface_setting = interface_settings[0] + def call(self, auth, interface_tag_id, value): + interface_tags = InterfaceTags(self.api, [interface_tag_id]) + if not interface_tags: + raise PLCInvalidArgument, "No such interface setting %r"%interface_tag_id + interface_tag = interface_tags[0] - ### reproducing a check from UpdateSliceAttribute, looks dumb though - interfaces = Interfaces(self.api, [interface_setting['interface_id']]) + ### reproducing a check from UpdateSliceTag, looks dumb though + interfaces = Interfaces(self.api, [interface_tag['interface_id']]) if not interfaces: - raise PLCInvalidArgument, "No such interface %r"%interface_setting['interface_id'] + raise PLCInvalidArgument, "No such interface %r"%interface_tag['interface_id'] interface = interfaces[0] - assert interface_setting['interface_setting_id'] in interface['interface_setting_ids'] + assert interface_tag['interface_tag_id'] in interface['interface_tag_ids'] # check permission : it not admin, is the user affiliated with the right site if 'admin' not in self.caller['roles']: @@ -66,8 +66,8 @@ class UpdateInterfaceSetting(Method): min(self.caller['role_ids']) > required_min_role: raise PLCPermissionDenied, "Not allowed to modify the specified interface setting, requires role %d",required_min_role - interface_setting['value'] = value - interface_setting.sync() + interface_tag['value'] = value + interface_tag.sync() - self.object_ids = [interface_setting['interface_setting_id']] + self.object_ids = [interface_tag['interface_tag_id']] return 1 diff --git a/PLC/Methods/UpdateNodeTag.py b/PLC/Methods/UpdateNodeTag.py index 386a541..1cdff80 100644 --- a/PLC/Methods/UpdateNodeTag.py +++ b/PLC/Methods/UpdateNodeTag.py @@ -43,7 +43,7 @@ class UpdateNodeTag(Method): raise PLCInvalidArgument, "No such node tag %r"%node_tag_id node_tag = node_tags[0] - ### reproducing a check from UpdateSliceAttribute, looks dumb though + ### reproducing a check from UpdateSliceTag, looks dumb though nodes = Nodes(self.api, [node_tag['node_id']]) if not nodes: raise PLCInvalidArgument, "No such node %r"%node_tag['node_id'] diff --git a/PLC/Methods/UpdateSliceAttribute.py b/PLC/Methods/UpdateSliceTag.py similarity index 64% rename from PLC/Methods/UpdateSliceAttribute.py rename to PLC/Methods/UpdateSliceTag.py index 0a4dc96..d55bf85 100644 --- a/PLC/Methods/UpdateSliceAttribute.py +++ b/PLC/Methods/UpdateSliceTag.py @@ -2,12 +2,12 @@ from PLC.Faults import * from PLC.Method import Method from PLC.Parameter import Parameter, Mixed -from PLC.SliceAttributes import SliceAttribute, SliceAttributes +from PLC.SliceTags import SliceTag, SliceTags from PLC.Slices import Slice, Slices from PLC.InitScripts import InitScript, InitScripts from PLC.Auth import Auth -class UpdateSliceAttribute(Method): +class UpdateSliceTag(Method): """ Updates the value of an existing slice or sliver attribute. @@ -23,25 +23,25 @@ class UpdateSliceAttribute(Method): accepts = [ Auth(), - SliceAttribute.fields['slice_attribute_id'], - Mixed(SliceAttribute.fields['value'], + SliceTag.fields['slice_tag_id'], + Mixed(SliceTag.fields['value'], InitScript.fields['name']) ] returns = Parameter(int, '1 if successful') - def call(self, auth, slice_attribute_id, value): - slice_attributes = SliceAttributes(self.api, [slice_attribute_id]) - if not slice_attributes: + def call(self, auth, slice_tag_id, value): + slice_tags = SliceTags(self.api, [slice_tag_id]) + if not slice_tags: raise PLCInvalidArgument, "No such slice attribute" - slice_attribute = slice_attributes[0] + slice_tag = slice_tags[0] - slices = Slices(self.api, [slice_attribute['slice_id']]) + slices = Slices(self.api, [slice_tag['slice_id']]) if not slices: raise PLCInvalidArgument, "No such slice" slice = slices[0] - assert slice_attribute['slice_attribute_id'] in slice['slice_attribute_ids'] + assert slice_tag['slice_tag_id'] in slice['slice_tag_ids'] if 'admin' not in self.caller['roles']: if self.caller['person_id'] in slice['person_ids']: @@ -51,16 +51,16 @@ class UpdateSliceAttribute(Method): elif slice['site_id'] not in self.caller['site_ids']: raise PLCPermissionDenied, "Specified slice not associated with any of your sites" - if slice_attribute['min_role_id'] is not None and \ - min(self.caller['role_ids']) > slice_attribute['min_role_id']: + if slice_tag['min_role_id'] is not None and \ + min(self.caller['role_ids']) > slice_tag['min_role_id']: raise PLCPermissionDenied, "Not allowed to update the specified attribute" - if slice_attribute['tagname'] in ['initscript']: + if slice_tag['tagname'] in ['initscript']: initscripts = InitScripts(self.api, {'enabled': True, 'name': value}) if not initscripts: raise PLCInvalidArgument, "No such plc initscript" - slice_attribute['value'] = unicode(value) - slice_attribute.sync() - self.event_objects = {'SliceAttribute': [slice_attribute['slice_attribute_id']]} + slice_tag['value'] = unicode(value) + slice_tag.sync() + self.event_objects = {'SliceTag': [slice_tag['slice_tag_id']]} return 1 diff --git a/PLC/Methods/__init__.py b/PLC/Methods/__init__.py index aa324be..3e06b7d 100644 --- a/PLC/Methods/__init__.py +++ b/PLC/Methods/__init__.py @@ -8,7 +8,7 @@ AddConfFileToNodeGroup AddIlink AddInitScript AddInterface -AddInterfaceSetting +AddInterfaceTag AddKeyType AddMessage AddNetworkMethod @@ -31,8 +31,8 @@ AddSession AddSite AddSiteAddress AddSlice -AddSliceAttribute AddSliceInstantiation +AddSliceTag AddSliceToNodes AddSliceToNodesWhitelist AddTagType @@ -52,7 +52,7 @@ DeleteConfFileFromNodeGroup DeleteIlink DeleteInitScript DeleteInterface -DeleteInterfaceSetting +DeleteInterfaceTag DeleteKey DeleteKeyType DeleteMessage @@ -74,10 +74,10 @@ DeleteRoleFromPerson DeleteSession DeleteSite DeleteSlice -DeleteSliceAttribute DeleteSliceFromNodes DeleteSliceFromNodesWhitelist DeleteSliceInstantiation +DeleteSliceTag DeleteTagType GenerateNodeConfFile GetAddressTypes @@ -89,7 +89,7 @@ GetEventObjects GetEvents GetIlinks GetInitScripts -GetInterfaceSettings +GetInterfaceTags GetInterfaces GetKeyTypes GetKeys @@ -111,9 +111,9 @@ GetRoles GetSession GetSessions GetSites -GetSliceAttributes GetSliceInstantiations GetSliceKeys +GetSliceTags GetSliceTicket GetSlices GetSlicesMD5 @@ -148,7 +148,7 @@ UpdateConfFile UpdateIlink UpdateInitScript UpdateInterface -UpdateInterfaceSetting +UpdateInterfaceTag UpdateKey UpdateMessage UpdateNode @@ -161,7 +161,7 @@ UpdatePeer UpdatePerson UpdateSite UpdateSlice -UpdateSliceAttribute +UpdateSliceTag UpdateTagType VerifyPerson system.listMethods diff --git a/PLC/Nodes.py b/PLC/Nodes.py index cc7bbcc..0734e58 100644 --- a/PLC/Nodes.py +++ b/PLC/Nodes.py @@ -38,7 +38,7 @@ class Node(Row): table_name = 'nodes' primary_key = 'node_id' - join_tables = [ 'slice_node', 'peer_node', 'slice_attribute', + join_tables = [ 'slice_node', 'peer_node', 'slice_tag', 'node_session', 'node_slice_whitelist', 'node_tag', 'conf_file_node', 'pcu_node', ] fields = { @@ -237,7 +237,7 @@ class Node(Row): assert 'node_id' in self assert 'interface_ids' in self - # we need to clean up InterfaceSettings, so handling interfaces as part of join_tables does not work + # we need to clean up InterfaceTags, so handling interfaces as part of join_tables does not work for interface in Interfaces(self.api,self['interface_ids']): interface.delete() diff --git a/PLC/Peers.py b/PLC/Peers.py index b470595..6cdd68e 100644 --- a/PLC/Peers.py +++ b/PLC/Peers.py @@ -18,7 +18,7 @@ from PLC.Persons import Person, Persons from PLC.Keys import Key, Keys from PLC.Nodes import Node, Nodes from PLC.TagTypes import TagType, TagTypes -from PLC.SliceAttributes import SliceAttribute, SliceAttributes +from PLC.SliceTags import SliceTag, SliceTags from PLC.Slices import Slice, Slices class Peer(Row): diff --git a/PLC/SliceAttributes.py b/PLC/SliceAttributes.py deleted file mode 100644 index 7ef8e63..0000000 --- a/PLC/SliceAttributes.py +++ /dev/null @@ -1,48 +0,0 @@ -# $Id# -from PLC.Faults import * -from PLC.Parameter import Parameter -from PLC.Filter import Filter -from PLC.Table import Row, Table -from PLC.TagTypes import TagType, TagTypes - -class SliceAttribute(Row): - """ - Representation of a row in the slice_attribute table. To use, - instantiate with a dict of values. - """ - - table_name = 'slice_attribute' - primary_key = 'slice_attribute_id' - fields = { - 'slice_attribute_id': Parameter(int, "Slice attribute identifier"), - 'slice_id': Parameter(int, "Slice identifier"), - 'node_id': Parameter(int, "Node identifier, if a sliver attribute"), - 'nodegroup_id': Parameter(int, "Nodegroup identifier, if a sliver attribute"), - 'tag_type_id': TagType.fields['tag_type_id'], - 'tagname': TagType.fields['tagname'], - 'description': TagType.fields['description'], - 'category': TagType.fields['category'], - 'min_role_id': TagType.fields['min_role_id'], - 'value': Parameter(str, "Slice attribute value"), - } - -class SliceAttributes(Table): - """ - Representation of row(s) from the slice_attribute table in the - database. - """ - - def __init__(self, api, slice_attribute_filter = None, columns = None): - Table.__init__(self, api, SliceAttribute, columns) - - sql = "SELECT %s FROM view_slice_attributes WHERE True" % \ - ", ".join(self.columns) - - if slice_attribute_filter is not None: - if isinstance(slice_attribute_filter, (list, tuple, set)): - slice_attribute_filter = Filter(SliceAttribute.fields, {'slice_attribute_id': slice_attribute_filter}) - elif isinstance(slice_attribute_filter, dict): - slice_attribute_filter = Filter(SliceAttribute.fields, slice_attribute_filter) - sql += " AND (%s) %s" % slice_attribute_filter.sql(api) - - self.selectall(sql) diff --git a/PLC/SliceTags.py b/PLC/SliceTags.py new file mode 100644 index 0000000..bde5df5 --- /dev/null +++ b/PLC/SliceTags.py @@ -0,0 +1,48 @@ +# $Id# +from PLC.Faults import * +from PLC.Parameter import Parameter +from PLC.Filter import Filter +from PLC.Table import Row, Table +from PLC.TagTypes import TagType, TagTypes + +class SliceTag(Row): + """ + Representation of a row in the slice_tag table. To use, + instantiate with a dict of values. + """ + + table_name = 'slice_tag' + primary_key = 'slice_tag_id' + fields = { + 'slice_tag_id': Parameter(int, "Slice attribute identifier"), + 'slice_id': Parameter(int, "Slice identifier"), + 'node_id': Parameter(int, "Node identifier, if a sliver attribute"), + 'nodegroup_id': Parameter(int, "Nodegroup identifier, if a sliver attribute"), + 'tag_type_id': TagType.fields['tag_type_id'], + 'tagname': TagType.fields['tagname'], + 'description': TagType.fields['description'], + 'category': TagType.fields['category'], + 'min_role_id': TagType.fields['min_role_id'], + 'value': Parameter(str, "Slice attribute value"), + } + +class SliceTags(Table): + """ + Representation of row(s) from the slice_tag table in the + database. + """ + + def __init__(self, api, slice_tag_filter = None, columns = None): + Table.__init__(self, api, SliceTag, columns) + + sql = "SELECT %s FROM view_slice_tags WHERE True" % \ + ", ".join(self.columns) + + if slice_tag_filter is not None: + if isinstance(slice_tag_filter, (list, tuple, set)): + slice_tag_filter = Filter(SliceTag.fields, {'slice_tag_id': slice_tag_filter}) + elif isinstance(slice_tag_filter, dict): + slice_tag_filter = Filter(SliceTag.fields, slice_tag_filter) + sql += " AND (%s) %s" % slice_tag_filter.sql(api) + + self.selectall(sql) diff --git a/PLC/Slices.py b/PLC/Slices.py index 27fc8ad..67fd268 100644 --- a/PLC/Slices.py +++ b/PLC/Slices.py @@ -11,7 +11,7 @@ from PLC.Table import Row, Table from PLC.SliceInstantiations import SliceInstantiation, SliceInstantiations from PLC.Nodes import Node from PLC.Persons import Person, Persons -from PLC.SliceAttributes import SliceAttribute +from PLC.SliceTags import SliceTag class Slice(Row): """ @@ -23,7 +23,7 @@ class Slice(Row): table_name = 'slices' primary_key = 'slice_id' - join_tables = ['slice_node', 'slice_person', 'slice_attribute', 'peer_slice', 'node_slice_whitelist'] + join_tables = ['slice_node', 'slice_person', 'slice_tag', 'peer_slice', 'node_slice_whitelist'] fields = { 'slice_id': Parameter(int, "Slice identifier"), 'site_id': Parameter(int, "Identifier of the site to which this slice belongs"), @@ -37,7 +37,7 @@ class Slice(Row): 'expires': Parameter(int, "Date and time when slice expires, in seconds since UNIX epoch"), 'node_ids': Parameter([int], "List of nodes in this slice", ro = True), 'person_ids': Parameter([int], "List of accounts that can use this slice", ro = True), - 'slice_attribute_ids': Parameter([int], "List of slice attributes", ro = True), + 'slice_tag_ids': Parameter([int], "List of slice attributes", ro = True), 'peer_id': Parameter(int, "Peer to which this slice belongs", nullok = True), 'peer_slice_id': Parameter(int, "Foreign slice identifier at peer", nullok = True), } @@ -152,14 +152,14 @@ class Slice(Row): AddSliceToNodes.__call__(AddSliceToNodes(self.api), auth, self['slice_id'], list(new_nodes)) if stale_nodes: DeleteSliceFromNodes.__call__(DeleteSliceFromNodes(self.api), auth, self['slice_id'], list(stale_nodes)) - def associate_slice_attributes(self, auth, fields, value): + def associate_slice_tags(self, auth, fields, value): """ - Deletes slice_attribute_ids not found in value list (using DeleteSliceAttribute). - Adds slice_attributes if slice_fields w/o slice_id is found (using AddSliceAttribute). - Updates slice_attribute if slice_fields w/ slice_id is found (using UpdateSlceiAttribute). + Deletes slice_tag_ids not found in value list (using DeleteSliceTag). + Adds slice_tags if slice_fields w/o slice_id is found (using AddSliceTag). + Updates slice_tag if slice_fields w/ slice_id is found (using UpdateSlceiAttribute). """ - assert 'slice_attribute_ids' in self + assert 'slice_tag_ids' in self assert isinstance(value, list) (attribute_ids, blank, attributes) = self.separate_types(value) @@ -167,21 +167,21 @@ class Slice(Row): # There is no way to add attributes by id. They are # associated with a slice when they are created. # So we are only looking to delete here - if self['slice_attribute_ids'] != attribute_ids: - from PLC.Methods.DeleteSliceAttribute import DeleteSliceAttribute - stale_attributes = set(self['slice_attribute_ids']).difference(attribute_ids) + if self['slice_tag_ids'] != attribute_ids: + from PLC.Methods.DeleteSliceTag import DeleteSliceTag + stale_attributes = set(self['slice_tag_ids']).difference(attribute_ids) for stale_attribute in stale_attributes: - DeleteSliceAttribute.__call__(DeleteSliceAttribute(self.api), auth, stale_attribute['slice_attribute_id']) + DeleteSliceTag.__call__(DeleteSliceTag(self.api), auth, stale_attribute['slice_tag_id']) # If dictionary exists, we are either adding new # attributes or updating existing ones. if attributes: - from PLC.Methods.AddSliceAttribute import AddSliceAttribute - from PLC.Methods.UpdateSliceAttribute import UpdateSliceAttribute + from PLC.Methods.AddSliceTag import AddSliceTag + from PLC.Methods.UpdateSliceTag import UpdateSliceTag - added_attributes = filter(lambda x: 'slice_attribute_id' not in x, attributes) - updated_attributes = filter(lambda x: 'slice_attribute_id' in x, attributes) + added_attributes = filter(lambda x: 'slice_tag_id' not in x, attributes) + updated_attributes = filter(lambda x: 'slice_tag_id' in x, attributes) for added_attribute in added_attributes: if 'tag_type' in added_attribute: @@ -206,13 +206,13 @@ class Slice(Row): else: nodegroup_id = None - AddSliceAttribute.__call__(AddSliceAttribute(self.api), auth, self['slice_id'], type, value, node_id, nodegroup_id) + AddSliceTag.__call__(AddSliceTag(self.api), auth, self['slice_id'], type, value, node_id, nodegroup_id) for updated_attribute in updated_attributes: - attribute_id = updated_attribute.pop('slice_attribute_id') - if attribute_id not in self['slice_attribute_ids']: + attribute_id = updated_attribute.pop('slice_tag_id') + if attribute_id not in self['slice_tag_ids']: raise PLCInvalidArgument, "Attribute doesnt belong to this slice" else: - UpdateSliceAttribute.__call__(UpdateSliceAttribute(self.api), auth, attribute_id, updated_attribute) + UpdateSliceTag.__call__(UpdateSliceTag(self.api), auth, attribute_id, updated_attribute) def sync(self, commit = True): """ diff --git a/PLC/TagTypes.py b/PLC/TagTypes.py index 7a4df1f..a7f180d 100644 --- a/PLC/TagTypes.py +++ b/PLC/TagTypes.py @@ -22,7 +22,7 @@ class TagType (Row): table_name = 'tag_types' primary_key = 'tag_type_id' - join_tables = ['node_tag', 'interface_setting', 'slice_attribute' ] + join_tables = ['node_tag', 'interface_tag', 'slice_tag' ] fields = { 'tag_type_id': Parameter(int, "Node tag type identifier"), 'tagname': Parameter(str, "Node tag type name", max = 100), diff --git a/PLC/__init__.py b/PLC/__init__.py index 22f8b24..21b3b5f 100644 --- a/PLC/__init__.py +++ b/PLC/__init__.py @@ -15,7 +15,7 @@ Filter GPG Ilinks InitScripts -InterfaceSettings +InterfaceTags Interfaces KeyTypes Keys @@ -39,8 +39,8 @@ Roles Sessions Shell Sites -SliceAttributes SliceInstantiations +SliceTags Slices Table TagTypes diff --git a/migrations/v4-to-v5/migrate.sed b/migrations/v4-to-v5/migrate.sed index 76a4263..c432d9d 100644 --- a/migrations/v4-to-v5/migrate.sed +++ b/migrations/v4-to-v5/migrate.sed @@ -1,3 +1,5 @@ -s,nodenetwork,interface,g s,slice_attribute_type,tag_type,g s,attribute_type_id,tag_type_id,g +s,nodenetwork_setting,interface_tag,g +s,slice_attribute,slice_tag,g +s,nodenetwork,interface,g diff --git a/migrations/v4-to-v5/migrate.sql b/migrations/v4-to-v5/migrate.sql index 3bbd624..27b88fb 100644 --- a/migrations/v4-to-v5/migrate.sql +++ b/migrations/v4-to-v5/migrate.sql @@ -3,6 +3,8 @@ -- $Id$ -- -- this is part of the script to migrate from 4.2 to 5.0 +-- +-- most of the renamings have taken place already when this script is invoked -- ---------------------------------------- @@ -51,7 +53,7 @@ DROP VIEW node_slices CASCADE; DROP VIEW node_slices_whitelist CASCADE; DROP VIEW nodegroup_conf_files CASCADE; DROP VIEW nodegroup_nodes CASCADE; -DROP VIEW interface_settings CASCADE; +DROP VIEW interface_tags CASCADE; DROP VIEW pcu_nodes CASCADE; DROP VIEW pcu_protocol_types CASCADE; DROP VIEW peer_keys CASCADE; @@ -69,7 +71,7 @@ DROP VIEW site_nodes CASCADE; DROP VIEW site_pcus CASCADE; DROP VIEW site_persons CASCADE; DROP VIEW site_slices CASCADE; -DROP VIEW slice_attributes CASCADE; +DROP VIEW slice_tags CASCADE; DROP VIEW slice_nodes CASCADE; DROP VIEW slice_persons CASCADE; DROP VIEW slivers CASCADE; @@ -80,7 +82,7 @@ DROP VIEW view_event_objects CASCADE; -- caught by some previous cascade -- DROP VIEW view_events CASCADE; DROP VIEW view_keys CASCADE; -- caught by some previous cascade -- DROP VIEW view_nodegroups CASCADE; -DROP VIEW view_interface_settings CASCADE; +DROP VIEW view_interface_tags CASCADE; -- caught by some previous cascade -- DROP VIEW view_interfaces CASCADE; -- caught by some previous cascade -- DROP VIEW view_nodes CASCADE; -- caught by some previous cascade -- DROP VIEW view_pcu_types CASCADE; @@ -89,7 +91,7 @@ DROP VIEW view_interface_settings CASCADE; -- caught by some previous cascade -- DROP VIEW view_persons CASCADE; DROP VIEW view_sessions CASCADE; -- caught by some previous cascade -- DROP VIEW view_sites CASCADE; -DROP VIEW view_slice_attributes CASCADE; +DROP VIEW view_slice_tags CASCADE; -- caught by some previous cascade -- DROP VIEW view_slices CASCADE; -- shows in logfile @@ -113,39 +115,39 @@ ALTER TABLE tag_types ADD COLUMN category TEXT NOT NULL DEFAULT 'slice/legacy'; --- append in tag_types the contents of nodenetwork_setting_types INSERT INTO tag_types (tagname,description,min_role_id,category) - SELECT name,description,min_role_id,'interface/legacy' FROM interface_setting_types; + SELECT name,description,min_role_id,'interface/legacy' FROM interface_tag_types; ---------- interface settings ---- former nodenetwork_setting_type_id are now renumbered, need to fix interface_setting accordingly +--- former nodenetwork_setting_type_id are now renumbered, need to fix interface_tag accordingly -- old_index -> new_index relation CREATE OR REPLACE VIEW mgn_setting_renumber AS SELECT - interface_setting_types.interface_setting_type_id AS old_index, + interface_tag_types.interface_tag_type_id AS old_index, tag_types.tag_type_id AS new_index FROM - interface_setting_types INNER JOIN tag_types - ON interface_setting_types.name = tag_types.tagname; + interface_tag_types INNER JOIN tag_types + ON interface_tag_types.name = tag_types.tagname; --- need to temporarily drop constraint on interface_setting_type_id -ALTER TABLE interface_setting DROP CONSTRAINT interface_setting_interface_setting_type_id_fkey; +-- need to temporarily drop constraint on interface_tag_type_id +ALTER TABLE interface_tag DROP CONSTRAINT interface_tag_interface_tag_type_id_fkey; -- do the transcoding -UPDATE interface_setting - SET interface_setting_type_id = - (select new_index from mgn_setting_renumber where old_index=interface_setting_type_id); +UPDATE interface_tag + SET interface_tag_type_id = + (select new_index from mgn_setting_renumber where old_index=interface_tag_type_id); -- alter column name to reflect change -ALTER TABLE interface_setting RENAME interface_setting_type_id TO tag_type_id; +ALTER TABLE interface_tag RENAME interface_tag_type_id TO tag_type_id; -- add contraint again -ALTER TABLE interface_setting ADD CONSTRAINT interface_setting_tag_type_id_fkey +ALTER TABLE interface_tag ADD CONSTRAINT interface_tag_tag_type_id_fkey FOREIGN KEY (tag_type_id) references tag_types(tag_type_id) ; --- drop former interface_setting_types altogether +-- drop former interface_tag_types altogether drop view mgn_setting_renumber; -drop table interface_setting_types; +drop table interface_tag_types; ---------- node tags diff --git a/planetlab5.sql b/planetlab5.sql index a9bca21..a0e072d 100644 --- a/planetlab5.sql +++ b/planetlab5.sql @@ -400,30 +400,30 @@ GROUP BY node_id; -- Interface settings -------------------------------------------------------------------------------- -CREATE TABLE interface_setting ( - interface_setting_id serial PRIMARY KEY, -- Interface Setting Identifier +CREATE TABLE interface_tag ( + interface_tag_id serial PRIMARY KEY, -- Interface Setting Identifier interface_id integer REFERENCES interfaces NOT NULL,-- the interface this applies to tag_type_id integer REFERENCES tag_types NOT NULL, -- the setting type value text -- value attached ) WITH OIDS; -CREATE OR REPLACE VIEW interface_settings AS +CREATE OR REPLACE VIEW interface_tags AS SELECT interface_id, -array_accum(interface_setting_id) AS interface_setting_ids -FROM interface_setting +array_accum(interface_tag_id) AS interface_tag_ids +FROM interface_tag GROUP BY interface_id; -CREATE OR REPLACE VIEW view_interface_settings AS +CREATE OR REPLACE VIEW view_interface_tags AS SELECT -interface_setting.interface_setting_id, -interface_setting.interface_id, +interface_tag.interface_tag_id, +interface_tag.interface_id, tag_types.tag_type_id, tag_types.tagname, tag_types.description, tag_types.category, tag_types.min_role_id, -interface_setting.value -FROM interface_setting +interface_tag.value +FROM interface_tag INNER JOIN tag_types USING (tag_type_id); CREATE OR REPLACE VIEW view_interfaces AS @@ -443,7 +443,7 @@ interfaces.dns1, interfaces.dns2, interfaces.bwlimit, interfaces.hostname, -COALESCE((SELECT interface_setting_ids FROM interface_settings WHERE interface_settings.interface_id = interfaces.interface_id), '{}') AS interface_setting_ids +COALESCE((SELECT interface_tag_ids FROM interface_tags WHERE interface_tags.interface_id = interfaces.interface_id), '{}') AS interface_tag_ids FROM interfaces; -------------------------------------------------------------------------------- @@ -747,22 +747,22 @@ GROUP BY node_id; -------------------------------------------------------------------------------- -- Slice/sliver attributes -CREATE TABLE slice_attribute ( - slice_attribute_id serial PRIMARY KEY, -- Slice attribute identifier +CREATE TABLE slice_tag ( + slice_tag_id serial PRIMARY KEY, -- Slice attribute identifier slice_id integer REFERENCES slices NOT NULL, -- Slice identifier node_id integer REFERENCES nodes, -- Sliver attribute if set nodegroup_id integer REFERENCES nodegroups, -- Node group attribute if set tag_type_id integer REFERENCES tag_types NOT NULL, -- Attribute type identifier value text ) WITH OIDS; -CREATE INDEX slice_attribute_slice_id_idx ON slice_attribute (slice_id); -CREATE INDEX slice_attribute_node_id_idx ON slice_attribute (node_id); -CREATE INDEX slice_attribute_nodegroup_id_idx ON slice_attribute (nodegroup_id); +CREATE INDEX slice_tag_slice_id_idx ON slice_tag (slice_id); +CREATE INDEX slice_tag_node_id_idx ON slice_tag (node_id); +CREATE INDEX slice_tag_nodegroup_id_idx ON slice_tag (nodegroup_id); -CREATE OR REPLACE VIEW slice_attributes AS +CREATE OR REPLACE VIEW slice_tags AS SELECT slice_id, -array_accum(slice_attribute_id) AS slice_attribute_ids -FROM slice_attribute +array_accum(slice_tag_id) AS slice_tag_ids +FROM slice_tag GROUP BY slice_id; -------------------------------------------------------------------------------- @@ -1194,23 +1194,23 @@ peer_slice.peer_id, peer_slice.peer_slice_id, COALESCE((SELECT node_ids FROM slice_nodes WHERE slice_nodes.slice_id = slices.slice_id), '{}') AS node_ids, COALESCE((SELECT person_ids FROM slice_persons WHERE slice_persons.slice_id = slices.slice_id), '{}') AS person_ids, -COALESCE((SELECT slice_attribute_ids FROM slice_attributes WHERE slice_attributes.slice_id = slices.slice_id), '{}') AS slice_attribute_ids +COALESCE((SELECT slice_tag_ids FROM slice_tags WHERE slice_tags.slice_id = slices.slice_id), '{}') AS slice_tag_ids FROM slices LEFT JOIN peer_slice USING (slice_id); -CREATE OR REPLACE VIEW view_slice_attributes AS +CREATE OR REPLACE VIEW view_slice_tags AS SELECT -slice_attribute.slice_attribute_id, -slice_attribute.slice_id, -slice_attribute.node_id, -slice_attribute.nodegroup_id, +slice_tag.slice_tag_id, +slice_tag.slice_id, +slice_tag.node_id, +slice_tag.nodegroup_id, tag_types.tag_type_id, tag_types.tagname, tag_types.description, tag_types.category, tag_types.min_role_id, -slice_attribute.value -FROM slice_attribute +slice_tag.value +FROM slice_tag INNER JOIN tag_types USING (tag_type_id); CREATE OR REPLACE VIEW view_sessions AS diff --git a/tools/slice_attributes.py b/tools/slice_attributes.py index d206098..f87ddcd 100755 --- a/tools/slice_attributes.py +++ b/tools/slice_attributes.py @@ -18,7 +18,7 @@ rename = {'nm_net_min_rate': 'net_min_rate', 'nm_net_max_rate': 'net_max_rate', 'nm_net_exempt_min_rate': 'net_i2_min_rate', 'nm_net_exempt_max_rate': 'net_i2_max_rate'} -for slice_attribute in GetSliceAttributes({'name': rename.keys()}): +for slice_attribute in GetSliceTags({'name': rename.keys()}): id = slice_attribute['slice_attribute_id'] name = slice_attribute['name'] slice_id = slice_attribute['slice_id'] @@ -29,10 +29,10 @@ for slice_attribute in GetSliceAttributes({'name': rename.keys()}): # Add the new attribute if GetSlices([slice_id]): - AddSliceAttribute(slice_id, rename[name], str(kbps)) + AddSliceTag(slice_id, rename[name], str(kbps)) # Delete the old attribute - DeleteSliceAttribute(id) + DeleteSliceTag(id) # Convert nm_net_{exempt_,}avg_rate to # net_{i2_,}max_kbyte and net_{i2_,}thresh_kbyte @@ -40,7 +40,7 @@ rename = {'nm_net_avg_rate': {'max': 'net_max_kbyte', 'thresh': 'net_thresh_kbyte'}, 'nm_net_exempt_avg_rate': {'max': 'net_i2_max_kbyte', 'thresh': 'net_i2_thresh_kbyte'}} -for slice_attribute in GetSliceAttributes({'name': rename.keys()}): +for slice_attribute in GetSliceTags({'name': rename.keys()}): id = slice_attribute['slice_attribute_id'] name = slice_attribute['name'] slice_id = slice_attribute['slice_id'] @@ -52,14 +52,14 @@ for slice_attribute in GetSliceAttributes({'name': rename.keys()}): # Add the new attribute if GetSlices([slice_id]): - AddSliceAttribute(slice_id, rename[name]['max'], str(max_kbyte)) - AddSliceAttribute(slice_id, rename[name]['thresh'], str(thresh_kbyte)) + AddSliceTag(slice_id, rename[name]['max'], str(max_kbyte)) + AddSliceTag(slice_id, rename[name]['thresh'], str(thresh_kbyte)) # Delete the old attribute - DeleteSliceAttribute(id) + DeleteSliceTag(id) # Convert plc_slice_state -for slice_attribute in GetSliceAttributes({'name': 'plc_slice_state'}): +for slice_attribute in GetSliceTags({'name': 'plc_slice_state'}): id = slice_attribute['slice_attribute_id'] name = slice_attribute['name'] slice_id = slice_attribute['slice_id'] @@ -67,12 +67,12 @@ for slice_attribute in GetSliceAttributes({'name': 'plc_slice_state'}): # Add the new attribute if GetSlices([slice_id]): if slice_attribute['value'] == "suspended": - AddSliceAttribute(slice_id, 'enabled', "0") + AddSliceTag(slice_id, 'enabled', "0") else: - AddSliceAttribute(slice_id, 'enabled', "1") + AddSliceTag(slice_id, 'enabled', "1") # Delete the old attribute - DeleteSliceAttribute(id) + DeleteSliceTag(id) # Straight renames rename = {'nm_cpu_share': 'cpu_share', @@ -83,7 +83,7 @@ rename = {'nm_cpu_share': 'cpu_share', 'nm_net_max_thresh_byte': 'net_thresh_kbyte', 'nm_net_max_exempt_byte': 'net_i2_max_kbyte', 'nm_net_max_thresh_exempt_byte': 'net_i2_thresh_kbyte'} -for slice_attribute in GetSliceAttributes({'name': rename.keys()}): +for slice_attribute in GetSliceTags({'name': rename.keys()}): id = slice_attribute['slice_attribute_id'] name = slice_attribute['name'] slice_id = slice_attribute['slice_id'] @@ -93,16 +93,16 @@ for slice_attribute in GetSliceAttributes({'name': rename.keys()}): # Add the new attribute if GetSlices([slice_id]): - AddSliceAttribute(slice_id, rename[name], value) + AddSliceTag(slice_id, rename[name], value) # Delete the old attribute - DeleteSliceAttribute(id) + DeleteSliceTag(id) # Update plc_ticket_pubkey attribute -for slice_attribute in GetSliceAttributes({'name': "plc_ticket_pubkey"}): +for slice_attribute in GetSliceTags({'name': "plc_ticket_pubkey"}): id = slice_attribute['slice_attribute_id'] - UpdateSliceAttribute(id, """ + UpdateSliceTag(id, """ MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDKXa72MEKDAnVyzEpKOB1ot2eW xG/TG2aa7q/2oy1xf5XMmU9H9uKwO+GoUeinp1BSxgkVRF0VhEGGaqKR9kYQzX0k ht4+P2hAr+UyU4cp0NxV4xfmyAbrNKuHVjawMUCu5BH0IkBUC/89ckxk71oROnak @@ -110,14 +110,14 @@ FbI7ojUezSGr4aVabQIDAQAB """.lstrip()) # Delete _deleted and deprecated slice attributes and types -for attribute_type in GetSliceAttributeTypes(): +for attribute_type in GetSliceTagTypes(): id = attribute_type['attribute_type_id'] name = attribute_type['name'] if name == 'general_prop_share' or \ re.match('nm_', name) or \ re.search('_deleted$', name): - DeleteSliceAttributeType(id) + DeleteSliceTagType(id) # N.B. Automatically deletes all slice attributes of this type # Add Proper ops @@ -209,20 +209,20 @@ proper_ops = [ for slice, op in proper_ops: try: - AddSliceAttribute(slice, 'proper_op', op) + AddSliceTag(slice, 'proper_op', op) except Exception, err: print "Warning: %s:" % slice, err initscripts = dict([(initscript['initscript_id'], initscript) for initscript in [{'initscript_id': 8, 'script': 'IyEgL2Jpbi9zaA0KDQojIDxQcm9ncmFtIE5hbWU+DQojICAgIGJpbmRzY3JpcHQNCiMNCiMgPEF1dGhvcj4NCiMgICAgSmVmZnJ5IEpvaG5zdG9uIGFuZCBKZXJlbXkgUGxpY2h0YQ0KIw0KIyA8UHVycG9zZT4NCiMgICAgRG93bmxvYWRzIGFuZCBpbnN0YWxscyBzdG9yayBvbiBhIG5vZGUuDQoNCiMgc2F2ZSBvcmlnaW5hbCBQV0QNCk9MRFBXRD0kUFdEDQoNCiMgZXJyb3IgcmVwb3J0aW5nIGZ1bmN0aW9uDQplcnJvcigpDQp7DQogICBlY2hvDQogICBlY2hvICJQbGVhc2UgRS1tYWlsIHN0b3JrLXN1cHBvcnRAY3MuYXJpem9uYS5lZHUgaWYgeW91IGJlbGlldmUgeW91IGhhdmUiIA0KICAgZWNobyAicmVjZWl2ZWQgdGhpcyBtZXNzYWdlIGluIGVycm9yLiINCg0KICAgIyBnZXQgcmlkIG9mIENFUlQgZmlsZQ0KICAgaWYgWyAtZiAkQ0VSVCBdDQogICB0aGVuDQogICAgICBybSAtZiAkQ0VSVCA+IC9kZXYvbnVsbA0KICAgZmkNCg0KICAgIyByZXN0b3JlIG9yaWdpbmFsIFBXRA0KICAgY2QgJE9MRFBXRA0KICAgZXhpdCAxDQp9DQoNCkNFUlQ9YHB3ZGAvdGVtcGNydGZpbGUNCg0KI2Z1bmN0aW9ucw0KDQojIyMNCiMjIyBjcmVhdGVDZXJ0aWZpY2F0ZSgpDQojIyMgICAgcHJpbnRzIG91dCB0aGUgZXF1aWZheCBjZXJ0aWZpY2F0ZSB0byB1c2UgYW5kIHN0b3Jlcw0KIyMjICAgIHRoZSBmaWxlIG5hbWUgaW4gJENFUlQNCiMjIw0KZnVuY3Rpb24gY3JlYXRlQ2VydGlmaWNhdGUoKXsNCmNhdCA+ICRDRVJ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FjdCINCiAgIGVjaG8gInN0b3JrLXN1cHBvcnRAY3MuYXJpem9uYS5lZHUgZm9yIGFzc2lzdGFuY2UuIg0KICAgI3JtIC1mICRDRVJUID4gL2Rldi9udWxsDQogICBleGl0IDENCmZpDQoNCiMgZG9uZQ0KZXhpdCAwDQo=', 'name': 'arizona_stork_2', 'encoding': 'base64'}, {'initscript_id': 9, 'script': 'IyEvYmluL2Jhc2gNCmNkIC8NCnJtIC1mIHN0YXJ0X3B1cnBsZQ0Kd2dldCBodHRwOi8vd3d3LmNzLnByaW5jZXRvbi5lZHUvfmRlaXNlbnN0L3B1cnBsZS9zdGFydF9wdXJwbGUNCmNobW9kIDc1NSBzdGFydF9wdXJwbGUNCnN1IHByaW5jZXRvbl9wdXJwbGUgLWMgJy4vc3RhcnRfcHVycGxlJw0K', 'name': 'princeton_purple', 'encoding': 'base64'}, {'initscript_id': 6, 'script': 'IyEgL2Jpbi9zaA0KDQojIHNhdmUgb3JpZ2luYWwgUFdEDQpPTERQV0Q9JFBXRA0KDQojIGVycm9yIHJlcG9ydGluZyBmdW5jdGlvbg0KZXJyb3IoKQ0Kew0KICAgZWNobw0KICAgZWNobyAiUGxlYXNlIEUtbWFpbCBzdG9yay1zdXBwb3J0QGNzLmFyaXpvbmEuZWR1IGlmIHlvdSBiZWxpZXZlIHlvdSBoYXZlIiANCiAgIGVjaG8gInJlY2VpdmVkIHRoaXMgbWVzc2FnZSBpbiBlcnJvci4iDQoNCiAgICMgcmVzdG9yZSBvcmlnaW5hbCBQV0QNCiAgIGNkICRPTERQV0QNCiAgIGV4aXQgMQ0KfQ0KDQojIGNoZWNrIGZvciByb290IHVzZXINCmlmIFsgJFVJRCAtbmUgIjAiIF0NCnRoZW4NCiAgIGVjaG8gJ1lvdSBtdXN0IGJlIHJvb3QgdG8gcnVuIHRoaXMgcHJvZ3JhbS4uLicNCiAgIGVycm9yDQpmaSAgIA0KIA0KIyBDbGVhbiB1cCBpbiBjYXNlIEkgcmFuIHRoaXMg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) # Convert plc_initscript.initscript_id to raw initscript attribute -for slice_attribute in GetSliceAttributes({'name': 'plc_initscript'}): +for slice_attribute in GetSliceTags({'name': 'plc_initscript'}): id = slice_attribute['slice_attribute_id'] slice_id = slice_attribute['slice_id'] initscript_id = int(slice_attribute['value']) # Delete old attribute - DeleteSliceAttribute(id) + DeleteSliceTag(id) if initscript_id not in initscripts: print "Warning: Missing initscript %d" % initscript_id @@ -231,7 +231,7 @@ for slice_attribute in GetSliceAttributes({'name': 'plc_initscript'}): initscript = base64.b64decode(initscripts[initscript_id]['script']) # Add as initscript attribute - AddSliceAttribute(slice_id, 'initscript', initscript) + AddSliceTag(slice_id, 'initscript', initscript) # Add our custom yum.conf entries conf_file_id = AddConfFile({ -- 2.43.0