Skip to content

Commit 207d53e

Browse files
committed
Merge remote-tracking branch 'origin/controller_frontend_split' into simple-mobility
2 parents 31d7fe2 + 5a81356 commit 207d53e

File tree

22 files changed

+3447
-10295
lines changed

22 files changed

+3447
-10295
lines changed

app/main.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
sys.path.append(os.path.join(os.path.dirname(__file__), "..")) # Parent directory where is the NEBULA module
66
import nebula
7-
from nebula.controller import Controller
8-
from nebula.scenarios import ScenarioManagement
7+
from nebula.controller.controller import Controller
8+
from nebula.controller.scenarios import ScenarioManagement
99

1010
argparser = argparse.ArgumentParser(description="Controller of NEBULA platform", add_help=False)
1111

@@ -54,8 +54,6 @@
5454
help="Statistics port (default: 8080)",
5555
)
5656

57-
argparser.add_argument("-t", "--test", dest="test", action="store_true", default=False, help="Run tests")
58-
5957
argparser.add_argument(
6058
"-st",
6159
"--stop",

nebula/addons/gps/nebulagps.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def __init__(self, config, addr, update_interval: float = 5.0, verbose=False):
2626
self._verbose = verbose
2727

2828
async def start(self):
29-
"""Inicia el servicio de GPS, enviando y recibiendo ubicaciones."""
29+
"""Starts the GPS service, sending and receiving locations."""
3030
logging.info("Starting NebulaGPS service...")
3131
self.running = True
3232

@@ -73,7 +73,7 @@ async def _send_location_loop(self):
7373
await asyncio.sleep(self.update_interval)
7474

7575
async def _receive_location_loop(self):
76-
"""Escucha y almacena geolocalizaciones de otros nodos."""
76+
"""Listens to and stores geolocations from other nodes."""
7777
while self.running:
7878
try:
7979
data, addr = await asyncio.get_running_loop().run_in_executor(
@@ -102,5 +102,7 @@ async def _notify_geolocs(self):
102102
for addr, (lat, long) in geolocs.items():
103103
dist = await self.calculate_distance(self_lat, self_long, lat, long)
104104
distances[addr] = (dist, (lat, long))
105+
106+
self._config.update_nodes_distance(distances)
105107
gpsevent = GPSEvent(distances)
106108
asyncio.create_task(EventManager.get_instance().publish_addonevent(gpsevent))

nebula/addons/reporter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def __init__(self, config, trainer):
5454
self.frequency = self.config.participant["reporter_args"]["report_frequency"]
5555
self.grace_time = self.config.participant["reporter_args"]["grace_time_reporter"]
5656
self.data_queue = asyncio.Queue()
57-
self.url = f"http://{self.config.participant['scenario_args']['controller']}/platform/dashboard/{self.config.participant['scenario_args']['name']}/node/update"
57+
self.url = f"http://{self.config.participant['scenario_args']['controller']}/nodes/{self.config.participant['scenario_args']['name']}/update"
5858
self.counter = 0
5959

6060
self.first_net_metrics = True
@@ -167,7 +167,7 @@ async def report_scenario_finished(self):
167167
might be temporarily overloaded.
168168
- Logs exceptions if the connection attempt to the controller fails.
169169
"""
170-
url = f"http://{self.config.participant['scenario_args']['controller']}/platform/dashboard/{self.config.participant['scenario_args']['name']}/node/done"
170+
url = f"http://{self.config.participant['scenario_args']['controller']}/nodes/{self.config.participant['scenario_args']['name']}/done"
171171
data = json.dumps({"idx": self.config.participant["device_args"]["idx"]})
172172
headers = {
173173
"Content-Type": "application/json",

nebula/config/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,9 @@ def add_neighbor_from_config(self, addr):
184184
self.participant["network_args"]["neighbors"] += " " + addr
185185
self.participant["mobility_args"]["neighbors_distance"][addr] = None
186186

187+
def update_nodes_distance(self, distances: dict):
188+
self.participant["mobility_args"]["neighbors_distance"] = {node: dist for node, (dist, _) in distances.items()}
189+
187190
def update_neighbors_from_config(self, current_connections, dest_addr):
188191
final_neighbors = []
189192
for n in current_connections:

0 commit comments

Comments
 (0)