- if self.changed:
- if int(self.id) > 0:
- api.plshell.UpdateSliceTag(api.plauth, self.id, self.value)
- else:
- api.plshell.AddSliceTag(api.plauth, self.slice_id,
- self.tagname, self.value, self.node_id)
- elif self.deleted and int(self.id) > 0:
- api.plshell.DeleteSliceTag(api.plauth, self.id)
-
-
-"""
-A Network is a compound object consisting of:
-* a dictionary mapping site IDs to Site objects
-* a dictionary mapping node IDs to Node objects
-* a dictionary mapping interface IDs to Iface objects
-"""
+ if self.was_added():
+ api.driver.AddSliceTag(self.slice_id, self.tagname, self.value, self.node_id)
+ elif self.was_changed():
+ api.driver.UpdateSliceTag(self.id, self.value)
+ elif self.was_deleted():
+ api.driver.DeleteSliceTag(self.id)
+
+
+class TagType:
+ ignore_tags = ['hmac','ssh_key']
+ def __init__(self, tagtype):
+ self.id = tagtype['tag_type_id']
+ self.category = tagtype['category']
+ self.tagname = tagtype['tagname']
+ self.roles = tagtype['roles']
+ self.multi = False
+ self.in_rspec = False
+ if self.category == 'slice/rspec':
+ self.in_rspec = True
+ if self.tagname in ['codemux', 'ip_addresses', 'vsys']:
+ self.multi = True
+
+ def permit_update(self, role):
+ if role in self.roles:
+ return True
+ return False
+
+