X-Git-Url: http://git.onelab.eu/?p=monitor.git;a=blobdiff_plain;f=monitor%2Fwrapper%2Fplc.py;h=97200d9a244ec4cc00b5d8fe23f94a187d761935;hp=8113c57579dabe9a8cc4593625194fbc679fc3b9;hb=1021f78d261f1dace74d5af1b464ccc02fbf4182;hpb=e93f289e0f2cef776969f10e0ad45af7723d3d2e diff --git a/monitor/wrapper/plc.py b/monitor/wrapper/plc.py index 8113c57..97200d9 100644 --- a/monitor/wrapper/plc.py +++ b/monitor/wrapper/plc.py @@ -436,6 +436,35 @@ def enableSliceCreation(nodename): loginbase = siteId(nodename) enableSiteSliceCreation(loginbase) +def areSlicesEnabled(site): + + try: + slice_list = api.GetSlices(slices(site)) + if len(slice_list) == 0: + return None + for slice in slice_list: + slice_id = slice['slice_id'] + l_attr = api.GetSliceAttributes({'slice_id': slice_id}) + for attr in l_attr: + if "enabled" == attr['name'] and attr['value'] == "0": + return False + + except Exception, exc: + pass + + return True + + +def isSiteEnabled(site): + try: + site = api.GetSites(site)[0] + return site['enabled'] + except: + pass + + return True + + def isTagCurrent(tags): if len(tags) > 0: for tag in tags: