1 from PLC.Faults import *
2 from PLC.Method import Method
3 from PLC.Parameter import Parameter, Mixed
4 from PLC.SliceAttributeTypes import SliceAttributeType, SliceAttributeTypes
5 from PLC.Auth import PasswordAuth
7 can_update = lambda (field, value): field in \
8 ['description', 'min_role_id']
10 class AddSliceAttributeType(Method):
12 Adds a new type of slice attribute. Any fields specified in
13 attribute_type_fields are used, otherwise defaults are used.
15 Returns the new attribute_type_id (> 0) if successful, faults
21 update_fields = dict(filter(can_update, SliceAttributeType.fields.items()))
25 SliceAttributeType.fields['name'],
29 returns = Parameter(int, 'New attribute_id (> 0) if successful')
31 def call(self, auth, name, attribute_type_fields = {}):
32 attribute_type_fields = dict(filter(can_update, attribute_type_fields.items()))
33 attribute_type = SliceAttributeType(self.api, attribute_type_fields)
34 attribute_type['name'] = name
37 return attribute_type['attribute_type_id']