rename src/nepi/ into just nepi/
[nepi.git] / 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 version 2 as
7 #    published by the Free Software Foundation;
8 #
9 #    This program is distributed in the hope that it will be useful,
10 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
11 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 #    GNU General Public License for more details.
13 #
14 #    You should have received a copy of the GNU General Public License
15 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 #
17 # Author: Alina Quereilhac <alina.quereilhac@inria.fr>
18
19 import os
20 import time
21 import threading
22         
23 class NS3DceHelper(object):
24     def __init__(self, simulation):
25         self.simulation = simulation
26
27         # Lock used to synchronize usage of DceManagerHelper 
28         self._dce_manager_lock = threading.Lock()
29         # Lock used to synchronize usage of DceApplicationHelper
30         self._dce_application_lock = threading.Lock()
31    
32         self._dce_manager_uuid = None
33         self._dce_application_uuid = None
34
35     @property
36     def dce_manager_uuid(self):
37         if not self._dce_manager_uuid:
38             self._dce_manager_uuid = \
39                     self.simulation.create("DceManagerHelper")
40
41         return self._dce_manager_uuid
42
43     @property
44     def dce_application_uuid(self):
45         if not self._dce_application_uuid:
46             self._dce_application_uuid = \
47                     self.simulation.create("DceApplicationHelper")
48                         
49         return self._dce_application_uuid
50
51     @property
52     def dce_manager_lock(self):
53         return self._dce_manager_lock
54
55     @property
56     def dce_application_lock(self):
57         return self._dce_application_lock
58