reconcile accessors and db-config tags scripts
[plcapi.git] / PLC / Accessors / Accessors_standard.py
1 # Thierry Parmentelat - INRIA
2 # $Id$
3 # $URL$
4
5 from PLC.Nodes import Node
6 from PLC.Interfaces import Interface
7 from PLC.Slices import Slice
8 from PLC.Slices import Slice
9 from PLC.Sites import Site
10 from PLC.Persons import Person
11 #from PLC.Ilinks import Ilink
12
13 from PLC.Accessors.Factory import define_accessors, admin_roles, all_roles, tech_roles
14
15 import sys
16 current_module = sys.modules[__name__]
17
18 # NOTE.
19 # The 'Get' and 'Set' accessors defined here automagically create the corresponding TagType in the database
20 # for safety, some crucial tags are forced to be created at plc startup time, through the db-config.d mechanism
21 # You might wish to keep this roughly in sync with db-config.d/011-standard_tags
22 #
23
24
25 ### system slices - at least planetflow - still rely on 'vref'
26
27
28 # These following accessors are mostly of interest for implementing the 
29 # GetSliceFamily method, that takes into account the vref attribute, 
30 # as well as the 3 attributes below, and the PLC_FLAVOUR config category
31
32 ### slice vref 
33 define_accessors(current_module, Slice, "Vref", "vref", 
34                  "slice/config", "vserver reference image name",
35                  get_roles=all_roles, set_roles=["admin"], expose_in_api=True)
36
37 # xxx the accessor factory should enforce the category and descriptions provided here.
38 # and BTW the tag should be created right away as far as possible, or at least when a Get is issued
39 # also note that the two 'arch' instances use here will end in the same unique TagType object,
40 # so you should make sure to use the same category/description for both 
41 define_accessors(current_module, Slice, "Arch", "arch", 
42                  "node/slice/config", "node arch or slivers arch",
43                  get_roles=all_roles, set_roles=["user"], expose_in_api=True)
44 define_accessors(current_module, Slice, "Pldistro", "pldistro",
45                  "node/slice/config", "PlanetLab distribution to use for node or slivers", 
46                  get_roles=all_roles, set_roles=["admin"], expose_in_api=True)
47 define_accessors(current_module, Slice, "Fcdistro", "fcdistro",
48                  "node/slice/config", "Fedora or CentOS distribution to use for node or slivers", 
49                  get_roles=all_roles, set_roles=["admin"], expose_in_api=True)
50
51 # Ditto for the GetNodeFlavour method
52 define_accessors(current_module, Node, "Arch", "arch",  
53                  "node/slice/config", "node arch or slivers arch",
54                  get_roles=all_roles, set_roles=tech_roles, expose_in_api=True)
55 define_accessors(current_module, Node, "Pldistro", "pldistro",
56                  "node/slice/config", "PlanetLab distribution to use for node or slivers", 
57                  get_roles=all_roles, set_roles=["admin"], expose_in_api=True)
58 define_accessors(current_module, Node, "Fcdistro", "fcdistro",
59                  "node/slice/config", "Fedora or CentOS distribution to use for node or slivers", 
60                  get_roles=all_roles, set_roles=["admin"], expose_in_api=True)
61 # node deployment (alpha, beta, ...)
62 define_accessors(current_module, Node, "Deployment", "deployment",
63                  "node/operation", 'typically "alpha", "beta", or "production"',
64                  get_roles=all_roles, set_roles=["admin"], expose_in_api=True)
65 # extension
66 define_accessors(current_module, Node, "Extensions", "extensions", 
67                  "node/config", "space-separated list of extensions to install",
68                  get_roles=all_roles, set_roles=["admin"],expose_in_api=True)
69 # test nodes perform their installation from an uncompressed bootstrapfs
70 define_accessors(current_module, Node, "PlainBootstrapfs", "plain-bootstrapfs", 
71                  "node/config", "use uncompressed bootstrapfs when set",
72                  get_roles=all_roles, set_roles=tech_roles)
73
74 # the tags considered when creating a boot CD
75 define_accessors(current_module, Node, "Serial", "serial",
76                  "node/bootcd", "serial to use when creating the boot CD -- see GetBootMedium")
77 define_accessors(current_module, Node, "Cramfs", "cramfs",
78                  "node/bootcd", "boot CD to use cramfs if set -- see GetBootMedium")
79 define_accessors(current_module, Node, "Kvariant", "kvariant",
80                  "node/bootcd", "the variant to use for creating the boot CD -- see GetBootMedium")
81 define_accessors(current_module, Node, "Kargs", "kargs",
82                  "node/bootcd", "extra args to pass the kernel on the Boot CD -- see GetBootMedium")
83 define_accessors(current_module, Node, "NoHangcheck", "no-hangcheck",
84                  "node/bootcd", "disable hangcheck on the boot CD if set -- see GetBootMedium")
85
86 # interface 
87 # xxx - don't expose yet in api interface and slices dont know how to use that yet
88 define_accessors(current_module, Interface, "Ifname", "ifname", 
89                  "interface/config", "linux name",
90                  get_roles=all_roles, set_roles=tech_roles, expose_in_api=True)
91 define_accessors(current_module, Interface, "Driver", "driver", 
92                  "interface/config", "driver name",
93                  get_roles=all_roles, set_roles=tech_roles)
94 define_accessors(current_module, Interface, "Alias", "alias", 
95                  "interface/config", "interface alias",
96                  get_roles=all_roles, set_roles=tech_roles)
97 define_accessors(current_module, Interface, "Backdoor", "backdoor",
98                  "interface/hidden", "For testing new settings",
99                  get_roles=all_roles, set_roles=admin_roles)
100