2 # Thierry Parmentelat - INRIA
4 # Accessors_site.py is the place where you can define your own local tag accessors
5 # this will not be overwritten through rpm upgrades
7 # to ensure creation of new tag_types, just run
8 # service plc start accessors
9 # also for the running service to take the new accessors into account, you need to
11 # or to stay on the safe side, simply do
14 # please note however that if a tag_type already exists in the DB, then
15 # changing the corresponding accessors creation code WILL NOT alter the
16 # tag_type in the DB; that applies to roles and other desc. or categ.
17 # you will thus need to apply them manually
19 # Now that Sites are taggable too, the name may be confusing, think of is as
22 # methods denotes the set of methods (names) that get inserted into the API
23 # it is updated by define_accessors
27 from PLC.Nodes import Node
28 from PLC.Interfaces import Interface
29 from PLC.Slices import Slice
30 from PLC.Sites import Site
31 from PLC.Persons import Person
32 #from PLC.Ilinks import Ilink
34 from PLC.Accessors.Factory import define_accessors, all_roles, person_roles, tech_roles
37 current_module = sys.modules[__name__]
39 #### example : attach vlan ids on interfaces
40 # The third argument expose_in_api is a boolean flag that tells whether this tag may be handled
41 # through the Add/Get/Update methods as a native field
43 #define_accessors(current_module, Interface, "Vlan", "vlan",
44 # "interface/general", "tag for setting VLAN id",
45 # get_roles=all_roles, set_roles=tech_roles)