From: Thierry Parmentelat Date: Mon, 17 Dec 2012 10:02:44 +0000 (+0100) Subject: first rough implementation of PLC_VSYS_DEFAULTS at slice-creation time X-Git-Tag: plcapi-5.1-6~2 X-Git-Url: http://git.onelab.eu/?p=plcapi.git;a=commitdiff_plain;h=5706f426635a8416101d2efdff228a20b34fb841 first rough implementation of PLC_VSYS_DEFAULTS at slice-creation time --- diff --git a/PLC/Methods/AddSlice.py b/PLC/Methods/AddSlice.py index 0274e01..01e75da 100644 --- a/PLC/Methods/AddSlice.py +++ b/PLC/Methods/AddSlice.py @@ -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']