Commits

Joshua Bonsink committed 65e8c9a

updated gui

  • Participants
  • Parent commits 64064a8

Comments (0)

Files changed (1)

 NETNS3 = "Netns3 Simulation"
 PURE_SIM = "Pure Simulation"
 
+# Experiments
+COMPLEX = "complex_net_exp"
+MANUAL_TOPO_BT = "manual_topo_bt_exp"
+MANUAL_TOPO = "manual_topo_exp"
+STATIC_ROUTE = "static_route_exp"
+TOPOLOGY = "topo_exp"
+
 def choseCorrectFile(settings_type):
     if settings_type == COMMON_SETTINGS:                    
         return 'core/cmd/description.py'
     elif settings_type == SPAMMING:
         return 'scenario/spamming/config.py'
 
-def showFileDialogBackTraf(exp):
-    file = QtGui.QFileDialog.getOpenFileName(self, 'Open file', '.')
-    if file != "":
-        if exp == "complex":
-                self.complex_backtraf_location.setText(file)            
-        elif exp == "manual_bt":
-                self.manual_bt_backtraf_location.setText(file)            
-        elif exp == "manual":
-                self.manual_backtraf_location.setText(file)                    
-                 
-
-def showFileDialogDotFile():
-    file = QtGui.QFileDialog.getOpenFileName(self, 'Open file', '.')
-    if file != "":
-        self.dot_file_location.setText(file)       
-        
-def showFileDialogNetSettings():
-    file = QtGui.QFileDialog.getOpenFileName(self, 'Open file', '.')
-    if file != "":
-        self.net_settings_location.setText(file)            
-
-def showFileDialogTopoFile():
-    file = QtGui.QFileDialog.getOpenFileName(self, 'Open file', '.')
-    if file != "":
-        self.topo_file_location.setText(file)
-
 def searchAndReplace(settings_type, entity, parameter, old_value, new_value):
     passed_entity = False
     
             if entity in line:
                 passed_entity = True 
                       
-            if passed_entity == True and parameter in line:                     
+            if passed_entity == True and parameter in line:                                 
                 f.write(line.replace(old_value, new_value))
                 passed_entity = False
                 return
          
         self.setCentralWidget(tab_widget)
 
+        # --- Topology editor --- #
+        tab_topology_layout = QtGui.QVBoxLayout(tab_topology)
+        container = QtGui.QX11EmbedContainer()               
+        tab_topology_layout.addWidget(container)
+        
+        container.show()
+        process = QtCore.QProcess(container)
+        executable = QtCore.QString("./loadguiconfig.sh")
+        arguments = QtCore.QStringList()
+        arguments.append(QtCore.QString("-into"))
+        arguments.append(QtCore.QString.number(container.winId()))
+        process.start(executable, arguments)
+        
+        
         # --- DDOS Flooding scenario --- #
         tab_ddos_flooding_layout = QtGui.QVBoxLayout(tab_ddos_flooding)     
         tool_box_ddos = QtGui.QToolBox(tab_ddos_flooding)
         grid_groupbox_complex_network.addItem(spacerItem1, 0, 1, 1, 2)        
         self.complex_backtraf_location = QtGui.QLineEdit(self.groupbox_complex_network)
         self.complex_backtraf_location.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
-        self.complex_backtraf_location.setText("netconfig/complex_backtraf.py") 
+        self.complex_backtraf_location.setText("net_config/back_traf.py") 
         self.complex_backtraf_location.setMinimumWidth(360)       
         grid_groupbox_complex_network.addWidget(self.complex_backtraf_location, 0, 2, 1, 2)
         spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
         grid_groupbox_complex_network.addItem(spacerItem2, 0, 3, 1, 2)
         button = QtGui.QPushButton('Select File', self)
-        button.clicked.connect(lambda: self.showFileDialogBackTraf("complex"))       
+        button.clicked.connect(lambda: self.showFileDialogBackTraf(COMPLEX))       
         button.setSizePolicy(QtGui.QSizePolicy(20, 5))       
         grid_groupbox_complex_network.addWidget(button, 0, 4, 1, 2)
 
         grid_groupbox_complex_network.addItem(spacerItem3, 1, 1, 1, 2)        
         self.complex_dot_file_location = QtGui.QLineEdit(self.groupbox_complex_network)
         self.complex_dot_file_location.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
-        self.complex_dot_file_location.setText("netconfig/ManualTopoBTConf.dot")        
+        self.complex_dot_file_location.setText("net_config/ManualTopoBTConf.dot")        
         grid_groupbox_complex_network.addWidget(self.complex_dot_file_location, 1, 2, 1, 2)
         spacerItem4 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
         grid_groupbox_complex_network.addItem(spacerItem4, 1, 3, 1, 2)
         button = QtGui.QPushButton('Select File', self)
-        button.clicked.connect(lambda: self.showFileDialogDotFile("complex"))       
+        button.clicked.connect(lambda: self.showFileDialogDotFile(COMPLEX))       
         button.setSizePolicy(QtGui.QSizePolicy(20, 5))       
         grid_groupbox_complex_network.addWidget(button, 1, 4, 1, 2)
 
         grid_groupbox_complex_network.addItem(spacerItem5, 2, 1, 1, 2)        
         self.complex_net_settings_location = QtGui.QLineEdit(self.groupbox_complex_network)
         self.complex_net_settings_location.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
-        self.complex_net_settings_location.setText("netconfig/aro_demo/nf_net_settings.py")               
+        self.complex_net_settings_location.setText("net_config/aro_demo/nf_net_settings.py")               
         grid_groupbox_complex_network.addWidget(self.complex_net_settings_location, 2, 2, 1, 2)
         spacerItem6 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
         grid_groupbox_complex_network.addItem(spacerItem6, 2, 3, 1, 2)
         button = QtGui.QPushButton('Select File', self)
-        button.clicked.connect(lambda: self.showFileDialogNetSettings("complex"))       
+        button.clicked.connect(lambda: self.showFileDialogNetSettings(COMPLEX))       
         button.setSizePolicy(QtGui.QSizePolicy(20, 5))       
         grid_groupbox_complex_network.addWidget(button, 2, 4, 1, 2)
 
         grid_groupbox_complex_network.addItem(spacerItem7, 3, 1, 1, 2)        
         self.complex_topo_file_location = QtGui.QLineEdit(self.groupbox_complex_network)
         self.complex_topo_file_location.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
-        self.complex_topo_file_location.setText("netconfig/net_small_toposample.txt")        
+        self.complex_topo_file_location.setText("net_config/Inet_small_toposample.txt")        
         grid_groupbox_complex_network.addWidget(self.complex_topo_file_location, 3, 2, 1, 2)
         spacerItem8 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
         grid_groupbox_complex_network.addItem(spacerItem8, 3, 3, 1, 2)
         button = QtGui.QPushButton('Select File', self)
-        button.clicked.connect(lambda: self.showFileDialogTopoFile("complex"))       
+        button.clicked.connect(lambda: self.showFileDialogTopoFile(COMPLEX))       
         button.setSizePolicy(QtGui.QSizePolicy(20, 5))       
         grid_groupbox_complex_network.addWidget(button, 3, 4, 1, 2)
 
         self.complex_duration = QtGui.QSpinBox(self.groupbox_emulation)            
         self.complex_duration.setValue(0)
         self.complex_duration.setMinimum(0)
-        self.complex_duration.setMaximum(10)
+        self.complex_duration.setMaximum(3600)
         self.complex_duration.setSingleStep(1)        
         grid_groupbox_complex_network.addWidget(self.complex_duration, 4, 2, 1, 2)
 
         grid_groupbox_manual_topo_bt.addItem(spacerItem1, 0, 1, 1, 2)        
         self.manual_bt_back_traf_location = QtGui.QLineEdit(self.groupbox_manual_topo_bt)
         self.manual_bt_back_traf_location.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
-        self.manual_bt_back_traf_location.setText("netconfig/manual_bt_back_traf.py") 
+        self.manual_bt_back_traf_location.setText("net_config/back_traf.py") 
         self.manual_bt_back_traf_location.setMinimumWidth(360)       
         grid_groupbox_manual_topo_bt.addWidget(self.manual_bt_back_traf_location, 0, 2, 1, 2)
         spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
         grid_groupbox_manual_topo_bt.addItem(spacerItem2, 0, 3, 1, 2)
         button = QtGui.QPushButton('Select File', self)
-        button.clicked.connect(lambda: self.showFileDialogBackTraf("manual_bt"))       
+        button.clicked.connect(lambda: self.showFileDialogBackTraf(MANUAL_TOPO_BT))       
         button.setSizePolicy(QtGui.QSizePolicy(20, 5))       
         grid_groupbox_manual_topo_bt.addWidget(button, 0, 4, 1, 2)
 
         grid_groupbox_manual_topo_bt.addItem(spacerItem3, 1, 1, 1, 2)        
         self.manual_bt_dot_file_location = QtGui.QLineEdit(self.groupbox_manual_topo_bt)
         self.manual_bt_dot_file_location.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
-        self.manual_bt_dot_file_location.setText("netconfig/ManualTopoBTConf.dot")        
+        self.manual_bt_dot_file_location.setText("net_config/ManualTopoBTConf.dot")        
         grid_groupbox_manual_topo_bt.addWidget(self.manual_bt_dot_file_location, 1, 2, 1, 2)
         spacerItem4 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
         grid_groupbox_manual_topo_bt.addItem(spacerItem4, 1, 3, 1, 2)
         button = QtGui.QPushButton('Select File', self)
-        button.clicked.connect(lambda: self.showFileDialogDotFile("manual_bt"))       
+        button.clicked.connect(lambda: self.showFileDialogDotFile(MANUAL_TOPO_BT))       
         button.setSizePolicy(QtGui.QSizePolicy(20, 5))       
         grid_groupbox_manual_topo_bt.addWidget(button, 1, 4, 1, 2)
 
         grid_groupbox_manual_topo_bt.addItem(spacerItem5, 2, 1, 1, 2)        
         self.manual_bt_net_settings_location = QtGui.QLineEdit(self.groupbox_manual_topo_bt)
         self.manual_bt_net_settings_location.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
-        self.manual_bt_net_settings_location.setText("netconfig/aro_demo/nf_net_settings.py")               
+        self.manual_bt_net_settings_location.setText("net_config/net_settings.py")               
         grid_groupbox_manual_topo_bt.addWidget(self.manual_bt_net_settings_location, 2, 2, 1, 2)
         spacerItem6 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
         grid_groupbox_manual_topo_bt.addItem(spacerItem6, 2, 3, 1, 2)
         button = QtGui.QPushButton('Select File', self)
-        button.clicked.connect(lambda: self.showFileDialogNetSettings("manual_bt"))       
+        button.clicked.connect(lambda: self.showFileDialogNetSettings(MANUAL_TOPO_BT))       
         button.setSizePolicy(QtGui.QSizePolicy(20, 5))       
         grid_groupbox_manual_topo_bt.addWidget(button, 2, 4, 1, 2)
 
         grid_groupbox_manual_topo_bt.addItem(spacerItem7, 3, 1, 1, 2)        
         self.manual_bt_topo_file_location = QtGui.QLineEdit(self.groupbox_manual_topo_bt)
         self.manual_bt_topo_file_location.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
-        self.manual_bt_topo_file_location.setText("netconfig/net_small_toposample.txt")        
+        self.manual_bt_topo_file_location.setText("net_config/Inet_small_toposample.txt")        
         grid_groupbox_manual_topo_bt.addWidget(self.manual_bt_topo_file_location, 3, 2, 1, 2)
         spacerItem8 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
         grid_groupbox_manual_topo_bt.addItem(spacerItem8, 3, 3, 1, 2)
         button = QtGui.QPushButton('Select File', self)
-        button.clicked.connect(lambda: self.showFileDialogTopoFile("manual_bt"))       
+        button.clicked.connect(lambda: self.showFileDialogTopoFile(MANUAL_TOPO_BT))       
         button.setSizePolicy(QtGui.QSizePolicy(20, 5))       
         grid_groupbox_manual_topo_bt.addWidget(button, 3, 4, 1, 2)
 
         self.manual_bt_duration = QtGui.QSpinBox(self.groupbox_emulation)            
         self.manual_bt_duration.setValue(0)
         self.manual_bt_duration.setMinimum(0)
-        self.manual_bt_duration.setMaximum(10)
+        self.manual_bt_duration.setMaximum(3600)
         self.manual_bt_duration.setSingleStep(1)
         grid_groupbox_manual_topo_bt.addWidget(self.manual_bt_duration, 4, 2, 1, 2)
 
         grid_groupbox_manual_topo.addItem(spacerItem5, 0, 1, 1, 2)        
         self.manual_net_settings_location = QtGui.QLineEdit(self.groupbox_manual_topo)
         self.manual_net_settings_location.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
-        self.manual_net_settings_location.setText("netconfig/aro_demo/nf_net_settings.py")               
-        grid_groupbox_manual_topo.addWidget(self.manual_net_settings_location, 2, 2, 1, 2)
+        self.manual_net_settings_location.setText("net_config/net_settings.py")               
+        grid_groupbox_manual_topo.addWidget(self.manual_net_settings_location, 0, 2, 1, 2)
         spacerItem6 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
         grid_groupbox_manual_topo.addItem(spacerItem6, 0, 3, 1, 2)
         button = QtGui.QPushButton('Select File', self)
-        button.clicked.connect(lambda: self.showFileDialogNetSettings("manual"))       
+        button.clicked.connect(lambda: self.showFileDialogNetSettings(MANUAL_TOPO))       
         button.setSizePolicy(QtGui.QSizePolicy(20, 5))       
         grid_groupbox_manual_topo.addWidget(button, 0, 4, 1, 2)
 
         grid_groupbox_manual_topo.addItem(spacerItem7, 1, 1, 1, 2)        
         self.manual_topo_file_location = QtGui.QLineEdit(self.groupbox_manual_topo)
         self.manual_topo_file_location.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
-        self.manual_topo_file_location.setText("netconfig/net_small_toposample.txt")        
-        grid_groupbox_manual_topo.addWidget(self.manual_topo_file_location, 3, 2, 1, 2)
+        self.manual_topo_file_location.setText("net_config/Inet_small_toposample.txt")        
+        grid_groupbox_manual_topo.addWidget(self.manual_topo_file_location, 1, 2, 1, 2)
         spacerItem8 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
         grid_groupbox_manual_topo.addItem(spacerItem8, 1, 3, 1, 2)
         button = QtGui.QPushButton('Select File', self)
-        button.clicked.connect(lambda: self.showFileDialogTopoFile("manual"))       
+        button.clicked.connect(lambda: self.showFileDialogTopoFile(MANUAL_TOPO))       
         button.setSizePolicy(QtGui.QSizePolicy(20, 5))       
         grid_groupbox_manual_topo.addWidget(button, 1, 4, 1, 2)
 
         self.manual_duration = QtGui.QSpinBox(self.groupbox_emulation)            
         self.manual_duration.setValue(0)
         self.manual_duration.setMinimum(0)
-        self.manual_duration.setMaximum(10)
+        self.manual_duration.setMaximum(3600)
         self.manual_duration.setSingleStep(1)
         grid_groupbox_manual_topo.addWidget(self.manual_duration, 2, 2, 1, 2)
 
         # --- Topology Experiment Settings --- #
         self.groupbox_topo = QtGui.QGroupBox()      
-        self.groupbox_topo.setTitle("Manual Topology Experiment parameters")
+        self.groupbox_topo.setTitle("Topology Experiment parameters")
         self.vbox_mode.addWidget(self.groupbox_topo)        
         grid_groupbox_topo = QtGui.QGridLayout()                        
         hbox_groupbox_topo = QtGui.QHBoxLayout(self.groupbox_topo)
         grid_groupbox_topo.addItem(spacerItem7, 0, 1, 1, 2)        
         self.topo_file_location = QtGui.QLineEdit(self.groupbox_topo)
         self.topo_file_location.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
-        self.topo_file_location.setText("netconfig/net_small_toposample.txt")        
-        grid_groupbox_topo.addWidget(self.topo_file_location, 3, 2, 1, 2)
+        self.topo_file_location.setText("net_config/Inet_small_toposample.txt")        
+        grid_groupbox_topo.addWidget(self.topo_file_location, 0, 2, 1, 2)
         spacerItem8 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
         grid_groupbox_topo.addItem(spacerItem8, 0, 3, 1, 2)
         button = QtGui.QPushButton('Select File', self)
-        button.clicked.connect(lambda: self.showFileDialogTopoFile("manual"))       
+        button.clicked.connect(lambda: self.showFileDialogTopoFile(MANUAL_TOPO))       
         button.setSizePolicy(QtGui.QSizePolicy(20, 5))       
         grid_groupbox_topo.addWidget(button, 0, 4, 1, 2)
 
         self.topo_duration = QtGui.QSpinBox(self.groupbox_topo)            
         self.topo_duration.setValue(0)
         self.topo_duration.setMinimum(0)
-        self.topo_duration.setMaximum(10)
+        self.topo_duration.setMaximum(3600)
         self.topo_duration.setSingleStep(1)
         grid_groupbox_topo.addWidget(self.topo_duration, 1, 2, 1, 2)
 
         # --- Static Route Experiment Settings --- #
         self.groupbox_static_route = QtGui.QGroupBox()      
-        self.groupbox_static_route.setTitle("Manual Topology Experiment parameters")
+        self.groupbox_static_route.setTitle("Static Route Experiment parameters")
         self.vbox_mode.addWidget(self.groupbox_static_route)        
         grid_groupbox_static_route = QtGui.QGridLayout()                        
         hbox_groupbox_static_route = QtGui.QHBoxLayout(self.groupbox_static_route)
         grid_groupbox_static_route.addWidget(label_3, 0, 0, 1, 2)        
         spacerItem9 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
         grid_groupbox_static_route.addItem(spacerItem9, 0, 1, 1, 2)        
-        self.topo_duration = QtGui.QSpinBox(self.groupbox_static_route)            
-        self.topo_duration.setValue(0)
-        self.topo_duration.setMinimum(0)
-        self.topo_duration.setMaximum(10)
-        self.topo_duration.setSingleStep(1)
+        self.static_duration = QtGui.QSpinBox(self.groupbox_static_route)            
+        self.static_duration.setValue(0)
+        self.static_duration.setMinimum(0)
+        self.static_duration.setMaximum(3600)
+        self.static_duration.setSingleStep(1)
         grid_groupbox_static_route.addWidget(self.topo_duration, 0, 2, 1, 2)
 
         self.groupbox_complex_network.hide()
         self.groupbox_topo.hide()
         self.groupbox_static_route.hide()  
     
+    def showFileDialogBackTraf(self, exp):
+        file = QtGui.QFileDialog.getOpenFileName(self, 'Open file', '.')
+        if file != "":
+            if exp == COMPLEX:
+                    self.complex_backtraf_location.setText(file)            
+            elif exp == MANUAL_TOPO_BT:
+                    self.manual_bt_back_traf_location.setText(file)            
+            elif exp == MANUAL_TOPO:
+                    self.manual_backtraf_location.setText(file)                                     
+
+    def showFileDialogDotFile(self, exp):
+        file = QtGui.QFileDialog.getOpenFileName(self, 'Open file', '.')
+        if file != "":
+            if exp == COMPLEX:
+                self.complex_dot_file_location.setText(file)            
+            elif exp == MANUAL_TOPO_BT:
+                self.manual_bt_dot_file_location.setText(file)            
+            elif exp == MANUAL_TOPO:
+                self.manual_dot_file_location.setText(file)
+                        
+    def showFileDialogNetSettings(self, exp):
+        file = QtGui.QFileDialog.getOpenFileName(self, 'Open file', '.')
+        if file != "":
+            if exp == COMPLEX:
+                self.complex_net_settings_location.setText(file)            
+            elif exp == MANUAL_TOPO_BT:
+                self.manual_bt_net_settings_location.setText(file)            
+            elif exp == MANUAL_TOPO:
+                self.manual_net_settings_location.setText(file)
+            
+    def showFileDialogTopoFile(self, exp):
+        file = QtGui.QFileDialog.getOpenFileName(self, 'Open file', '.')
+        if file != "":
+            if exp == COMPLEX:
+                self.complex_topo_file_location.setText(file)            
+            elif exp == MANUAL_TOPO_BT:
+                self.manual_topo_file_settings_location.setText(file)            
+            elif exp == MANUAL_TOPO:
+                self.manual_topo_file_location.setText(file)
+    
     def startEmulation(self, scenario):       
-		cmd = 'sudo ./emulate.py -s ' + scenario + ' -r server'   
-		os.system("gnome-terminal -e 'bash -c \"" + cmd + "; exec bash\"'")
-		for _ in range(self.emulation_clients.value()):        
-			cmd = 'sudo ./emulate.py -s ' + scenario + ' -r client'    
-			os.system("gnome-terminal -e 'bash -c \"" + cmd + "; exec bash\"'")
-		cmd = 'sudo ./emulate.py -s ' + scenario + ' -r botmaster'    
-		os.system("gnome-terminal -e 'bash -c \"" + cmd + "; exec bash\"'")
+        cmd = 'sudo python ./emulate.py -s ' + scenario + ' -r server'   
+        os.system("gnome-terminal -e 'bash -c \"" + cmd + "; exec bash\"'")
+        for _ in range(self.emulation_clients.value()):        
+            cmd = 'sudo python ./emulate.py -s ' + scenario + ' -r client'    
+            os.system("gnome-terminal -e 'bash -c \"" + cmd + "; exec bash\"'")
+        cmd = 'sudo python ./emulate.py -s ' + scenario + ' -r botmaster'    
+        os.system("gnome-terminal -e 'bash -c \"" + cmd + "; exec bash\"'")
+    
+    def startSim(self, mode, scenario, experiment, duration, topo_file = None, net_settings = None, dot_file = None, bt_file = None, ):
+        cmd = 'sudo ./sim --mode ' + mode + ' -s ' + scenario + ' -e ' + experiment + ' -t ' + str(duration)
         
+        if topo_file != None:
+            cmd += ' -f ' + topo_file
+            
+        if net_settings != None:
+            cmd += ' --net_settings ' + net_settings
+            
+        if dot_file != None:
+            cmd += ' --dot_file ' + dot_file
+            
+        if bt_file != None:
+            cmd += ' --back_traf ' + bt_file
+                
+        os.system("gnome-terminal -e 'bash -c \"" + str(cmd) + "; exec bash\"'")
+          
     def startScenario(self, settings_type, attack):        
         open_f = choseCorrectFile(settings_type)
         
+        scenario = SCENARIOS[settings_type]
         mode = self.mode.itemText( self.mode.currentIndex() )
         
-        if mode == EMULATION:
-            old_value = searchAndGet(settings_type, BOTMASTER, "self.command")           
-            searchAndReplace(settings_type, BOTMASTER, "self.command", old_value, attack+'()')
-            scenario = SCENARIOS[settings_type]
-            self.startEmulation(scenario)
+        
+        old_value = searchAndGet(settings_type, BOTMASTER, "self.command")  
+        if attack not in old_value:
+            searchAndReplace(settings_type, BOTMASTER, "self.command", old_value, attack+'()')            
+        
+        if mode == "Select a mode":
+            QtGui.QMessageBox.information(self, 'Error', '''You have not specified the operating mode.''',
+            QtGui.QMessageBox.Ok)       
+        elif mode == EMULATION:            
+            self.startEmulation(scenario)            
+        elif mode == NETNS3:
+            experiment = self.netns3_exp.itemText( self.netns3_exp.currentIndex() )            
+            if experiment == "Complex Network Experiment":
+                self.startSim('netns3', scenario, COMPLEX, self.complex_duration.value(), 
+                    self.complex_topo_file_location.text(), self.complex_net_settings_location.text(), 
+                    self.complex_dot_file_location.text(), self.complex_backtraf_location.text())
+            elif experiment == "Manual Topology Background Traffic Experiment":
+                self.startSim('netns3', cenario, MANUAL_TOPO_BT, self.manual_bt_duration.value(), 
+                    self.manual_bt_topo_file_location.text(), self.manual_bt_net_settings_location.text(), 
+                    self.manual_bt_dot_file_location.text(), self.manual_bt_back_traf_location.text())                
+            elif experiment == "Manual Topology Experiment":
+                self.startSim('netns3', scenario, MANUAL_TOPO, self.manual_bt_duration.value(), 
+                    self.manual_topo_file_location.text(), self.manual_net_settings_location.text())                    
             
-        #elif mode == NETNS3:
-        #elif mode == PURE_SIM:
-       
-	
-            
+        elif mode == PURE_SIM:               
+            experiment = self.netns3_exp.itemText( self.netns3_exp.currentIndex() )
+            if experiment == "Complex Network Experiment":
+                self.startSim('sim', scenario, COMPLEX, self.complex_duration.value(), 
+                    self.complex_topo_file_location.text(), self.complex_net_settings_location.text(), 
+                    self.complex_dot_file_location.text(), self.complex_backtraf_location.text())
+            elif experiment == "Manual Topology Background Traffic Experiment":
+                self.startSim('sim', cenario, MANUAL_TOPO_BT, self.manual_bt_duration.value(), 
+                    self.manual_bt_topo_file_location.text(), self.manual_bt_net_settings_location.text(), 
+                    self.manual_bt_dot_file_location.text(), self.manual_bt_back_traf_location.text())                
+            elif experiment == "Manual Topology Experiment":
+                self.startSim('sim', scenario, MANUAL_TOPO, self.manual_duration.value(), 
+                    self.manual_topo_file_location.text(), self.manual_net_settings_location.text())            
+            elif experiment == "Static Route Experiment":
+                self.startSim('sim', scenario, STATIC_ROUTE, self.static_duration.value())  
+            elif experiment == "Topology Experiment":
+                self.startSim('sim', scenario, TOPOLOGY, self.topo_duration.value(), 
+                    self.topo_file_location.text())
+                self.startPureSim(scenario, COMPLEX)
+                        
 def main():
     
     app = QtGui.QApplication(sys.argv)