Added LICENSE
[nepi.git] / src / nepi / resources / omf / xx_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 """
19
20 from nepi.execution.resource import ResourceManager, clsinit
21 from nepi.execution.attribute import Attribute
22
23 from nepi.resources.omf.omf_api import OMFAPIFactory
24
25 @clsinit
26 class OMFResource(ResourceManager):
27     _rtype = "OMFResource"
28
29     @classmethod
30     def _register_attributes(cls):
31         xmppSlice = Attribute("xmppSlice","Name of the slice", flags = "0x02")
32         xmppHost = Attribute("xmppHost", "Xmpp Server",flags = "0x02")
33         xmppPort = Attribute("xmppPort", "Xmpp Port",flags = "0x02")
34         xmppPassword = Attribute("xmppPassword", "Xmpp Port",flags = "0x02")
35         cls._register_attribute(xmppSlice)
36         cls._register_attribute(xmppHost)
37         cls._register_attribute(xmppPort)
38         cls._register_attribute(xmppPassword)
39
40     def __init__(self, ec, guid, creds):
41         super(OMFNode, self).__init__(ec, guid)
42         self.set('xmppSlice', creds['xmppSlice'])
43         self.set('xmppHost', creds['xmppHost'])
44         self.set('xmppPort', creds['xmppPort'])
45         self.set('xmppPassword', creds['xmppPassword'])
46
47         self._omf_api = OMFAPIFactory.get_api(self.get('xmppSlice'), self.get('xmppHost'), self.get('xmppPort'), self.get('xmppPassword'))
48
49     def discover(self):
50         pass
51      
52     def provision(self, credential):
53         pass
54
55