X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FAccessors%2FAccessors_standard.py;h=50690f45be87d5c82584062480a356f91cfca595;hb=b48e3b66786c1c1e97e4dbe5bb1659e3836bfd5f;hp=db7858ffef33d0c212f5d60f33a748403f1d59cf;hpb=d8589a93a65141d26ddb04662f7393987c1b39a5;p=plcapi.git diff --git a/PLC/Accessors/Accessors_standard.py b/PLC/Accessors/Accessors_standard.py index db7858f..50690f4 100644 --- a/PLC/Accessors/Accessors_standard.py +++ b/PLC/Accessors/Accessors_standard.py @@ -1,57 +1,106 @@ +# # Thierry Parmentelat - INRIA -# $Id$ - +# from PLC.Nodes import Node from PLC.Interfaces import Interface from PLC.Slices import Slice -#from PLC.Ilinks import Ilink +from PLC.Sites import Site +from PLC.Persons import Person -from PLC.Accessors.Factory import define_accessors, all_roles, tech_roles +from PLC.Accessors.Factory import define_accessors, admin_roles, all_roles, tech_roles import sys current_module = sys.modules[__name__] # NOTE. -# most of these tag types are defined in MyPLC/db-config, so any details here in the -# description/category area is unlikely to make it into the database +# The 'Get' and 'Set' accessors defined here automagically create the corresponding TagType in the database +# for safety, some crucial tags are forced to be created at plc startup time, through the db-config.d mechanism # -# slice vref -# xxx - don't expose yet in api interface and slices dont know how to use that yet -define_accessors(current_module, Slice, "Vref", "vref", - "slice/config", "vserver reference image type", - get_roles=all_roles, set_roles=["admin"], expose_in_api=True) - - -# node architecture -define_accessors(current_module, Node, "Arch", "arch", - "node/config", "architecture name", - get_roles=all_roles, set_roles=tech_roles, expose_in_api=True) -# distribution to be deployed -define_accessors(current_module, Node, "Pldistro", "pldistro", - "node/config", "PlanetLab distribution", - get_roles=all_roles, set_roles=["admin"], expose_in_api=True) +# These following accessors are mostly of interest for implementing the +# GetSliceFamily method, that takes into account the vref attribute, +# as well as the 3 attributes below, and the PLC_FLAVOUR config category + +### slice vref +define_accessors(current_module, Slice, "Vref", "vref", + "slice/config", "vserver reference image name", + set_roles=["admin","pi","user","node"], expose_in_api=True) +# this contains the actual script text +# if set, it supersedes 'initscript' +define_accessors(current_module, Slice, "InitscriptCode","initscript_code", + "slice/usertools", "Slice initialization script code", + set_roles=["admin","pi","user"], expose_in_api=True) +# this may contain a *name* that refers to the GetInitScripts +# it was initially designed to share scripts among slices +define_accessors(current_module, Slice, "Initscript","initscript", + "slice/usertools", "Slice initialization script name", + set_roles=["admin","pi","user"], expose_in_api=True) + +# BootManager might need to set any of these 3, so 'node' needs to be in set_roles +# needs 'pi' and 'tech' for managing their node +# needs 'user' for managing their slices +# needs 'admin' so the Set method is accessible +define_accessors(current_module, [Slice,Node], "Arch", "arch", + "node/slice/config", "node arch or slivers arch", + set_roles=["admin","pi","user","tech","node"], expose_in_api=True) +define_accessors(current_module, [Slice,Node], "Pldistro", "pldistro", + "node/slice/config/sfa", "PlanetLab distribution to use for node or slivers", + set_roles=["admin","pi","user","tech","node"], expose_in_api=True) +# fc of course historically was for fedora core +define_accessors(current_module, [Slice,Node], "Fcdistro", "fcdistro", + "node/slice/config", "Linux distribution to use for node or slivers", + set_roles=["admin","pi","user","tech","node"], expose_in_api=True) + # node deployment (alpha, beta, ...) define_accessors(current_module, Node, "Deployment", "deployment", "node/operation", 'typically "alpha", "beta", or "production"', - get_roles=all_roles, set_roles=["admin"], expose_in_api=True) -# extension -define_accessors(current_module, Node, "Extensions", "extensions", + set_roles=["admin"], expose_in_api=True) +# extensions - leave this to admin only until the semantics is made more clear +define_accessors(current_module, Node, "Extensions", "extensions", "node/config", "space-separated list of extensions to install", - get_roles=all_roles, set_roles=["admin"]) + set_roles=["admin"],expose_in_api=True) +# access HRN - this is the ideal definition of roles, even if AddNodeTag cannot handle this +define_accessors(current_module, Node, "Hrn","hrn", + "node/person/sfa", "SFA human readable name", + set_roles=all_roles, expose_in_api=True) +# same for persons +define_accessors(current_module, Person, "Hrn","hrn", + "node/person/sfa", "SFA human readable name", + set_roles=all_roles, expose_in_api=True) + # test nodes perform their installation from an uncompressed bootstrapfs -define_accessors(current_module, Node, "PlainBootstrapfs", "plain-bootstrapfs", +define_accessors(current_module, Node, "PlainBootstrapfs", "plain-bootstrapfs", "node/config", "use uncompressed bootstrapfs when set", - get_roles=all_roles, set_roles=tech_roles) + set_roles=tech_roles) + +# the tags considered when creating a boot CD +define_accessors(current_module, Node, "Serial", "serial", + "node/bootcd", "serial to use when creating the boot CD -- see GetBootMedium", + set_roles=tech_roles) +define_accessors(current_module, Node, "Cramfs", "cramfs", + "node/bootcd", "boot CD to use cramfs if set -- see GetBootMedium", + set_roles=tech_roles) +define_accessors(current_module, Node, "Kvariant", "kvariant", + "node/bootcd", "the variant to use for creating the boot CD -- see GetBootMedium", + set_roles=tech_roles) +define_accessors(current_module, Node, "Kargs", "kargs", + "node/bootcd", "extra args to pass the kernel on the Boot CD -- see GetBootMedium", + set_roles=tech_roles) +define_accessors(current_module, Node, "NoHangcheck", "no-hangcheck", + "node/bootcd", "disable hangcheck on the boot CD if set -- see GetBootMedium", + set_roles=tech_roles) -# interface +# interface # xxx - don't expose yet in api interface and slices dont know how to use that yet -define_accessors(current_module, Interface, "Ifname", "ifname", +define_accessors(current_module, Interface, "Ifname", "ifname", "interface/config", "linux name", - get_roles=all_roles, set_roles=tech_roles, expose_in_api=True) -define_accessors(current_module, Interface, "Driver", "driver", + set_roles=tech_roles, expose_in_api=True) +define_accessors(current_module, Interface, "Driver", "driver", "interface/config", "driver name", - get_roles=all_roles, set_roles=tech_roles) -define_accessors(current_module, Interface, "Alias", "alias", + set_roles=tech_roles) +define_accessors(current_module, Interface, "Alias", "alias", "interface/config", "interface alias", - get_roles=all_roles, set_roles=tech_roles) + set_roles=tech_roles) +define_accessors(current_module, Interface, "Backdoor", "backdoor", + "interface/hidden", "For testing new settings", + set_roles=admin_roles)