Modified FailureManager to abort only when critical resources fail
[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, reschedule_delay
24
25 class ResourceGateway:
26     """
27     Dictionary used to set OMF gateway depending on Testbed information.
28     """
29     TestbedtoGateway = dict({
30         "wilabt" : "ops.wilab2.ilabt.iminds.be",
31         "nitos" : "nitlab.inf.uth.gr",
32         "nicta" : "??.??.??",
33     })
34
35     AMtoGateway = dict({
36         "am.wilab2.ilabt.iminds.be" : "ops.wilab2.ilabt.iminds.be",
37         "nitlab.inf.uth.gr" : "nitlab.inf.uth.gr",
38         "nicta" : "??.??.??",
39     })
40
41 @clsinit_copy
42 class OMFResource(ResourceManager):
43     """
44     Generic resource gathering XMPP credential information and common methods
45     for OMF nodes, channels, applications, etc.
46     """
47     _rtype = "OMFResource"
48
49     @classmethod
50     def _register_attributes(cls):
51
52         xmppSlice = Attribute("xmppSlice","Name of the slice", 
53             flags = Flags.Credential)
54         xmppHost = Attribute("xmppHost", "Xmpp Server",
55             flags = Flags.Credential)
56         xmppPort = Attribute("xmppPort", "Xmpp Port",
57             flags = Flags.Credential)
58         xmppPassword = Attribute("xmppPassword", "Xmpp Password",
59                 flags = Flags.Credential)
60
61         cls._register_attribute(xmppSlice)
62         cls._register_attribute(xmppHost)
63         cls._register_attribute(xmppPort)
64         cls._register_attribute(xmppPassword)
65
66     def __init__(self, ec, guid):
67         super(OMFResource, self).__init__(ec, guid)
68         pass
69