# $Id$
+# $URL$
from PLC.Faults import *
from PLC.Method import Method
from PLC.Parameter import Parameter, Mixed
from PLC.Methods.AddInterfaceTag import AddInterfaceTag
from PLC.Methods.UpdateInterfaceTag import UpdateInterfaceTag
-can_update = ['interface_id','node_id']
+cannot_update = ['interface_id','node_id']
class UpdateInterface(Method):
"""
roles = ['admin', 'pi', 'tech']
- accepted_fields = Row.accepted_fields(can_update, [Interface.fields,Interface.tags])
+ accepted_fields = Row.accepted_fields(cannot_update, Interface.fields,exclude=True)
+ accepted_fields.update(Interface.tags)
accepts = [
Auth(),
[native,tags,rejected] = Row.split_fields(interface_fields,[Interface.fields,Interface.tags])
+ # type checking
+ native= Row.check_fields (native, self.accepted_fields)
if rejected:
raise PLCInvalidArgument, "Cannot update Interface column(s) %r"%rejected
UpdateInterfaceTag(self.api).__call__(auth,interface_tags[0]['interface_tag_id'],value)
self.event_objects = {'Interface': [interface['interface_id']]}
- self.message = "Interface %d updated: %s " % \
- (interface['interface_id'], ", ".join(interface_fields.keys()))
+ if 'ip' in interface:
+ self.message = "Interface %s updated"%interface['ip']
+ else:
+ self.message = "Interface %d updated"%interface['interface_id']
+ self.message += "[%s]." % ", ".join(interface_fields.keys())
return 1