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