d0c86c6960143b57981d8b7b65882638de0bd94f
[nepi.git] / src / nepi / resources / ns3 / ns3dcehelper.py
1 #
2 #    NEPI, a framework to manage network experiments
3 #    Copyright (C) 2014 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: Alina Quereilhac <alina.quereilhac@inria.fr>
19
20 import os
21 import time
22 import threading
23         
24 class NS3DceHelper(object):
25     def __init__(self, simulation):
26         self.simulation = simulation
27
28         # Lock used to synchronize usage of DceManagerHelper 
29         self._dce_manager_lock = threading.Lock()
30         # Lock used to synchronize usage of DceApplicationHelper
31         self._dce_application_lock = threading.Lock()
32    
33         self._dce_manager_uuid = None
34         self._dce_application_uuid = None
35
36     @property
37     def dce_manager_uuid(self):
38         if not self._dce_manager_uuid:
39             self._dce_manager_uuid = \
40                     self.simulation.create("DceManagerHelper")
41
42         return self._dce_manager_uuid
43
44     @property
45     def dce_application_uuid(self):
46         if not self._dce_application_uuid:
47             self._dce_application_uuid = \
48                     self.simulation.create("DceApplicationHelper")
49                         
50         return self._dce_application_uuid
51
52     @property
53     def dce_manager_lock(self):
54         return self._dce_manager_lock
55
56     @property
57     def dce_application_lock(self):
58         return self._dce_application_lock
59