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 # xxx the accessor factory should enforce the category, descriptions and roles provided here.
35 # BootManager might need to set any of these 3, so 'node' needs to be in set_roles
36 define_accessors(current_module, Slice, "Arch", "arch",
37 "node/slice/config", "node arch or slivers arch",
38 set_roles=["pi","user","tech","node"], expose_in_api=True)
39 define_accessors(current_module, Slice, "Pldistro", "pldistro",
40 "node/slice/config", "PlanetLab distribution to use for node or slivers",
41 set_roles=["pi","user","tech","node"], expose_in_api=True)
42 define_accessors(current_module, Slice, "Fcdistro", "fcdistro",
43 "node/slice/config", "Fedora or CentOS distribution to use for node or slivers",
44 set_roles=["pi","user","tech","node"], expose_in_api=True)
46 # Ditto for the GetNodeFlavour method
47 define_accessors(current_module, Node, "Arch", "arch",
48 "node/slice/config", "node arch or slivers arch",
49 set_roles=["pi","user","tech"], expose_in_api=True)
50 define_accessors(current_module, Node, "Pldistro", "pldistro",
51 "node/slice/config", "PlanetLab distribution to use for node or slivers",
52 set_roles=["pi","user","tech"], expose_in_api=True)
53 define_accessors(current_module, Node, "Fcdistro", "fcdistro",
54 "node/slice/config", "Fedora or CentOS distribution to use for node or slivers",
55 set_roles=["pi","user","tech"], expose_in_api=True)
56 # node deployment (alpha, beta, ...)
57 define_accessors(current_module, Node, "Deployment", "deployment",
58 "node/operation", 'typically "alpha", "beta", or "production"',
59 set_roles=["admin"], expose_in_api=True)
60 # extensions - leave this to admin only until the semantics is made more clear
61 define_accessors(current_module, Node, "Extensions", "extensions",
62 "node/config", "space-separated list of extensions to install",
63 set_roles=["admin"],expose_in_api=True)
64 # access HRN - this is the ideal definition of roles, even if AddNodeTag cannot handle this
65 define_accessors(current_module, Node, "Hrn","hrn",
66 "node/sfa", "SFA human readable name",
67 set_roles=all_roles, 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",
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",
78 define_accessors(current_module, Node, "Cramfs", "cramfs",
79 "node/bootcd", "boot CD to use cramfs if set -- see GetBootMedium",
81 define_accessors(current_module, Node, "Kvariant", "kvariant",
82 "node/bootcd", "the variant to use for creating the boot CD -- see GetBootMedium",
84 define_accessors(current_module, Node, "Kargs", "kargs",
85 "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",
92 # xxx - don't expose yet in api interface and slices dont know how to use that yet
93 define_accessors(current_module, Interface, "Ifname", "ifname",
94 "interface/config", "linux name",
95 set_roles=tech_roles, expose_in_api=True)
96 define_accessors(current_module, Interface, "Driver", "driver",
97 "interface/config", "driver name",
99 define_accessors(current_module, Interface, "Alias", "alias",
100 "interface/config", "interface alias",
101 set_roles=tech_roles)
102 define_accessors(current_module, Interface, "Backdoor", "backdoor",
103 "interface/hidden", "For testing new settings",
104 set_roles=admin_roles)