Adding authors and correcting licence information
[nepi.git] / test / resources / planetlab / plcapi.py
1 #!/usr/bin/env python
2 #
3 #    NEPI, a framework to manage network experiments
4 #    Copyright (C) 2013 INRIA
5 #
6 #    This program is free software: you can redistribute it and/or modify
7 #    it under the terms of the GNU General Public License as published by
8 #    the Free Software Foundation, either version 3 of the License, or
9 #    (at your option) any later version.
10 #
11 #    This program is distributed in the hope that it will be useful,
12 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 #    GNU General Public License for more details.
15 #
16 #    You should have received a copy of the GNU General Public License
17 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 #
19 # Author: Alina Quereilhac <alina.quereilhac@inria.fr>
20
21
22 from nepi.resources.planetlab.plcapi import PLCAPIFactory
23 from nepi.util.sshfuncs import RUNNING, FINISHED
24
25 import os
26 import unittest
27
28 class PlanetlabAPITestCase(unittest.TestCase):
29     def setUp(self):
30         self.slicename = 'inria_nepi'
31         self.host1 = 'nepi2.pl.sophia.inria.fr'
32         self.host2 = 'nepi5.pl.sophia.inria.fr'
33
34
35     def test_list_hosts(self):
36         slicename = os.environ.get('PL_USER')
37         pl_pass = os.environ.get('PL_PASS')
38         pl_url = "nepiplc.pl.sophia.inria.fr"
39
40         plapi =  PLCAPIFactory.get_api(slicename, pl_pass, pl_url)
41
42         plapi.test()
43
44         nodes = plapi.get_nodes()
45         self.assertTrue(len(nodes)>0)
46
47
48 if __name__ == '__main__':
49     unittest.main()
50