1 # Thierry Parmentelat - INRIA
5 from PLC.Nodes import Node
6 from PLC.Interfaces import Interface
7 from PLC.Slices import Slice
8 #from PLC.Ilinks import Ilink
10 from PLC.Accessors.Factory import define_accessors, all_roles, tech_roles
13 current_module = sys.modules[__name__]
16 # most of these tag types are defined in MyPLC/db-config, so any details here in the
17 # description/category area is unlikely to make it into the database
21 ### system slices - at least planetflow - still rely on 'vref'
24 # These following accessors are mostly of interest for implementing the
25 # GetSliceFamily method, that takes into account the vref attribute,
26 # as well as the 3 attributes below, and the PLC_FLAVOUR config category
29 define_accessors(current_module, Slice, "Vref", "vref",
30 "slice/config", "vserver reference image name",
31 get_roles=all_roles, set_roles=["admin"], expose_in_api=True)
33 # xxx the accessor factory should enforce the category and descriptions provided here.
34 # and BTW the tag should be created right away as far as possible, or at least when a Get is issued
35 # also note that the two 'arch' instances use here will end in the same unique TagType object,
36 # so you should make sure to use the same category/description for both
37 define_accessors(current_module, Slice, "Arch", "arch",
38 "node/slice/config", "node arch or slivers arch",
39 get_roles=all_roles, set_roles=["user"], expose_in_api=True)
40 define_accessors(current_module, Slice, "Pldistro", "pldistro",
41 "node/slice/config", "PlanetLab distribution to use for node or slivers",
42 get_roles=all_roles, set_roles=["admin"], expose_in_api=True)
43 define_accessors(current_module, Slice, "Fcdistro", "fcdistro",
44 "node/slice/config", "Fedora or CentOS distribution to use for node or slivers",
45 get_roles=all_roles, set_roles=["admin"], expose_in_api=True)
48 define_accessors(current_module, Node, "Arch", "arch",
49 "node/slice/config", "node arch or slivers arch",
50 get_roles=all_roles, set_roles=tech_roles, expose_in_api=True)
51 # distribution to be deployed
52 define_accessors(current_module, Node, "Pldistro", "pldistro",
53 "node/slice/config", "PlanetLab distribution to use for node or slivers",
54 get_roles=all_roles, set_roles=["admin"], expose_in_api=True)
55 # node deployment (alpha, beta, ...)
56 define_accessors(current_module, Node, "Deployment", "deployment",
57 "node/operation", 'typically "alpha", "beta", or "production"',
58 get_roles=all_roles, set_roles=["admin"], expose_in_api=True)
60 define_accessors(current_module, Node, "Extensions", "extensions",
61 "node/config", "space-separated list of extensions to install",
62 get_roles=all_roles, set_roles=["admin"],expose_in_api=True)
63 # test nodes perform their installation from an uncompressed bootstrapfs
64 define_accessors(current_module, Node, "PlainBootstrapfs", "plain-bootstrapfs",
65 "node/config", "use uncompressed bootstrapfs when set",
66 get_roles=all_roles, set_roles=tech_roles)
68 # the tags considered when creating a boot CD
69 define_accessors(current_module, Node, "Serial", "serial",
70 "node/bootcd", "serial to use when creating the boot CD -- see GetBootMedium")
71 define_accessors(current_module, Node, "Cramfs", "cramfs",
72 "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")
75 define_accessors(current_module, Node, "Kargs", "kargs",
76 "node/bootcd", "extra args to pass the kernel on the Boot CD -- see GetBootMedium")
77 define_accessors(current_module, Node, "NoHangcheck", "no-hangcheck",
78 "node/bootcd", "disable hangcheck on the boot CD if set -- see GetBootMedium")
81 # xxx - don't expose yet in api interface and slices dont know how to use that yet
82 define_accessors(current_module, Interface, "Ifname", "ifname",
83 "interface/config", "linux name",
84 get_roles=all_roles, set_roles=tech_roles, expose_in_api=True)
85 define_accessors(current_module, Interface, "Driver", "driver",
86 "interface/config", "driver name",
87 get_roles=all_roles, set_roles=tech_roles)
88 define_accessors(current_module, Interface, "Alias", "alias",
89 "interface/config", "interface alias",
90 get_roles=all_roles, set_roles=tech_roles)