Replacing _backend for _platform class attribute in ResourceManager
[nepi.git] / src / nepi / resources / omf / omf_resource.py
1 #
2 #    NEPI, a framework to manage network experiments
3 #    Copyright (C) 2013 INRIA
4 #
5 #    This program is free software: you can redistribute it and/or modify
6 #    it under the terms of the GNU General Public License as published by
7 #    the Free Software Foundation, either version 3 of the License, or
8 #    (at your option) any later version.
9 #
10 #    This program is distributed in the hope that it will be useful,
11 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 #    GNU General Public License for more details.
14 #
15 #    You should have received a copy of the GNU General Public License
16 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 #
18 # Author: Julien Tribino <julien.tribino@inria.fr>
19 #         Lucia Guevgeozian <lucia.guevgeozian_odizzio@inria.fr>
20
21 from nepi.execution.attribute import Attribute, Flags, Types
22 from nepi.execution.resource import ResourceManager, clsinit_copy, \
23         ResourceState
24
25
26 class ResourceGateway:
27     """
28     Dictionary used to set OMF gateway depending on Testbed information.
29     """
30     #XXX: A.Q. COMMENT: This looks a bit hardcoded
31     #       SHOULDN'T THIS BE IN A SEPARATED FILE RATHER THAN IN THE 
32     #       BASE CLASS FOR ALL OMF RESOURCES?
33     TestbedtoGateway = dict({
34         "wilabt" : "ops.wilab2.ilabt.iminds.be",
35         "nitos" : "nitlab.inf.uth.gr",
36         "nicta" : "??.??.??",
37     })
38
39     AMtoGateway = dict({
40         "am.wilab2.ilabt.iminds.be" : "ops.wilab2.ilabt.iminds.be",
41         "nitlab.inf.uth.gr" : "nitlab.inf.uth.gr",
42         "nicta" : "??.??.??",
43     })
44
45 @clsinit_copy
46 class OMFResource(ResourceManager):
47     """
48     Generic resource gathering XMPP credential information and common methods
49     for OMF nodes, channels, applications, etc.
50     """
51     _rtype = "abstract::omf::Resource"
52     _platform = "omf"
53
54     @classmethod
55     def _register_attributes(cls):
56
57         xmppServer = Attribute("xmppServer", "Xmpp Server",
58             flags = Flags.Credential)
59         xmppUser = Attribute("xmppUser","Name of the Xmpp User/Slice", 
60             flags = Flags.Credential)
61         xmppPort = Attribute("xmppPort", "Xmpp Port",
62             flags = Flags.Credential)
63         xmppPassword = Attribute("xmppPassword", "Xmpp Password",
64                 flags = Flags.Credential)
65         version = Attribute("version", "Version of OMF : Either 5 or 6",
66                 default = "6", )
67
68         cls._register_attribute(xmppUser)
69         cls._register_attribute(xmppServer)
70         cls._register_attribute(xmppPort)
71         cls._register_attribute(xmppPassword)
72         cls._register_attribute(version)
73
74     def __init__(self, ec, guid):
75         super(OMFResource, self).__init__(ec, guid)
76         pass
77