summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2016-05-17 03:15:35 +0300
committerYaroslav Brustinov <ybrustin@cisco.com>2016-05-17 03:15:35 +0300
commitfad99b60c53a5dcf042a6b8b0d041d6d7116b871 (patch)
treecfccabde2ee2c734d789b78bc427c8b07365e992 /scripts
parentd4391c7b4ecaa68c6d3290374380759288a3191e (diff)
regression: add no-daemon flag that specifies stl server is running, no need daemons etc.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/automation/regression/stateful_tests/trex_general_test.py5
-rw-r--r--scripts/automation/regression/trex.py1
-rwxr-xr-xscripts/automation/regression/trex_unit_test.py48
-rwxr-xr-xscripts/master_daemon.py5
4 files changed, 36 insertions, 23 deletions
diff --git a/scripts/automation/regression/stateful_tests/trex_general_test.py b/scripts/automation/regression/stateful_tests/trex_general_test.py
index 33b954fc..4e3e07e8 100755
--- a/scripts/automation/regression/stateful_tests/trex_general_test.py
+++ b/scripts/automation/regression/stateful_tests/trex_general_test.py
@@ -60,6 +60,7 @@ class CTRexGeneral_Test(unittest.TestCase):
self.trex_crashed = CTRexScenario.trex_crashed
self.modes = CTRexScenario.modes
self.GAManager = CTRexScenario.GAManager
+ self.no_daemon = CTRexScenario.no_daemon
self.skipping = False
self.fail_reasons = []
if not hasattr(self, 'unsupported_modes'):
@@ -69,7 +70,7 @@ class CTRexGeneral_Test(unittest.TestCase):
self.is_VM = True if 'VM' in self.modes else False
if not CTRexScenario.is_init:
- if self.trex: # stateful
+ if self.trex and not self.no_daemon: # stateful
CTRexScenario.trex_version = self.trex.get_trex_version()
if not self.is_loopback:
# initilize the scenario based on received configuration, once per entire testing session
@@ -330,7 +331,7 @@ class CTRexGeneral_Test(unittest.TestCase):
self.trex.force_kill(confirm = False)
if not self.skipping:
# print server logs of test run
- if self.trex and CTRexScenario.server_logs:
+ if self.trex and CTRexScenario.server_logs and not self.no_daemon:
try:
print(termstyle.green('\n>>>>>>>>>>>>>>> Daemon log <<<<<<<<<<<<<<<'))
daemon_log = self.trex.get_trex_daemon_log()
diff --git a/scripts/automation/regression/trex.py b/scripts/automation/regression/trex.py
index 7440d76d..2c55aad2 100644
--- a/scripts/automation/regression/trex.py
+++ b/scripts/automation/regression/trex.py
@@ -37,6 +37,7 @@ class CTRexScenario:
test_types = {'functional_tests': [], 'stateful_tests': [], 'stateless_tests': []}
is_copied = False
GAManager = None
+ no_daemon = False
class CTRexRunner:
"""This is an instance for generating a CTRexRunner"""
diff --git a/scripts/automation/regression/trex_unit_test.py b/scripts/automation/regression/trex_unit_test.py
index f2cf38cb..aaf98708 100755
--- a/scripts/automation/regression/trex_unit_test.py
+++ b/scripts/automation/regression/trex_unit_test.py
@@ -129,18 +129,21 @@ class CTRexTestConfiguringPlugin(Plugin):
parser.add_option('--ga', action="store_true", default = False,
dest="ga",
help="Flag to send benchmarks to GA.")
+ parser.add_option('--no-daemon', action="store_true", default = False,
+ dest="no_daemon",
+ help="Flag that specifies to use running stl server, no need daemons.")
+
def configure(self, options, conf):
- self.collect_only = options.collect_only
- if self.collect_only:
- return
+ self.collect_only = options.collect_only
self.functional = options.functional
self.stateless = options.stateless
self.stateful = options.stateful
self.pkg = options.pkg
self.json_verbose = options.json_verbose
self.telnet_verbose = options.telnet_verbose
- if self.functional and (not self.pkg or self.no_ssh):
+ self.no_daemon = options.no_daemon
+ if self.collect_only or self.functional:
return
if CTRexScenario.setup_dir and options.config_path:
raise Exception('Please either define --cfg or use env. variable SETUP_DIR, not both.')
@@ -161,15 +164,17 @@ class CTRexTestConfiguringPlugin(Plugin):
self.loggerPath = options.log_path
# initialize CTRexScenario global testing class, to be used by all tests
CTRexScenario.configuration = self.configuration
+ CTRexScenario.no_daemon = self.no_daemon
CTRexScenario.benchmark = self.benchmark
CTRexScenario.modes = set(self.modes)
CTRexScenario.server_logs = self.server_logs
CTRexScenario.trex = CTRexClient(trex_host = self.configuration.trex['trex_name'],
verbose = self.json_verbose)
- if not CTRexScenario.trex.check_master_connectivity():
+ if not self.no_daemon and not CTRexScenario.trex.check_master_connectivity():
print('Could not connect to master daemon')
sys.exit(-1)
- CTRexScenario.scripts_path = CTRexScenario.trex.get_trex_path()
+ if not self.no_daemon:
+ CTRexScenario.scripts_path = CTRexScenario.trex.get_trex_path()
if options.ga and CTRexScenario.setup_name:
CTRexScenario.GAManager = GAmanager(GoogleID = 'UA-75220362-4',
UserID = CTRexScenario.setup_name,
@@ -192,25 +197,27 @@ class CTRexTestConfiguringPlugin(Plugin):
CTRexScenario.is_copied = True
if self.functional or self.collect_only:
return
- print('Restarting TRex daemon server')
- res = CTRexScenario.trex.restart_trex_daemon()
- if not res:
- print('Could not restart TRex daemon server')
- sys.exit(-1)
-
- trex_cmds = CTRexScenario.trex.get_trex_cmds()
- if trex_cmds:
- if self.kill_running:
- CTRexScenario.trex.kill_all_trexes()
- else:
- print('TRex is already running')
+ if not self.no_daemon:
+ print('Restarting TRex daemon server')
+ res = CTRexScenario.trex.restart_trex_daemon()
+ if not res:
+ print('Could not restart TRex daemon server')
sys.exit(-1)
+ trex_cmds = CTRexScenario.trex.get_trex_cmds()
+ if trex_cmds:
+ if self.kill_running:
+ CTRexScenario.trex.kill_all_trexes()
+ else:
+ print('TRex is already running')
+ sys.exit(-1)
+
if self.stateless:
cores = self.configuration.trex.get('trex_cores', 1)
if 'virt_nics' in self.modes and cores > 1:
raise Exception('Number of cores should be 1 with virtual NICs')
- CTRexScenario.trex.start_stateless(c = cores)
+ if not self.no_daemon:
+ CTRexScenario.trex.start_stateless(c = cores)
CTRexScenario.stl_trex = STLClient(username = 'TRexRegression',
server = self.configuration.trex['trex_name'],
verbose_level = self.json_verbose)
@@ -232,7 +239,8 @@ class CTRexTestConfiguringPlugin(Plugin):
if self.stateful:
CTRexScenario.trex = None
if self.stateless:
- CTRexScenario.trex.force_kill(False)
+ if not self.no_daemon:
+ CTRexScenario.trex.force_kill(False)
CTRexScenario.stl_trex = None
diff --git a/scripts/master_daemon.py b/scripts/master_daemon.py
index 9214cfc8..19f05bf8 100755
--- a/scripts/master_daemon.py
+++ b/scripts/master_daemon.py
@@ -268,7 +268,10 @@ if os.path.isfile(args.trex_dir):
raise Exception('Given path is a file')
if not os.path.exists(args.trex_dir):
os.makedirs(args.trex_dir)
-os.chmod(args.trex_dir, 0o777)
+ os.chmod(args.trex_dir, 0o777)
+elif args.allow_update:
+ os.chmod(args.trex_dir, 0o777)
+
if not os.path.exists(tmp_dir):
os.makedirs(tmp_dir)