remove dups & old ref. to ilinks
[plcapi.git] / PLC / Accessors / Accessors_site.py
1 #
2 # Thierry Parmentelat - INRIA
3 #
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
6 #
7 # Historical note: now that Sites are taggable too, the name may be confusing, 
8 # think of this as Accessors_local.py
9 #
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
13 #   apachectl restart
14 # or to stay on the safe side, simply do
15 #   service plc restart
16 #
17 # methods denotes the set of methods (names) that get inserted into the API
18 # it is updated by define_accessors
19
20 methods=[]
21
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
27
28 from PLC.Accessors.Factory import define_accessors, all_roles, person_roles, tech_roles
29
30 import sys
31 current_module = sys.modules[__name__]
32
33 #### example : attach vlan ids on interfaces
34 #
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)
38 #
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
41 # e.g. 
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)
45 # will let you do
46 # GetNodes ( {'foo':'*bar*'},['hostname','foo'])
47 #
48