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