Compare commits

...

6 Commits

5 changed files with 630 additions and 621 deletions

View File

@ -16,19 +16,25 @@ accept_untrusted_certs = true
[settings] [settings]
max_fails = 3 max_fails = 3
send_voice = true send_group_monitoring_before_each_call = 'true'
send_gps = true gps_report_interval = 1000 # The interval in which the GPS is sent
send_group_monitoring_before_each_call = false
gps_report_interval = 10000 # The interval in which the GPS is sent
gps_lat_start_point = 46.217802 gps_lat_start_point = 46.217802
gps_lng_start_point = 24.776126 gps_lng_start_point = 24.776126
delay_between_clients = 300 delay_between_clients = 300
testing_duration = 600 # seconds testing_duration = 40 # seconds
[assets]
ids = [ [[assets]]
5488 asset_id = 63
] group_id = 1
generate_voice = true
generate_gps = true
[[assets]]
asset_id = 64
group_id = 1
generate_voice = false
generate_gps = true
[sounds] [sounds]
tracks = ['1.mp3','2.mp3','3.mp3','4.mp3','5.mp3','6.mp3','7.mp3','8.mp3','9.mp3','10.mp3','11.mp3','12.mp3','13.mp3','14.mp3','15.mp3','16.mp3','17.mp3','18.mp3','19.mp3'] tracks = ['1.mp3','2.mp3','3.mp3','4.mp3','5.mp3','6.mp3','7.mp3','8.mp3','9.mp3','10.mp3','11.mp3','12.mp3','13.mp3','14.mp3','15.mp3','16.mp3','17.mp3','18.mp3','19.mp3']

View File

@ -15,6 +15,9 @@ let configs = {
elogs: config.get('elogs'), elogs: config.get('elogs'),
} }
console.log('configs', configs)
// Start simulation. // Start simulation.
console.log('Starting simulation...'); console.log('Starting simulation...');
var simulator = new Simulator(configs); var simulator = new Simulator(configs);

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,6 @@ const OpusEncoder = require('node-opus').OpusEncoder;
class Mumble { class Mumble {
constructor(id, configs, connectedCallback) { constructor(id, configs, connectedCallback) {
console.log('------', configs)
this.id = id; this.id = id;
this.configs = configs; this.configs = configs;
let mumble = configs.mumble; let mumble = configs.mumble;
@ -104,7 +103,7 @@ class Mumble {
.on('reconnect', function (n, delay) { .on('reconnect', function (n, delay) {
// n = current number of reconnect // n = current number of reconnect
// delay = delay used before reconnect // delay = delay used before reconnect
console.log('------ Server reconnect...'); // console.log('------ Server reconnect...');
// utils.writeErrorLog(`ERROR_MUMBLE_RECONNECT`); // utils.writeErrorLog(`ERROR_MUMBLE_RECONNECT`);
// utils.exitWriteErrorLog(`ERROR_MUMBLE_RECONNECT`); // utils.exitWriteErrorLog(`ERROR_MUMBLE_RECONNECT`);
}) })

View File

@ -12,12 +12,12 @@ class Simulator {
this.configs = configs; this.configs = configs;
this.token; this.token;
// Read assets ids from configs this.assets = configs.assets;
this.assetIds = configs.assets.ids; this.assetIds = this.assets.map(asset => asset.asset_id);
this.apiEndpoint = this.configs.api.use_secure ? 'https' : 'http'; this.apiEndpoint = this.configs.api.use_secure ? 'https' : 'http';
this.apiEndpoint += '://' + this.configs.api.host + (this.configs.api.port ? (':' + this.configs.api.port) : ''); this.apiEndpoint += '://' + this.configs.api.host + (this.configs.api.port ? (':' + this.configs.api.port) : '');
async.waterfall([ async.waterfall([
this._manageLogs.bind(this), this._manageLogs.bind(this),
this._unregisterAsstes.bind(this), this._unregisterAsstes.bind(this),
@ -36,16 +36,17 @@ class Simulator {
_start() { _start() {
const settings = this.configs.settings; const settings = this.configs.settings;
this.assetIds.forEach((id, i) => { // this.assetIds.forEach((id, i) => {
this.assets.forEach((asset, i) => {
let delay_between_clients = 500; let delay_between_clients = 500;
if(settings.hasOwnProperty('delay_between_clients')) { if(settings.hasOwnProperty('delay_between_clients')) {
delay_between_clients = parseInt(settings.delay_between_clients, 10); delay_between_clients = parseInt(settings.delay_between_clients, 10);
} }
console.log('id', id, i * delay_between_clients+'ms') console.log('asset_id', asset.asset_id, i * delay_between_clients+'ms')
delay_between_clients = this._getRandomInt(delay_between_clients); delay_between_clients = this._getRandomInt(delay_between_clients);
setTimeout(() => { setTimeout(() => {
new Asset(id, this.configs, this.token); new Asset(asset, this.configs, this.token);
// console.log('id, this.configs, this.token', id, this.configs, this.token) // console.log('id, this.configs, this.token', id, this.configs, this.token)
}, i * delay_between_clients); }, i * delay_between_clients);
}) })
@ -74,6 +75,7 @@ class Simulator {
} }
_unregisterAsstes(callback) { _unregisterAsstes(callback) {
let url = this.apiEndpoint + '/audio/un-register/[' + this.assetIds + ']/'; let url = this.apiEndpoint + '/audio/un-register/[' + this.assetIds + ']/';
Request.post( Request.post(
url, url,