2 # Thierry Parmentelat - INRIA
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
12 from PLC.Accessors.Factory import define_accessors, admin_roles, all_roles, tech_roles
15 current_module = sys.modules[__name__]
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 # You might wish to keep this roughly in sync with db-config.d/011-standard_tags
24 ### system slices - at least planetflow - still rely on 'vref'
27 # These following accessors are mostly of interest for implementing the
28 # GetSliceFamily method, that takes into account the vref attribute,
29 # as well as the 3 attributes below, and the PLC_FLAVOUR config category
32 define_accessors(current_module, Slice, "Vref", "vref",
33 "slice/config", "vserver reference image name",
34 get_roles=all_roles, set_roles=["admin"], expose_in_api=True)
36 # xxx the accessor factory should enforce the category and descriptions provided here.
37 # and BTW the tag should be created right away as far as possible, or at least when a Get is issued
38 # also note that the two 'arch' instances use here will end in the same unique TagType object,
39 # so you should make sure to use the same category/description for both
40 define_accessors(current_module, Slice, "Arch", "arch",
41 "node/slice/config", "node arch or slivers arch",
42 get_roles=all_roles, set_roles=["user"], expose_in_api=True)
43 define_accessors(current_module, Slice, "Pldistro", "pldistro",
44 "node/slice/config", "PlanetLab distribution to use for node or slivers",
45 get_roles=all_roles, set_roles=["admin"], expose_in_api=True)
46 define_accessors(current_module, Slice, "Fcdistro", "fcdistro",
47 "node/slice/config", "Fedora or CentOS distribution to use for node or slivers",
48 get_roles=all_roles, set_roles=["admin"], expose_in_api=True)
50 # Ditto for the GetNodeFlavour method
51 define_accessors(current_module, Node, "Arch", "arch",
52 "node/slice/config", "node arch or slivers arch",
53 get_roles=all_roles, set_roles=tech_roles, expose_in_api=True)
54 define_accessors(current_module, Node, "Pldistro", "pldistro",
55 "node/slice/config", "PlanetLab distribution to use for node or slivers",
56 get_roles=all_roles, set_roles=["admin"], expose_in_api=True)
57 define_accessors(current_module, Node, "Fcdistro", "fcdistro",
58 "node/slice/config", "Fedora or CentOS distribution to use for node or slivers",
59 get_roles=all_roles, set_roles=["admin"], expose_in_api=True)
60 # node deployment (alpha, beta, ...)
61 define_accessors(current_module, Node, "Deployment", "deployment",
62 "node/operation", 'typically "alpha", "beta", or "production"',
63 get_roles=all_roles, set_roles=["admin"], expose_in_api=True)
65 define_accessors(current_module, Node, "Extensions", "extensions",
66 "node/config", "space-separated list of extensions to install",
67 get_roles=all_roles, set_roles=["admin"],expose_in_api=True)
68 # access HRN - this is the ideal definition of roles, even if AddNodeTag cannot handle this
69 define_accessors(current_module, Node, "Hrn","hrn",
70 "node/sfa", "SFA human readable name",
71 get_roles=all_roles, set_roles=["admin","pi","tech"], expose_in_api=True)
73 # test nodes perform their installation from an uncompressed bootstrapfs
74 define_accessors(current_module, Node, "PlainBootstrapfs", "plain-bootstrapfs",
75 "node/config", "use uncompressed bootstrapfs when set",
76 get_roles=all_roles, set_roles=tech_roles)
78 # the tags considered when creating a boot CD
79 define_accessors(current_module, Node, "Serial", "serial",
80 "node/bootcd", "serial to use when creating the boot CD -- see GetBootMedium")
81 define_accessors(current_module, Node, "Cramfs", "cramfs",
82 "node/bootcd", "boot CD to use cramfs if set -- see GetBootMedium")
83 define_accessors(current_module, Node, "Kvariant", "kvariant",
84 "node/bootcd", "the variant to use for creating the boot CD -- see GetBootMedium")
85 define_accessors(current_module, Node, "Kargs", "kargs",
86 "node/bootcd", "extra args to pass the kernel on the Boot CD -- see GetBootMedium")
87 define_accessors(current_module, Node, "NoHangcheck", "no-hangcheck",
88 "node/bootcd", "disable hangcheck on the boot CD if set -- see GetBootMedium")
91 # xxx - don't expose yet in api interface and slices dont know how to use that yet
92 define_accessors(current_module, Interface, "Ifname", "ifname",
93 "interface/config", "linux name",
94 get_roles=all_roles, set_roles=tech_roles, expose_in_api=True)
95 define_accessors(current_module, Interface, "Driver", "driver",
96 "interface/config", "driver name",
97 get_roles=all_roles, set_roles=tech_roles)
98 define_accessors(current_module, Interface, "Alias", "alias",
99 "interface/config", "interface alias",
100 get_roles=all_roles, set_roles=tech_roles)
101 define_accessors(current_module, Interface, "Backdoor", "backdoor",
102 "interface/hidden", "For testing new settings",
103 get_roles=all_roles, set_roles=admin_roles)