1 # Thierry Parmentelat - INRIA
6 from PLC.Nodes import Node
7 from PLC.Interfaces import Interface
8 from PLC.Slices import Slice
10 from PLC.Accessors.Factory import define_accessors, all_roles, tech_roles
13 current_module = sys.modules[__name__]
15 #### example 1 : attach vlan ids on interfaces
16 # The third argument expose_in_api is a boolean flag that tells whether this tag may be handled
17 # through the Add/Get/Update methods as a native field
19 #define_accessors(current_module, Interface, "Vlan", "vlan",
20 # "interface/general", "tag for setting VLAN id",
21 # get_roles=all_roles, set_roles=tech_roles)
24 # the slice page uses the category field in the following way
25 # it considers all tag types for which 'category' matches 'node*/ui*'
26 # for these, the category field is split into pieces using /
27 # the parts may define the following settings:
28 # header: to use instead of the full tagname (in which case a footnote appears with the 'description')
29 # type: exported as the type for the javascript table (used for how-to-sort)
30 # rank: to be used for sorting columns (defaults to tagname)
32 #################### MySlice tags
33 define_accessors(current_module, Node, "Reliability", "reliability",
35 "node/monitor/ui/header=R/type=int/rank=ad",
36 # description : used to add a footnote to the table if header is set in category
37 "average reliability (% uptime) over the last week",
38 set_roles=tech_roles, expose_in_api=True)
40 define_accessors(current_module, Node, "Load", "load",
41 "node/monitor/ui/header=l/type=sortAlphaNumericBottom",
42 "average load (% CPU utilization) over the last week",
43 set_roles=tech_roles, expose_in_api=True)
45 define_accessors(current_module, Node, "ASNumber", "asnumber",
46 "node/location/ui/header=AS/type=sortAlphaNumericBottom/rank=z",
47 "Autonomous System id",
48 set_roles=tech_roles, expose_in_api=True)