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