Skip to content

Commit 0422bdb

Browse files
refactor naming of endpoints
1 parent 56977db commit 0422bdb

File tree

9 files changed

+101
-101
lines changed

9 files changed

+101
-101
lines changed

nebula/addons/reporter.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def __init__(self, config, trainer, cm: "CommunicationsManager"):
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']}/nebula/dashboard/{self.config.participant['scenario_args']['name']}/node/update"
57+
self.url = f"http://{self.config.participant['scenario_args']['controller']}/platform/dashboard/{self.config.participant['scenario_args']['name']}/node/update"
5858
self.counter = 0
5959

6060
self.first_net_metrics = True
@@ -157,7 +157,7 @@ async def report_scenario_finished(self):
157157
might be temporarily overloaded.
158158
- Logs exceptions if the connection attempt to the controller fails.
159159
"""
160-
url = f"http://{self.config.participant['scenario_args']['controller']}/nebula/dashboard/{self.config.participant['scenario_args']['name']}/node/done"
160+
url = f"http://{self.config.participant['scenario_args']['controller']}/platform/dashboard/{self.config.participant['scenario_args']['name']}/node/done"
161161
data = json.dumps({"idx": self.config.participant["device_args"]["idx"]})
162162
headers = {
163163
"Content-Type": "application/json",

nebula/addons/waf/default.conf

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,27 @@ server {
1515
set $upstream http://nebula_nebula-frontend; # Change this
1616
set $always_redirect off;
1717
modsecurity on;
18-
location /nebula {
18+
location /platform {
1919
client_max_body_size 0;
2020

2121
if ($always_redirect = on) {
2222
return 301 https://$host$request_uri;
2323
}
2424

2525
modsecurity_rules '
26-
SecRule REQUEST_URI "@beginsWith /nebula/socket.io/" "id:4200000,phase:1,allow,nolog"
26+
SecRule REQUEST_URI "@beginsWith /platform/socket.io/" "id:4200000,phase:1,allow,nolog"
2727
';
2828

2929
modsecurity_rules '
30-
SecRule REQUEST_URI "@beginsWith /nebula/ws/" "id:4200001,phase:1,allow,nolog"
30+
SecRule REQUEST_URI "@beginsWith /platform/ws/" "id:4200001,phase:1,allow,nolog"
3131
';
3232

3333
modsecurity_rules '
34-
SecRule REQUEST_URI "@beginsWith /nebula/dashboard/deployment/run" "id:4200005,phase:1,nolog,pass,ctl:ruleRemoveById=200007"
34+
SecRule REQUEST_URI "@beginsWith /platform/dashboard/deployment/run" "id:4200005,phase:1,nolog,pass,ctl:ruleRemoveById=200007"
3535
';
3636

3737
modsecurity_rules '
38-
SecRule REQUEST_URI "@beginsWith /nebula/dashboard/deployment/run" "id:4200006,phase:2,nolog,pass,ctl:ruleRemoveById=200002"
38+
SecRule REQUEST_URI "@beginsWith /platform/dashboard/deployment/run" "id:4200006,phase:2,nolog,pass,ctl:ruleRemoveById=200002"
3939
';
4040

4141
# modsecurity_rules "

nebula/core/network/communications.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ def __init__(self, engine: "Engine"):
4040
self.config = engine.get_config()
4141
self.id = str(self.config.participant["device_args"]["idx"])
4242

43-
self.register_endpoint = f"http://{self.config.participant['scenario_args']['controller']}/nebula/dashboard/{self.config.participant['scenario_args']['name']}/node/register"
44-
self.wait_endpoint = f"http://{self.config.participant['scenario_args']['controller']}/nebula/dashboard/{self.config.participant['scenario_args']['name']}/node/wait"
43+
self.register_endpoint = f"http://{self.config.participant['scenario_args']['controller']}/platform/dashboard/{self.config.participant['scenario_args']['name']}/node/register"
44+
self.wait_endpoint = f"http://{self.config.participant['scenario_args']['controller']}/platform/dashboard/{self.config.participant['scenario_args']['name']}/node/wait"
4545

4646
self._connections = {}
4747
self.connections_lock = Locker(name="connections_lock", async_lock=True)

nebula/frontend/app.py

+67-67
Large diffs are not rendered by default.

nebula/frontend/templates/admin.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ <h3>Manage Existing Accounts</h3>
9999
var role = $(this).data('user-role');
100100
$('#user-modal-title').text('Update Account');
101101
$('#user-modal-content').html(
102-
'<form action="/nebula/user/update" method="POST">' +
102+
'<form action="/platform/user/update" method="POST">' +
103103
'<div class="form-group">' +
104104
'<label>Username:</label>' +
105105
'<p>' + user + '</p>' +

nebula/frontend/templates/dashboard.html

+6-6
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ <h3>Scenarios in the database</h3>
246246

247247
<!-- <script>
248248
setInterval(function () {
249-
fetch('/nebula/api/dashboard/runningscenario')
249+
fetch('/platform/api/dashboard/runningscenario')
250250
.then(response => response.json())
251251
.then(data => {
252252
if (data.name) {
@@ -266,7 +266,7 @@ <h3>Scenarios in the database</h3>
266266
$('#confirm-modal #confirm-modal-body').html('Are you sure you want to relaunch the scenario ' + scenario_title + '?');
267267

268268
$('#confirm-modal #yes-button').off('click').on('click', function () {
269-
const response = fetch('/nebula/dashboard/' + scenario_name + '/relaunch', {
269+
const response = fetch('/platform/dashboard/' + scenario_name + '/relaunch', {
270270
method: 'GET'
271271
})
272272
.then(response => {
@@ -294,7 +294,7 @@ <h3>Scenarios in the database</h3>
294294
$('#confirm-modal #confirm-modal-body').html('Are you sure you want to remove the scenario ' + scenario_name + '?<br><br><p class="badge text-bg-danger">Warning: you will remove the scenario from the database</p>');
295295

296296
$('#confirm-modal #yes-button').off('click').on('click', function () {
297-
const response = fetch('/nebula/dashboard/' + scenario_name + '/remove', {
297+
const response = fetch('/platform/dashboard/' + scenario_name + '/remove', {
298298
method: 'GET'
299299
})
300300
.then(response => {
@@ -341,7 +341,7 @@ <h3>Scenarios in the database</h3>
341341

342342
if (notesRow.style.display === 'none') {
343343
try {
344-
const response = await fetch('/nebula/dashboard/' + scenarioName + '/notes');
344+
const response = await fetch('/platform/dashboard/' + scenarioName + '/notes');
345345
const data = await response.json();
346346
console.log(data);
347347

@@ -366,7 +366,7 @@ <h3>Scenarios in the database</h3>
366366

367367
if (configRow.style.display === 'none') {
368368
try {
369-
const response = await fetch(`/nebula/dashboard/${scenarioName}/config`);
369+
const response = await fetch(`/platform/dashboard/${scenarioName}/config`);
370370
const data = await response.json();
371371

372372
if (data.status === 'success') {
@@ -386,7 +386,7 @@ <h3>Scenarios in the database</h3>
386386
async function saveNotes(scenarioName) {
387387
const notesText = document.getElementById('notes-text-' + scenarioName).value;
388388

389-
const response = await fetch('/nebula/dashboard/' + scenarioName + '/save_note', {
389+
const response = await fetch('/platform/dashboard/' + scenarioName + '/save_note', {
390390
method: 'POST',
391391
headers: {
392392
'Content-Type': 'application/json',

nebula/frontend/templates/deployment.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -2130,7 +2130,7 @@ <h5 class="step-title">Schema of deployment</h5>
21302130
<script>
21312131
// Send configuration to the server for deployment
21322132

2133-
// When click "run-btn" button, create a POST request to /nebula/dashboard/deployment/run with JSON data
2133+
// When click "run-btn" button, create a POST request to /platform/dashboard/deployment/run with JSON data
21342134
document.getElementById("run-btn").addEventListener("click", function () {
21352135

21362136
// Show the modal
@@ -2166,7 +2166,7 @@ <h5 class="step-title">Schema of deployment</h5>
21662166
document.querySelector(".overlay").style.display = "block";
21672167
document.getElementById("spinner").style.display = "block";
21682168

2169-
fetch("/nebula/dashboard/deployment/run", {
2169+
fetch("/platform/dashboard/deployment/run", {
21702170
method: "POST",
21712171
headers: {
21722172
'Content-Type': 'application/json'
@@ -2603,7 +2603,7 @@ <h5 class="step-title">Schema of deployment</h5>
26032603
let textAreas = "";
26042604
for (let i = 0; i < numberOfNodes; i++) {
26052605
textAreas += `<h4>Participant ${i}</h4>`;
2606-
let response = await fetch(`/nebula/dashboard/deployment/participant/file`);
2606+
let response = await fetch(`/platform/dashboard/deployment/participant/file`);
26072607
let json = await response.json();
26082608
textAreas += `<textarea class="form-control" rows="10" cols="50" style="width:100%;" name="participant${i}">${JSON.stringify(json, null, 4)}</textarea>`;
26092609
// textAreas += `<textarea class="form-control" rows="10" cols="50" name="scenario" id="scenario" style="width:100%;"></textarea>`;

nebula/frontend/templates/layout.html

+6-6
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
var host = window.location.hostname;
113113
var port = window.location.port ? ':' + window.location.port : '';
114114
var protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
115-
var socket = new WebSocket(protocol + '//' + host + port + '/nebula/ws/' + client_id);
115+
var socket = new WebSocket(protocol + '//' + host + port + '/platform/ws/' + client_id);
116116
</script>
117117
</head>
118118

@@ -121,7 +121,7 @@
121121
<div class="container d-flex align-items-center justify-content-between">
122122

123123
<h1 class="logo">
124-
<a href="/nebula" style="white-space: nowrap;">
124+
<a href="/platform" style="white-space: nowrap;">
125125
<img src="{{ url_for('static', path='images/nebula-icon-white.svg') }}" alt="Nebula Icon"
126126
style="height: 50px; margin-right: 5px;">
127127
NEBULA
@@ -131,7 +131,7 @@ <h1 class="logo">
131131
<nav id="navbar" class="navbar">
132132
<ul>
133133
<li><a class="nav-link scrollto {% if request.path == '/' %}active{% endif %}"
134-
href="/nebula">Home</a>
134+
href="/platform">Home</a>
135135
</li>
136136
<li><a class="nav-link scrollto" href="https://github.com/CyberDataLab/nebula">Source Code</a>
137137
</li>
@@ -149,7 +149,7 @@ <h1 class="logo">
149149
<a class="nav-link dropdown-toggle" href="#" id="navbarLoginDropdown">Login</a>
150150
<ul>
151151
<li>
152-
<form id="login-form" action="/nebula/login" method="post" class="px-4 py-3">
152+
<form id="login-form" action="/platform/login" method="post" class="px-4 py-3">
153153
<div class="mb-3">
154154
<label for="dropdownLoginFormUsername">Username</label>
155155
<input type="text" name="user" class="form-control"
@@ -226,15 +226,15 @@ <h1 class="logo">
226226

227227
const formData = new FormData(loginForm);
228228

229-
fetch("/nebula/login", {
229+
fetch("/platform/login", {
230230
method: "POST",
231231
body: formData,
232232
})
233233
.then((response) => {
234234
if (!response.ok) {
235235
showAlert('danger', 'Invalid credentials');
236236
} else {
237-
window.location.replace("/nebula");
237+
window.location.replace("/platform");
238238
}
239239
})
240240
.catch((error) => {

nebula/frontend/templates/monitor.html

+9-9
Original file line numberDiff line numberDiff line change
@@ -86,29 +86,29 @@ <h3>Nodes in the database</h3>
8686
{% if hash %}
8787
<li>
8888
<a class="dropdown-item"
89-
href="/nebula/dashboard/{{ scenario_name }}/node/{{ hash }}/metrics">
89+
href="/platform/dashboard/{{ scenario_name }}/node/{{ hash }}/metrics">
9090
<i class="fa fa-bar-chart"></i>
9191
Real-time metrics
9292
</a>
9393
</li>
9494
{% endif %}
9595
<li>
9696
<a class="dropdown-item download"
97-
href="/nebula/dashboard/{{ scenario_name }}/node/{{ idx }}/infolog">
97+
href="/platform/dashboard/{{ scenario_name }}/node/{{ idx }}/infolog">
9898
<i class="fa fa-download"></i>
9999
Download INFO logs
100100
</a>
101101
</li>
102102
<li>
103103
<a class="dropdown-item download"
104-
href="/nebula/dashboard/{{ scenario_name }}/node/{{ idx }}/debuglog">
104+
href="/platform/dashboard/{{ scenario_name }}/node/{{ idx }}/debuglog">
105105
<i class="fa fa-download"></i>
106106
Download DEBUG logs
107107
</a>
108108
</li>
109109
<li>
110110
<a class="dropdown-item download"
111-
href="/nebula/dashboard/{{ scenario_name }}/node/{{ idx }}/errorlog">
111+
href="/platform/dashboard/{{ scenario_name }}/node/{{ idx }}/errorlog">
112112
<i class="fa fa-download"></i>
113113
Download ERROR logs
114114
</a>
@@ -347,14 +347,14 @@ <h3>Topology</h3>
347347
var droneLines = {};
348348

349349
var droneIcon = L.icon({
350-
iconUrl: '/nebula/static/images/drone.svg',
350+
iconUrl: '/platform/static/images/drone.svg',
351351
iconSize: [38, 38], // Icon size
352352
iconAnchor: [19, 19], // Icon point that will correspond to the marker coordinate
353353
popupAnchor: [0, -19] // Where the popup will be displayed in relation to the icon
354354
});
355355

356356
var droneIconOffline = L.icon({
357-
iconUrl: '/nebula/static/images/drone_offline.svg',
357+
iconUrl: '/platform/static/images/drone_offline.svg',
358358
iconSize: [38, 38], // Icon size
359359
iconAnchor: [19, 19], // Icon point that will correspond to the marker coordinate
360360
popupAnchor: [0, -19] // Where the popup will be displayed in relation to the icon
@@ -504,7 +504,7 @@ <h3>Topology</h3>
504504
var scenario_name = document.getElementById('scenario_name').innerHTML;
505505

506506
// Get the table
507-
fetch('/nebula/api/dashboard/' + scenario_name + '/monitor')
507+
fetch('/platform/api/dashboard/' + scenario_name + '/monitor')
508508
.then(function (response) {
509509
if (!response.ok) {
510510
showAlert("danger", "Error: " + response.status + " " + response.statusText);
@@ -681,8 +681,8 @@ <h3>Topology</h3>
681681
node_row.appendChild(status);
682682
}
683683
status.innerHTML = nodeData.status ? '<span class="badge text-bg-success">Online</span>' : '<span class="badge text-bg-danger">Offline</span>';
684-
// Request /nebula/api/dashboard/{{ scenario_name }}/monitor to get only the status of the node
685-
fetch('/nebula/api/dashboard/' + nodeData.scenario_name + '/monitor')
684+
// Request /platform/api/dashboard/{{ scenario_name }}/monitor to get only the status of the node
685+
fetch('/platform/api/dashboard/' + nodeData.scenario_name + '/monitor')
686686
.then(function (response) {
687687
if (!response.ok) {
688688
showAlert("danger", "Error: " + response.status + " " + response.statusText);

0 commit comments

Comments
 (0)