2 # NEPI, a framework to manage network experiments
3 # Copyright (C) 2013 INRIA
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.
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.
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/>.
18 # Author: Alina Quereilhac <alina.quereilhac@inria.fr>
19 # Julien Tribino <julien.tribino@inria.fr>
21 from nepi.execution.resource import ResourceManager, clsinit
22 from nepi.execution.attribute import Attribute
24 from nepi.resources.omf.omf_api import OMFAPIFactory
27 class OMFResource(ResourceManager):
28 _rtype = "OMFResource"
31 def _register_attributes(cls):
32 xmppSlice = Attribute("xmppSlice","Name of the slice", flags = "0x02")
33 xmppHost = Attribute("xmppHost", "Xmpp Server",flags = "0x02")
34 xmppPort = Attribute("xmppPort", "Xmpp Port",flags = "0x02")
35 xmppPassword = Attribute("xmppPassword", "Xmpp Port",flags = "0x02")
36 cls._register_attribute(xmppSlice)
37 cls._register_attribute(xmppHost)
38 cls._register_attribute(xmppPort)
39 cls._register_attribute(xmppPassword)
41 def __init__(self, ec, guid, creds):
42 super(OMFNode, self).__init__(ec, guid)
43 self.set('xmppSlice', creds['xmppSlice'])
44 self.set('xmppHost', creds['xmppHost'])
45 self.set('xmppPort', creds['xmppPort'])
46 self.set('xmppPassword', creds['xmppPassword'])
48 self._omf_api = OMFAPIFactory.get_api(self.get('xmppSlice'), self.get('xmppHost'), self.get('xmppPort'), self.get('xmppPassword'))
53 def provision(self, credential):