@@ -190,6 +190,8 @@ async def startup_event():
190
190
191
191
nodes_registration = {}
192
192
193
+ scenarios_list = []
194
+
193
195
scenarios_list_length = 0
194
196
195
197
scenarios_finished = 0
@@ -807,6 +809,28 @@ def remove_scenario(scenario_name=None):
807
809
ScenarioManagement .remove_files_by_scenario (scenario_name )
808
810
809
811
812
+ @app .get ("/nebula/dashboard/{scenario_name}/relaunch" )
813
+ async def nebula_relaunch_scenario (scenario_name : str , request : Request , session : dict = Depends (get_session )):
814
+ global scenarios_list , scenarios_list_length
815
+
816
+ if "user" in session :
817
+ if session ["role" ] == "demo" :
818
+ raise HTTPException (status_code = status .HTTP_401_UNAUTHORIZED )
819
+ elif session ["role" ] == "user" :
820
+ if not check_scenario_with_role (session ["role" ], scenario_name ):
821
+ raise HTTPException (status_code = status .HTTP_401_UNAUTHORIZED )
822
+
823
+ scenario_path = Utils .check_path (settings .config_dir , os .path .join (scenario_name , "scenario.json" ))
824
+ with open (scenario_path ) as scenario_file :
825
+ scenario = json .load (scenario_file )
826
+
827
+ scenarios_list .append (scenario )
828
+ scenarios_list_length = scenarios_list_length + 1
829
+ return RedirectResponse (url = "/nebula/dashboard" )
830
+ else :
831
+ raise HTTPException (status_code = status .HTTP_401_UNAUTHORIZED )
832
+
833
+
810
834
@app .get ("/nebula/dashboard/{scenario_name}/remove" )
811
835
async def nebula_remove_scenario (scenario_name : str , request : Request , session : dict = Depends (get_session )):
812
836
if "user" in session :
@@ -1238,8 +1262,9 @@ async def run_scenario(scenario_data, role):
1238
1262
1239
1263
# Deploy the list of scenarios
1240
1264
async def run_scenarios (data , role ):
1241
- global scenarios_finished
1242
- for scenario_data in data :
1265
+ global scenarios_finished , scenarios_list
1266
+ scenarios_list = data
1267
+ for scenario_data in scenarios_list :
1243
1268
finish_scenario_event .clear ()
1244
1269
logging .info (f"Running scenario { scenario_data ['scenario_title' ]} " )
1245
1270
scenario_name = await run_scenario (scenario_data , role )
0 commit comments