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 # Historical note: now that Sites are taggable too, the name may be confusing,
8 # think of this as Accessors_local.py
10 # to ensure creation of new tag_types, just run
11 # service plc start accessors
12 # also for the running API to take the new accessors into account, you need to
14 # or to stay on the safe side, simply do
17 # methods denotes the set of methods (names) that get inserted into the API
18 # it is updated by define_accessors
22 from PLC.Nodes import Node
23 from PLC.Interfaces import Interface
24 from PLC.Slices import Slice
25 from PLC.Sites import Site
26 from PLC.Persons import Person
28 from PLC.Accessors.Factory import define_accessors, all_roles, person_roles, tech_roles
31 current_module = sys.modules[__name__]
33 #### example : attach vlan ids on interfaces
35 #define_accessors(current_module, Interface, "Vlan", "vlan",
36 # "interface/general", "tag for setting VLAN id",
37 # get_roles=all_roles, set_roles=tech_roles)
39 # The optional expose_in_api is a boolean flag that tells whether this tag may be handled
40 # through the Add/Get/Update methods as a native field
42 #define_accessors(current_module, Node, "Foo", "foo",
43 # "node/example", "my own description for foo",
44 # get_roles=all_roles, set_roles=all_roles)
46 # GetNodes ( {'foo':'*bar*'},['hostname','foo'])