diff --git a/tools/dringctrl/test_config.ini b/tools/dringctrl/test_config.ini new file mode 100644 index 0000000000000000000000000000000000000000..2d739ce54fc31b8194e270533aedd2a9ac7869b5 --- /dev/null +++ b/tools/dringctrl/test_config.ini @@ -0,0 +1,36 @@ +# +# Copyright (C) 2015 Savoir-faire Linux Inc. +# Author: Eloi Bail <eloi.bail@savoirfairelinux.com> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +[dht] +testAccount = <ringID> + +[sip] +testAccount = <sip account> + +[ip2ip] +testAccount = <ip> + +[video] +minBitrate = 400 +maxBitrate = 4000 +incBitrate = 100 +inputFile = <absolut path to file> + +[iteration] +nbIteration = 100 +delay = 60 diff --git a/tools/dringctrl/tester.py b/tools/dringctrl/tester.py index 1c934f761f58374cf2b3d995c849d8ea424bc793..bd4c4aa32c1bff4df4643d2246121a69443586a5 100644 --- a/tools/dringctrl/tester.py +++ b/tools/dringctrl/tester.py @@ -31,16 +31,12 @@ import sys import os import time +import configparser + from threading import Thread from random import shuffle from errors import * - - - -WITH_HOLD = True -WITHOUT_HOLD = False - ALL_TEST_NAME = { 'TestConfig': 'testConfig', 'LoopCallDht': 'testLoopCallDht', @@ -51,21 +47,15 @@ ALL_TEST_NAME = { class DRingTester(): - DHT_ACCOUNT_ID = '' - SIP_ACCOUNT_ID = '' - # Dht Client - SIP_TEST_ACCOUNT = 'sf1' - # Dht Client - DHT_TEST_ACCOUNT = '280ca11317ec90a939c86fbfa06532dbb8a08f8a' - # Ring Client - RING_TEST_ACCOUNT = '192.168.50.143' - # Polycom Client - POLYCOM_TEST_ACCOUNT = '192.168.40.38' - FILE_TEST = '/home/eloi/Videos/Mad_Max_Fury_Road_2015_Trailer_F4_5.1-1080p-HDTN.mp4' - - minBitrate = 400 - maxBitrate = 4000 - incBitrate = 100 +# init to default values + dhtAccountId = '' + sipAccountId = '' + dhtTestAccount = '' + sipTestAccount = '' + inputFile = '' + minBitrate = 0 + maxBitrate = 0 + incBitrate = 0 def testConfig(self, ctrl): print("**[BEGIN] test config") @@ -124,18 +114,19 @@ class DRingTester(): while count < nbIteration: print("[%s/%s]" % (count, nbIteration)) - self.setRandomActiveCodecs(ctrl, self.DHT_ACCOUNT_ID) + self.setRandomActiveCodecs(ctrl, self.dhtAccountId) - callId = ctrl.Call(self.DHT_TEST_ACCOUNT) + callId = ctrl.Call(self.dhtTestAccount) # switch to file input - ctrl.switchInput(callId,'file://'+self.FILE_TEST) + ctrl.switchInput(callId,'file://'+self.inputFile) time.sleep(delay) ctrl.HangUp(callId) count += 1 + print("**[SUCCESS] DHT Call Test") print("**[END] DHT Call Test") # testLoopCallDhtWithHold @@ -143,18 +134,18 @@ class DRingTester(): # perform stress hold/unhold between each call def testLoopCallDhtWithHold(self, ctrl, nbIteration, delay): - print("**[BEGIN] DHT Call Test") + print("**[BEGIN] DHT Call Test With Hold") count = 0 while count < nbIteration: print("[%s/%s]" % (count, nbIteration)) - self.setRandomActiveCodecs(ctrl, self.DHT_ACCOUNT_ID) + self.setRandomActiveCodecs(ctrl, self.dhtAccountId) - callId = ctrl.Call(self.DHT_TEST_ACCOUNT) + callId = ctrl.Call(self.dhtTestAccount) # switch to file input - ctrl.switchInput(callId,'file://'+self.FILE_TEST) + ctrl.switchInput(callId,'file://'+self.inputFile) delayHold = 5 nbHold = delay / (delayHold * 2) @@ -168,7 +159,8 @@ class DRingTester(): ctrl.HangUp(callId) count += 1 - print("**[END] DHT Call Test") + print("**[SUCCESS] DHT Call Test With Hold") + print("**[END] DHT Call Test With Hold") # testLoopCallDhtWithIncBitrate @@ -184,14 +176,14 @@ class DRingTester(): while count < nbIteration: print("[%s/%s]" % (count, nbIteration)) - self.setRandomActiveCodecs(ctrl, self.DHT_ACCOUNT_ID) + self.setRandomActiveCodecs(ctrl, self.dhtAccountId) print("setting video bitrate to "+str(currBitrate)) - ctrl.setCodecBitrate(self.DHT_ACCOUNT_ID, currBitrate) + ctrl.setCodecBitrate(self.dhtAccountId, currBitrate) - callId = ctrl.Call(self.DHT_TEST_ACCOUNT) + callId = ctrl.Call(self.dhtTestAccount) # switch to file input - ctrl.switchInput(callId,'file://'+self.FILE_TEST) + ctrl.switchInput(callId,'file://'+self.inputFile) time.sleep(delay) @@ -202,22 +194,24 @@ class DRingTester(): if (currBitrate > self.maxBitrate): currBitrate = self.minBitrate + print("**[SUCESS] VIDEO Bitrate Test") print("**[END] VIDEO Bitrate Test") # testSimultaneousLoopCallDht # perform <nbIteration> simultaneous DHT calls using <delay> between each call def testSimultaneousLoopCallDht(self, ctrl, nbIteration, delay): + print("**[BEGIN] Simultaneous DHT call test") count = 0 while count < nbIteration: print("[%s/%s]" % (count, nbIteration)) - self.setRandomActiveCodecs(ctrl, self.DHT_ACCOUNT_ID) + self.setRandomActiveCodecs(ctrl, self.dhtAccountId) # do all the calls currCall = 0 NB_SIMULTANEOUS_CALL = 10; while currCall <= NB_SIMULTANEOUS_CALL: - ctrl.Call(self.DHT_TEST_ACCOUNT) + ctrl.Call(self.dhtTestAccount) time.sleep(1) currCall = currCall + 1 @@ -229,7 +223,8 @@ class DRingTester(): count += 1 - print("**[END] Call Test for account:" + localAccount) + print("**[SUCESS] Simultaneous DHT call test") + print("**[END] Simultaneous DHT call test") @@ -243,36 +238,22 @@ class DRingTester(): return #getConfig - self.DHT_ACCOUNT_ID = ctrl.getAllAccounts('RING')[0] - self.SIP_ACCOUNT_ID = ctrl.getAllAccounts('SIP')[0] - TEST_NB_ITERATION = 100 - TEST_DELAY = 30 + self.dhtAccountId = ctrl.getAllAccounts('RING')[0] + self.sipAccountId = ctrl.getAllAccounts('SIP')[0] - getattr(self, ALL_TEST_NAME[testName])(ctrl,TEST_NB_ITERATION, TEST_DELAY) + config = configparser.ConfigParser() + config.read('test_config.ini') + self.dhtTestAccount = str(config['dht']['testAccount']) + self.sipTestAccount = str(config['sip']['testAccount']) + self.inputFile = str(config['video']['inputFile']) + self.minBitrate = int(config['video']['minBitrate']) + self.maxBitrate = int(config['video']['maxBitrate']) + self.incBitrate = int(config['video']['incBitrate']) + testNbIteration = config['iteration']['nbIteration'] + delay = config['iteration']['delay'] + TEST_NB_ITERATION = 100 + TEST_DELAY = 30 -""" - - # DHT tests - dhtAccount = ctrl.getAllAccounts('RING')[0] - self.startDynamicBitrateCallTests(ctrl, dhtAccount, DHT_TEST_ACCOUNT, 100, 60, 250, 4000, 100) - self.startCallTests(ctrl, dhtAccount, DHT_TEST_ACCOUNT, 100, 60, WITHOUT_HOLD) - self.startCallTests(ctrl, dhtAccount, DHT_TEST_ACCOUNT, 100, 60, WITH_HOLD) - - # RING IP2IP tests - self.startCallTests(ctrl, 'IP2IP', RING_TEST_ACCOUNT, 1000, 20, WITHOUT_HOLD) - self.startCallTests(ctrl, 'IP2IP', RING_TEST_ACCOUNT, 1000, 20, WITH_HOLD) - - - - # Polycom IP2IP tests - self.startCallTests(ctrl, 'IP2IP', POLYCOM_TEST_ACCOUNT, 1000, 20, WITHOUT_HOLD) - self.startCallTests(ctrl, 'IP2IP', POLYCOM_TEST_ACCOUNT, 1000, 20, WITH_HOLD) - - # SIP tests - sipAccount = ctrl.getAllAccounts('SIP')[0] - # self.startSimultaneousCallTests(ctrl, sipAccount, SIP_TEST_ACCOUNT, 10, 40, WITHOUT_HOLD,10) - self.startCallTests(ctrl, sipAccount, SIP_TEST_ACCOUNT, 1000, 20, WITH_HOLD) - self.startCallTests(ctrl, sipAccount, SIP_TEST_ACCOUNT, 1000, 20, WITHOUT_HOLD) -""" + getattr(self, ALL_TEST_NAME[testName])(ctrl,int(testNbIteration), int(delay))