first rough implementation of PLC_VSYS_DEFAULTS at slice-creation time
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Mon, 17 Dec 2012 10:02:44 +0000 (11:02 +0100)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Mon, 17 Dec 2012 10:02:44 +0000 (11:02 +0100)
PLC/Methods/AddSlice.py

index 0274e01..01e75da 100644 (file)
@@ -100,6 +100,13 @@ class AddSlice(Method):
             else:
                 UpdateSliceTag(self.api).__call__(auth,slice_tags[0]['slice_tag_id'],value)
 
+        # take PLC_VSYS_DEFAULTS into account for convenience
+        try:
+            values= [ value for value in api.config.PLC_VSYS_DEFAULTS.split(',') if value ]
+            for value in values:
+                AddSliceTag(self.api).__call__(auth,slice['slice_id'],'vsys',value)
+        except:
+            print "Could not set vsys tags as configured in PLC_VSYS_DEFAULTS"
         self.event_objects = {'Slice': [slice['slice_id']]}
         self.message = "Slice %d created" % slice['slice_id']