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
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
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)
34 # BootManager might need to set any of these 3, so 'node' needs to be in set_roles
35 # needs 'pi' and 'tech' for managing their node
36 # needs 'user' for managing their slices
37 # needs 'admin' so the Set method is accessible
38 define_accessors(current_module, [Slice,Node], "Arch", "arch",
39 "node/slice/config", "node arch or slivers arch",
40 set_roles=["admin","pi","user","tech","node"], expose_in_api=True)
41 define_accessors(current_module, [Slice,Node], "Pldistro", "pldistro",
42 "node/slice/config", "PlanetLab distribution to use for node or slivers",
43 set_roles=["admin","pi","user","tech","node"], expose_in_api=True)
44 define_accessors(current_module, [Slice,Node], "Fcdistro", "fcdistro",
45 "node/slice/config", "Fedora or CentOS distribution to use for node or slivers",
46 set_roles=["admin","pi","user","tech","node"], expose_in_api=True)
48 # node deployment (alpha, beta, ...)
49 define_accessors(current_module, Node, "Deployment", "deployment",
50 "node/operation", 'typically "alpha", "beta", or "production"',
51 set_roles=["admin"], expose_in_api=True)
52 # extensions - leave this to admin only until the semantics is made more clear
53 define_accessors(current_module, Node, "Extensions", "extensions",
54 "node/config", "space-separated list of extensions to install",
55 set_roles=["admin"],expose_in_api=True)
56 # access HRN - this is the ideal definition of roles, even if AddNodeTag cannot handle this
57 define_accessors(current_module, Node, "Hrn","hrn",
58 "node/sfa", "SFA human readable name",
59 set_roles=all_roles, expose_in_api=True)
61 # test nodes perform their installation from an uncompressed bootstrapfs
62 define_accessors(current_module, Node, "PlainBootstrapfs", "plain-bootstrapfs",
63 "node/config", "use uncompressed bootstrapfs when set",
66 # the tags considered when creating a boot CD
67 define_accessors(current_module, Node, "Serial", "serial",
68 "node/bootcd", "serial to use when creating the boot CD -- see GetBootMedium",
70 define_accessors(current_module, Node, "Cramfs", "cramfs",
71 "node/bootcd", "boot CD to use cramfs if set -- see GetBootMedium",
73 define_accessors(current_module, Node, "Kvariant", "kvariant",
74 "node/bootcd", "the variant to use for creating the boot CD -- see GetBootMedium",
76 define_accessors(current_module, Node, "Kargs", "kargs",
77 "node/bootcd", "extra args to pass the kernel on the Boot CD -- see GetBootMedium",
79 define_accessors(current_module, Node, "NoHangcheck", "no-hangcheck",
80 "node/bootcd", "disable hangcheck on the boot CD if set -- see GetBootMedium",
84 # xxx - don't expose yet in api interface and slices dont know how to use that yet
85 define_accessors(current_module, Interface, "Ifname", "ifname",
86 "interface/config", "linux name",
87 set_roles=tech_roles, expose_in_api=True)
88 define_accessors(current_module, Interface, "Driver", "driver",
89 "interface/config", "driver name",
91 define_accessors(current_module, Interface, "Alias", "alias",
92 "interface/config", "interface alias",
94 define_accessors(current_module, Interface, "Backdoor", "backdoor",
95 "interface/hidden", "For testing new settings",
96 set_roles=admin_roles)